Swagger.next: Let's not use hashes anymore
See original GitHub issuePutting 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
Issue Analytics
- State:
- Created 9 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
How To Make Swagger Codegen Work For Your Team - Medium
Swagger Codegen, the open source API client code generator, can be an extremely powerful, timesaving collaborative tool for your team.
Read more >Advanced Data - API Handyman
Writing OpenAPI (Swagger) Specification Tutorial Series ... This tutorial teaches everything about the OpenAPI 2.0 Specification (fka. as Swagger) ...
Read more >Swagger complex response model with dynamic key value ...
What I'm trying to model is a hash map with dynamic keys and values. This is needed to allow a localization. The languages...
Read more >Building Client SDKs with Swagger Codegen
Swagger CodeGen– original code generation tool supported by SmartBear. We will use Swagger CodeGen to generate client SDKs for the Alma User API ......
Read more >Extending OpenAPI - FastAPI - tiangolo
The API docs use Swagger UI and ReDoc, and each of those need some JavaScript and CSS files. By default, those files are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Voting to close.
@OAI/tdc propose closing this with no action, please approve / reject