Skip to content

Support for "minLength" and "maxLength" RequestParameter validation in SpringController #607

@pstorch

Description

@pstorch

What would you like fabrikt to generate?

Currently minLength and maxLength constraints are not supported with Jakarta Validations in Spring Controller Interfaces.

It should generate @Size annotations like this:

...
    fun getCountry(
        @Size(min=2,max=2) @Valid @RequestParam(value = "countryCode", required = false) countryCode: kotlin.String?
    ): ResponseEntity<...>

Example Spec

/country:
    get:
      summary: Get Country Information
      operationId: getCountry
      parameters:
        - name: countryCode
          in: query
          description: code of the country
          schema:
            $ref: '#/components/schemas/CountryCode'
...

components:
  schemas:
    CountryCode:
      description: a two character country code
      type: string
      maxLength: 2
      minLength: 2
...

Desired Output

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions