Remove swagger: 2.0 from spec
See original GitHub issueThe current OpenAPI spec has "swagger": "2.0"
in it. Since it’s no longer called the swagger spec, this should go away.
I do believe we should continue to declare the version in the specification though, to make tooling more tolerant. Some points about that.
- One major issue with the Swagger 2.0 tooling was that it was looking for the “2.0” version in the spec itself. That meant, a “2.0.1” spec–even if structurally compatible–would not work. We should advise all tooling vendors as to versioning process and how they should detect versions inside the spec. Reference the concerns in #107. In a couple cases we probably should have bumped the spec version in 2.0 to 2.0.1, etc. Let’s not make that mistake again
- Declaring a semver approach for the spec makes sense. We don’t need to go too far into the details in this ticket as to what constitutes a major, minor, patch version, but in general, if we put a version in the next spec version (which I advocate), it should be in the
x.y.z
format. - Making it “2.0” as a string vs. number was dumb. The above point solves that.
Issue Analytics
- State:
- Created 8 years ago
- Comments:15 (10 by maintainers)
Top Results From Across the Web
OpenAPI Specification - Version 2.0 - Swagger
Version 2.0 specification defines a set of files required to describe an API. ... can be overridden at the operation level, but cannot...
Read more >How to Turn Off Swagger-ui in Production - Baeldung
In this short tutorial, we'll look at how to turn Swagger off in production. 2. Swagger Configuration.
Read more >api - How to reuse swagger definitions and remove some of ...
I want to lessen my code so I reused the User definition as my schema. The problem here is that I do not...
Read more >Guide - 7.10.12.2 Migrating to OpenApi 3.0 and Swagger 2.X ...
Annotations for Operations ; @ApiOperation, @Operation, See below for usage ; @APIResponses, removed, See below for usage ; @APIResponse, @ApiResponse, See below ...
Read more >Migrating from SpringFox - Springdoc-openapi
Remove springfox and swagger 2 dependencies. Add springdoc-openapi-ui dependency instead. ... Replace swagger 2 annotations with swagger 3 ...
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
@fehguy In that case, I suggest to change
$schema: https://openapis.org/schemas/v3.0.0.json
into$schema: https://openapis.org/version/v3.0.0/schemas/latest.json
. In this caselatest
is alias for the lastest version of schema corresponding to OAIv3.0.0
. But if you want to be precise you can set it to:$schema: https://openapis.org/version/v3.0.0/schemas/v1.0.1.json
Which will point tov1.0.1
of the schema for OAIv3.0.0
.Aliasing isn’t a problem since Git support symlinks.
Here is my proposal for addressing this.
Options:
schema
namespace instead of a OAI versionoas
attribute for the versionPros:
schema URL
is more flexible.oas
is more tooling friendly. Most tools cannot do much with a new version of the schemaCons:
schema url
is very long. Useful for validation, not for interpretationoas
as a numeric version has the same issue asswagger: "2.0"
Recommendation:
oas
specifier with semver semantics:which will eventually be released as:
The multiple
.
will avoid the string/number issue fromswagger: 2.0
introduce an optional
schema
URL which can be used for validation. If absent, the tooling will choose the appropriate OAS schema.Tooling will be responsible for parsing with semver compatibilty:
Given a version number MAJOR.MINOR.PATCH, increment the:
example: