-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Java] Issue with evaluating server URL (3.0.0-rc1) #8412
Comments
can anyone give some suggestion for this issue |
Bump, I am experiencing exactly the same issue using version 3.0.22: Server configuration: {
"url": "http://{instance}:{port}/api/ext/{version}",
"variables": {
"instance": {
"default": "localhost"
},
"port": {
"enum": [
"80",
"443",
"1356"
],
"default": "1356"
},
"version": {
"default": "1.0"
}
}
} Output of
|
Saw that someone was looking for a fix, so I created one. PR - #10565 |
@douglasbgray thanks for the fix. This looks good to me. I was wondering you have any plan to merge your changes? Your branch was created a year ago, but not merged yet. I was wondering you have any plan for it. Thanks. |
Hi @jaekim0312 I am not an administrator for this project, so I do not have merge rights. I am not part of the project team, just thought I could help with a solution, since it seemed like my Issue was not being worked on. Only the owners can merge changes and I am not sure they are actively reviewing and merging changes from outside contributors right now. |
I am getting the exactly same issue when generating server stubs with python-flask locally using swagger-codegen version 3.0.32 |
Same here when using this command
It looks like that PR described before fixes that issue. @HugoMario , @frantuma could you please take a look at that PR please #10565 |
fixed by #10565 |
Description
When running code gen on an openapi 3.x document with a
servers
section, if you use a variable for the port, code gen throws an exception. The exception does not block the generation, but does generate a warning in the output. In addition method returns null in this circumstance. I not sure how this impacts downstream processes or the availability ofservers
for use in templates.Error looks like:
Swagger-codegen version
3.0.0-rc1
Swagger declaration file content or url
Command line used for generation
Using the code generation plugin, so just a simple
mvn clean compile
Steps to reproduce
I have created a sample project that shows the error and has steps to reproduce here: https://github.com/douglasbgray/code-gen-server-issue
Related issues/PRs
Did not find any open issues related to this
Suggest a fix/enhancement
Error is coming from
URLPathUtil.java
. Before checking if the url can be converted into ajava.net.URL
, it needs to perform the variable substitution, which would resolve the {port} and generate a URL that would be valid.The text was updated successfully, but these errors were encountered: