quarkus-openapi-generator
quarkus-openapi-generator copied to clipboard
Client Generator: Custom config-key with minus (-) get translated to underscore (_) in the generated code.
If a custom config-key setting is used, the value of config-key gets its "-" replaced with "_".
Example:
quarkus.openapi-generator.codegen.spec.my_json-config-key=my-api
results in
@RegisterRestClient(baseUri="...", configKey="my_api")
Hi! Thanks for reporting it. Can you open a PR to fix it? It should be reasonably straightforward. The key might follow the same rules for name sanitization we use for the OpenAPI ID.
Sure, will have a look. Earliest next week though.
Hi @ricardozanini, @hbelmiro actually with config-key feature we can use by example:
quarkus.openapi-generator.codegen.spec.my_json.config-key=my-api
quarkus.openapi-generator.codegen.spec.my-api.base-package=com.quarkiverse
https://github.com/quarkiverse/quarkus-openapi-generator/blob/ec6919d74778a05b7ceb618d777705508e9dc376/client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiConfigValidator.java#L21
Looking the regex above, the only allowed specId is my_api not my-api. Thinking here, this group only allows alphanumeric + _ because the file is sanitized.
@ddelbondio I think you have two solutions:
- To add
-to regex - To receive the list of configured
config-keyvalues and to check it on that method.
Guys, any suggestions?
@mcruzdev I think it's reasonable to have the - added to the regexp in case of a custom config like this. 🤔
cc: @SergioRuyDev
Any progress?
I think no @mbard, do you mind to send a PR? This is simple, you can see my last comment about the solution.