swagger-api / swagger-api/swagger-codegen-generators

[Micronaut] Parameter bean validation issues

Open
#728 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

On using the micronaut code generator, there were few issues with regards to how the bean validations were applied on the api interfaces generated

  1. if a query parameter is declared as required, in the swagger file the generated API has 2 declarations of @NotNull
  2. if a parameter(query or header) is declared as required: false, Micronaut requires an explicit @Nullable keyword
  3. header parameters do not have bean validation implemented currently (e.x Pattern , Size, minLength etc)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Micronaut code generator entry point and locate the templates that produce API interfaces and parameter annotations. Compare generated query and header parameters with the Swagger requirements, then verify that required parameters have one validation annotation, optional parameters are explicitly nullable, and header constraints are emitted.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.