Skip to content

@Size annotation not being generated for a string field if not mentioned in required section of the yaml spec #478

@aaryan11-hash

Description

@aaryan11-hash

Hi I have recently migrated my spring boot app for JDK 11 -> 21 and spring 2.x.x -> 3.5.4.

I noticed that in my openspi yaml spec, all the fields mentioned in my -required section for a POJO are getting the right validations annotations when generating the target class, but the ones not mentioned in the same, dont get any. I checked the formatting and the labels for the validation.

field (type string) validation config looks something like this :
demoName:
type: string
example: 'AAA'
minLength: 3
maxLength: 3
description: >-
demo description

when I do put this field in the required label, it does what it is supposed to do.
Any work around for this? as this is not a mandatory field for my use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions