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] [DefaultGenerator] Multi tags Webhooks generation overwrite generated API file #20346

Open
4 of 6 tasks
JPPortier opened this issue Dec 18, 2024 · 0 comments
Open
4 of 6 tasks

Comments

@JPPortier
Copy link
Contributor

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

When webhooks are defined with multiple tags, and a tag is shared with a "normal" API, the webhook [by tag] file generation is overwriting the just generated >API file with same tag.

So after API file was created with operations related to path described by OAS file, content is overwritten with the operation related to the webhooks definition because of Webhooks is also having the sametag value : it create same file name

openapi-generator version

master branch (commit #74044c3427)

OpenAPI declaration file content or url

gist: link

Generation Details
java -jar ./modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i foo-multiTagsAndWebhooks.yaml -g java -o output --additional-properties=library=apache-httpclient
Steps to reproduce

Execute the generation based onto above command line options

Related issues/PRs
Suggest a fix

Issue is coming from sequence (https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java#L1304-L1309):

        // apis
        List<OperationsMap> allOperations = new ArrayList<>();
        generateApis(files, allOperations, allModels);
        // webhooks
        List<WebhooksMap> allWebhooks = new ArrayList<>();
        generateWebhooks(files, allWebhooks, allModels);
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