OpenAPITools / OpenAPITools/openapi-generator
[BUG] Issue with defining inputSpec of openapi generator gradle plugin on Windows
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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.
plugins {
...
id "org.openapi.generator" version "6.2.1"
...
}
openApiValidate {
inputSpec = "src/main/resources/api/openapi.yaml"
}
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
inputSpec = "src/main/resources/api/openapi.WRONG"
But this leads to a different exception
A problem was found with the configuration of task ':publisher-service:openApiValidate' (type 'ValidateTask').
> File 'C:\dev\myProject\src\main\resources\api\openapi.WRONG' specified for property 'inputSpec' does not exist.
If using
inputSpec = "$projectDir/src/main/resources/api/openapi.yaml"
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:
inputSpec = "/c/dev/myProject/src/main/resources/api/openapi.yaml"
Again, it fails with something different:
> File 'C:\dev\myProject\c\dev\myProject\src\main\resources\api\openapi.yaml' specified for property 'inputSpec' does not exist.
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The reported entry point is the Gradle plugin's openApiValidate task and its inputSpec property; begin by reproducing the relative and absolute Windows path cases with the provided OpenAPI example. Done means valid Windows paths resolve to the intended spec and invalid paths fail without duplicated or URI-mangled paths, with regression coverage for these cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100