-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Support relative server URL #342
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
Support relative server URL #342
Comments
See also discussion in #239 In my opinion this is the responsibility of the parser to convert the This code snippets already show that the parser does not resolve the server value correctly: String inputSpec = "http://localhost:8090/openapi.json";
OpenAPIParser openApiParser = new OpenAPIParser();
ParseOptions options = new ParseOptions();
options.setResolve(true);
options.setFlatten(true);
OpenAPI openAPI = openApiParser.readLocation(inputSpec, null, options).getOpenAPI();
String string = Yaml.mapper().writerWithDefaultPrettyPrinter().writeValueAsString(openAPI);
System.out.println(string); The value stays unchanged. I have filed swagger-api/swagger-parser#742 for that. |
I'm not sure if I understand correctly, so I wanted to check: Is the intended design that it is impossible to end up with a generated client which uses relative URLs? For example, should the following HTTP request be impossible to generate?
...and should it instead have to be an absolute URL? |
I have the same use case as #1290 (api deployed with the project that consumes the api) and it looks weird to me to fix this on the individual generator basis, should this be something to be fixed generally (maybe simply allowing to override the base path?) |
Description
Generator doesn't support relative URL for OAIv3 servers.
Whereas the spec specifies
openapi-generator version
3.0.1
OpenAPI declaration file content or url
OpenAPI petstore's server URL is relative and it's
/v3
Steps to reproduce
PetApiClient
should be http://localhost:8080/v3 but it's http://localhost/v3The text was updated successfully, but these errors were encountered: