Skip to content
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] JAX-RS does not honor sourceFolder for invoker package #18850

Open
5 of 6 tasks
rehand opened this issue Jun 4, 2024 · 0 comments
Open
5 of 6 tasks

[BUG] JAX-RS does not honor sourceFolder for invoker package #18850

rehand opened this issue Jun 4, 2024 · 0 comments

Comments

@rehand
Copy link
Contributor

rehand commented Jun 4, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant