Feature: add flag to generate Authentication parameter into api interfaces #218
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
java
question
wontfix
renovate
renovate-manager
cargo
renovate-manager
dockerfile
renovate-manager
git-submodules
renovate-manager
gomod
renovate-manager
kustomize
renovate-manager
kustomize
renovate-manager
maven
renovate-manager
maven
renovate-manager
npm
renovate-manager
pip_requirements
renovate-manager
regex
renovate-manager
renovate-config-presets
renovate-manager
woodpecker
renovate-type
bump
renovate-type
digest
renovate-type
lockFileMaintenance
renovate-type
major
renovate-type
minor
renovate-type
patch
renovate-type
pin
renovate-type
pinDigest
renovate-type
replacement
renovate-type
rollback
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Reference
kokuwaio/micronaut-openapi-codegen#218
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
If I want to use micronaut-security's Authentication parameter, which is supported inside controller-level methods, it isn't clear how to do so with this generator.
For example, given I want to check the value of this using something like:
None of the settings in the generator allow for adding the Authentication auth parameter (io.micronaut.security.authentication.Authentication) upon generation.
I've checked the documentation provided but this isn't clear at all.
Right now there is no flag for this.
To access the authentication you can use:
Or use:
If this is not sufficient for you, how should the generator handle this authentication objects? My suggestion: add a flag and if flag is enabled and response code 401 exists add
Authenticationfor controller interfaces. What do you think?That's the workaround I'm using at the moment, it does work - it's just a bit verbose to have to add it into every controller, which adds up if there are multiple. I think the flag is a good shout!
On another note - not sure if it's worth opening up a new issue - but how can I make sure from the API spec that a "number" input on an API Spec comes out as BigDecimal in the generated model? I can see here we're explicitly mapping it to Double, but I don't see the reason for that
github.com/kokuwaio/micronaut-openapi-codegen@08793b1ded/src/main/java/org/openapitools/codegen/languages/MicronautCodegen.java (L131)I found this: https://stackoverflow.com/questions/55654672/how-to-treat-a-double-field-as-bigdecimal-while-generating-java-code-from-a
But this doesn't work, as we seem to be clearing user-defined typeMappings at the top of that block of code for some reason, so even if we map Double to BigDecimal, the library clears it
I'll add this flag, but not immediately because if other stuff todo before.
Regarding
BigDecimalvsDouble, you can override the default mapping using:The default with
Doublewas chosen because for most users double precision is enough andBigDecimalhandling is sometimes a pain. I won't change this now because a lot of users rely onDouble.Please review the pr. Does this fit your requirements?
Released with 3.3.0