Skip to content

Document custom validation #3180

@afattahi54

Description

@afattahi54

The validations are correctly documented so

@Size(max = 50) ( ->  [ 0 .. 50 ] characters)

We have lots of custom jakarta.validations

@Documented
@Constraint(validatedBy = NationalIdValidator.class)
@Target({METHOD, FIELD, PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface NationalId {
  String message() default "{validation.constraints.nationalIdValidator.message}";

  Class<?>[] groups() default {};

  Class<? extends Payload>[] payload() default {};
}

Is there any way that we can document it too. I think we can use io.swagger.v3.oas.annotations.media.Schema but i do not want to depend validations to this class. Mean while I think there might be some jakarta.validaiton feature which is build in and spring doc use them for documentation.

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