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
[OAS 3.0.0] yaml with multiple server urls generates code using first url only #590
Comments
This is a known issue in my opinion because of the TODO in the code: Line 49 in d42ff75
Thank you a lot for this issue, because I think it is important for us to support the most OAS3 concepts we can.
The current behavior is to just take the first one in the generated code. I am not saying that it can not be changed... What do you expect in the generated code? We also need to consider that it is possible to indicate server url/port with a configuration (I am not sure if this is for all generators or just some of them). Related to this topic (issue #592), it is also possible to use variables in server definitions: servers:
- url: https://api.gigantic-server.com:8080/{version}
description: The production API server
variables:
version:
enum:
- 'v1'
- 'v2'
default: 'v2' In theory out of the enum value we could generate multiple server URLs... |
Been meaning to add a ticket for this as well, ive got a spec with paths that start with version so was looking to use this to move it into a baseurl and change paths where needed (only it doesnt seem to work at the moment) |
UPDATE: we've added better We'll need to update the templates accordingly. If anyone wants to help on this, please reply to let us know. |
…penapi-generator#590) in the openapi-codegen
@wing328 could you provide an example for lets say, |
@pecigonzalo thanks for offering help. Let me create an example using the Ruby generator. Will keep you posted. |
@pecigonzalo I've filed #1280 to add better We can use a similar approach in the Python API client. Thanks for offering help to add better "servers" support in other generators. |
I have a PR #4755 with a support for multiple servers in Go experimental client. |
@wing328, would be possible to set some parameter at command prompt to override values in model's server variable ? |
Description
I wrote a yaml following OAS 3.0, its servers part looked like this:
I used this yaml generating python code, and didn' t see the second url('http://1.1.1.1:9201/v2')
So, my question is: What is the desired result if the yaml contains multiple urls?
openapi-generator version
I installed openapi-generator using Homebrew yesterday.
OpenAPI declaration file content or url
Command line used for generation
openapi-generator generate -i swagger.yaml -g python -o /tmp/test/python-3
Steps to reproduce
Running the command above is enough.
The text was updated successfully, but these errors were encountered: