OpenAPITools / OpenAPITools/openapi-generator
[BUG] JAX-RS does not honor sourceFolder for invoker package
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
If the property sourceFolder is set the generated classes for the invoker package are not put into this folder, so the option is not honored.
openapi-generator version
7.6.0
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: Test
description: Test.
version: 1.0.0
servers:
- url: https://localhost:29090/api
paths:
/test:
post:
summary: Test.
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/TestDto'
responses:
'201':
description: OK.
components:
schemas:
TestDto:
type: object
properties:
testId:
type: string
description: Unique ID
format: uuid
mapStringToString:
type: object
additionalProperties:
type: string
description: A key/value map string to string.
mapStringToNumber:
type: object
additionalProperties:
type: number
description: A key/value map of string to number.
Generation Details
Use options invokerPackage and sourceFolder. Set sourceFolder to "..".
Steps to reproduce
Invoke the generator once with sourceFolder:
java -jar .\openapi-generator-cli.jar generate -i test.yaml -g jaxrs-spec -o ./gen_with_source --additional-properties=invokerPackage=org.openapitools.invoker,sourceFolder=..
Compare it to the result without sourceFolder:
java -jar .\openapi-generator-cli.jar generate -i test.yaml -g jaxrs-spec -o ./gen_without_source --additional-properties=invokerPackage=org.openapitools.invoker
When generating without source folder all files are placed in the output directory in src/gen/java/...
> tree .
└───gen_without_source
├───.openapi-generator
└───src
├───gen
│ └───java
│ └───org
│ └───openapitools
│ ├───api
│ ├───invoker
│ └───model
└───main
└───openapi
When generating with source folder most files are placed in the specified directory except the invoker package (this one is still inside, it seems to use a different current directory):
> tree .
├───gen_with_source
│ ├───.openapi-generator
│ ├───org
│ │ └───openapitools
│ │ └───invoker
│ └───src
│ └───main
│ └───openapi
└───org
└───openapitools
├───api
└───model
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
Start by reproducing the jaxrs-spec generation with the two commands and compare the output trees, focusing on sourceFolder and invokerPackage handling. Trace the jaxrs-spec generator's sourceFolder entry point and add or update a regression test; done means invoker package files are placed under the configured sourceFolder, matching the other generated packages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100