-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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] Issue with defining inputSpec of openapi generator gradle plugin on Windows #14075
Comments
I've also asked in Stackoverflow: https://stackoverflow.com/questions/74489893/issue-with-defining-inputspec-of-openapi-generator-gradle-plugin-on-windows . However, as it seems to be related to the current release, I decided to create a bug report |
I don't know, after switching between different versions, it works with 6.2.1 as well, at least when defining the
|
In another project which uses another gradle version (7.5.1) even the described workaround did not work. |
It works fine for me using:
The important part is probably that even when using git bash you should still specify the input path using "C:/...". Hope this helps! |
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 /
|
Simple workaround:
|
the workaround does unfortunatly not work in maven with 'inputSpecRootDirectory' Reading spec: .........../src/main/resources\models.yaml |
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) } |
Description
In a gradle project on a Windows machine, I'd like to generate Java code from an openapi spec. However, I can't figure out how to specify the inputSpec parameter. For simplicity I describe the
validate
task since the issue occurrs there as well.leads to
Caused by: java.lang.RuntimeException: Could not find src/main/resources/api/openapi.yaml on the classpath
Expecting that I could have mispelled the path, I tried to include a typo intentionally
But this leads to a different exception
If using
instead, it says
java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\dev\myProject/src/main/resources/api/openapi.yaml
Next trial with an absolute path:
Again, it fails with something different:
Notice that some path parts are duplicated there.
I tried running gradle (gradlew to be precise) in a git bash and from within Intellij with no difference.
Any idea how to solve this?
openapi-generator version
6.2.1
Older versions seem to work. I've tried 6.1.0 which does not have this issue. Instead I have another problem with spec validation
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
OpenAPI declaration file content or url
Steps to reproduce
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: