Not resolving Micronaut config values in Controller annotation
Hi,
I have some config in my @Controller annotation, like this:
@Controller("/v${applications.api.version}/applications")
And my OpenAPI is being generated like this:
/v${applications.api.version}/applications:
get:
I believe that correct would be:
/v1/applications:
get:
Because I've stetted ${applications.api.version} to 1:
Micronaut works fine, I'm able to resolve the controller /v1/applications.
Thanks a lot and great project!
These placeholders are runtime configuration flags. They cannot be resolved at compilation time.
OpenAPI spec does have something called server variables, wonder if it is possible to translate this syntax to those.
Or you can use a server context path with an HttpFiler: https://micronaut-projects.github.io/micronaut-openapi/latest/guide/index.html#openApiViews
Another alternative could be to allow applications.api.version to be specified in openapi.properties. Would mean duplicating one property but I don't think that is a huge deal.
I have tested a dirty hack, where the spec file is parsed, placeholders resolved and then served: https://gist.github.com/croudet/d41cfd69021257948c550cac08f13528
Any updates? 2 years passed..
Any updates? 2 years passed..
I just hard coded it. Not fancy, but it's not a big deal for my project.
This is understandable, but if there are many projects, it is inconvenient. Why don't developers improve and fix this module?
PRs are welcome as always