Skip to content

Swagger.next: Let's not use hashes anymore  #208

Closed
@mohsen1

Description

@mohsen1

Putting paths and operations in a hash made all sort of problems. The biggest problem is keeping order status of paths and operations. Tags can help organize the paths and operations but that's not enough. Most of people expect Swagger document keep it's order status when they are authoring one.
Other problem with using hashes is that we are using keys as a data storage. This makes it impossible to have other keys in paths or operation because every key is a path or operation.

Lets use arrays for the next version and make life easier for everyone. It will not make specs uglier. Here is an example:

# Example YAML for the bare minimum of required elements
# See petstore.yaml for a more comprehensive example
swagger: '3.0'
info:
  version: "1.0.0"
  title: petstore
paths:
  - 
    path: /pets # maybe path can have multiple endpoints like `path: [ "/pets", "/animals"]
    consumes:  # path level consumes 
      - "text/html"
    operations:
      - method: get # maybe we can define a batch of operations in one operation i.e. `methods: [ "post", "head"]
        responses:
          - 
            code: "200" # ability to have responses defined by code OR other means (solving response overloading issue)
            description:  Describe the 200 response in more detail

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions