-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
[BUG] Path problem of inout spec file in windows: Illegal character in opaque part at index 2: C:....\ApiFirstServer-main\build\openapiDir\petstore.yaml #15202
Comments
Hi, I can't reproduce the problem. Like you, I'm using Windows 10, gradle 7.5 and "org.openapi.generator" version "6.5.0". I think the problem might be related to the way how you invoke gradle. |
I am experiencing the same error as the author of this issue. The error occurs for me in PowerShell, CMD, Git Bash, and IDEA. |
Just check which openApi version is supported by openapi-generator-maven-plugin. In my case i use openapi-generator-maven-plugin 6.6.0. I got this error when i use openapi: 3.1.0 in my openApi yml file. With openapi: 3.0.3 it works. |
This also occurs with maven on Windows 11 with
Changing back to |
please try openapi-generator v7.0.1 which provides beta support for v3.1.0 spec. |
Same error with 7.0.1., but it seems like its is a problem of swagger resolve
|
Same here, generator |
Same exception as @kromit . openapi-generator-maven-plugin |
right, please report the issue to swagger parser. thanks. |
That issue references #10053 on this project (which this issue is maybe a duplicate of?) There is a possible workaround mentioned (involving use of a later version of My functioning workaround is to just fall back to using openapi spec |
Another possible workaround is to use the Note that docker-desktop for Windows requires a paid subscription for commercial use. Here's my Gradle task that seems to be working:
|
I had the same problem with Maven. The "" symbol , used in the inputspec configuration parameter, creates the problem during the parsing of the URI containing the path to the yaml file. my workaround is to create a property in my pom: <input.spec.original>${basedir}/src/main/resources/api/openapi.yaml<input.spec.original> then I replace all the "" symbols to "/" using a maven plugin. org.codehaus.mojo build-helper-maven-plugin ${maven.build-helper.version} regex-property regex-property project.apis.folder ${project.apis.folder.original} \\ / falseAnd finally i pass the value of the property named "project.apis.folder" as input for the OpenApi generator. org.openapitools openapi-generator-maven-plugin 7.1.0 ... ${project.apis.folder} ... ...I hope this workaround can help. |
I have the same problem on Windows with Maven 3.8.7, OpenAPI Generator 7.2.0 and OpenAPI Version 3.1.0.
OpenAPIParser expect inputSpec as URL, so I think the maven plugin should convert |
As a possible workaround, you can use a relative path, for instance: |
Note that this doesn't work with multi module projects, especially if the spec is in a different module. |
That's true! |
I was also facing the issue today. The "${buildDir}" part is returning a path including backslashes (''), which was for me causing the problem. Replacing them to a forward slash ('/') was the solution for me. This link was the solution for me: https://www.bennorthrop.com/Snippets/string-replace-in-maven-with-regex.php |
it's broken with: openapi: 3.1.0
Windows 11 + openapi: 3.1.0 problem is path which it try to use: D:\ instead of /
Edit: added my workaround from #14075 (comment) Simple workaround:
|
this workaround fixes the issue for me: #14075 (comment) |
Encountered the same issue. Here's a workaround that uses a newer Gradle approach (.kts version): inputSpec = layout.buildDirectory.file("resources/main/openapi.yaml").map { it.asFile.toURI().toString() } Note: this is using the processed resource (after filtering, etc.) from tasks.getByName("openApiValidate") { dependsOn(tasks.processResources) } |
Bug Report Checklist
Description
Problem with path declaring of file with specification. Have an error: Illegal character in opaque part at index 2: C:....\ApiFirstServer-main\build\openapiDir\petstore.yaml
openapi-generator version
6.5.0
OpenAPI declaration file content or url
the issue doest link to file formatting
Generation Details
the issue doest link to file formatting
Steps to reproduce
or
Related issues/PRs
Related issue: #14075
Suggest a fix
just format link before loading the file.
The text was updated successfully, but these errors were encountered: