-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update swagger-parser to v2.0.3-OpenAPITools.org-1 #951
Conversation
For a reason that I ignore, the new swagger-parser version has an impact on CC: @farcaller @frol, @bjgill |
Following change was observed when no --- with version 2.0.2-OpenAPITools.org-1
+++ with version 2.0.3-OpenAPITools.org-1
openapi: 3.0.1
info:
title: rust-server-test
description: This spec is for testing rust-server-specific things
version: 1.0.0
+servers:
+- url: /
paths:
/dummy:
get:
summary: A dummy endpoint to make the spec valid.
responses:
200:
description: Success
content: {}
components:
schemas:
additionalPropertiesObject:
type: object
additionalProperties:
type: string
description: An additionalPropertiesObject
example: foo A new server containing "/" is defined. -- Having no
The new value seems correct to me (OAS3 specification server object)
The change in the generated code might be unexpected now, but I think that we will need to fix it. |
I guess it's technically correct that defining a base path of And, indeed, from your first link:
As I understand it, this implies that I suspect there are two possible solutions - either we alter the Rust code to strip the right-most What's the urgency on this? Is this something you were planning to fix? I could probably have a look sometime later this week. As an aside, I wonder if this is going to cause problems for other generators as well. Do we have any other generators which concatenate the base path and path, and so would end up with |
@bjgill: I have the feeling you are mixing basepath and host. In OASv2 you need to provide 3 elements: host: localhost:8080
basePath: /v2
schemes:
- http The result is one server entry in an OASv3: servers:
- url: http://localhost:8080/v2 In OASv3:
When the location is relative:
In the In previous Swagger-Parser version: not having an In my opinion swagger-parser has improved the conversion. Notice that the discussion is about checking if Swagger-Parser is doing a better job now or if they have introduced a bug. This should be the criteria to accept or not the Pull-Request. What we do based on a given input is up to our project and might need some fixes (can be made in separated PR). |
Doing a Swagger-Parser update with a minor release (second digit in the version number) is a good practice. Other users are waiting for other fixes in the parser. The discussion was triggered here because, while I was updating the lib, I have noticed some changes in the generated rust sample and I was trying to figure out if this is due to a swagger-parser issue (like a regression). For me the discussion pointed out that the rust-generator might need to better handle cases like (OASv3): openapi: 3.0.1
info:
title: test
description: Test API
version: 1.2.3
servers:
- url: / Independently of this Swagger-Parser update. With the new parser version the same case in OASv2 can now be also considered: swagger: '2.0'
info:
description: Test API
version: 1.2.3
title: test
schemes:
- http This was not possible before due to an issue in the parser. Keep in mind that this is a sort of corner case. Most of the spec out there will define a host (OASv2) or an absolute server location (OASv3). Not fixing this case right now is not a big deal at all. This is why I hope you agree with this PR that does the Swagger-Update. |
I agree with you that we can move forward with this PR |
I agree with you that we can move forward with this PR |
Was busy writing a comment agreeing, but clearly not fast enough. I'll have a look at getting rust-server fixed up, then. |
See OpenAPITools#951 for the motivation behind this change
* Update swagger-parser to v2.0.3-OpenAPITools.org-1 * Run bin/rust-server-petstore.sh
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,3.3.x
,4.0.x
. Default:master
.Description of the PR
With our
3.3.0
release we would like to update Swagger-Parser.Version
2.0.3-OpenAPITools.org-1
was published and is intended to be used until the official2.0.3
is published (see #787)Related PR: last Swagger-Parser update => #696