Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-2004

[RFE]smallrye-openapi does not process javax.validation constraint @pattern and add it to the schemas it generated in openapi yaml file

XMLWordPrintable

      For the code with following validation constraint

      ~~~
      import javax.validation.constraints.NotNull;
      import javax.validation.constraints.Pattern;
      import javax.validation.constraints.Size;

      public class Fruit {

          @NotNull
          @Size(min = 1, max = 4)
          @Pattern(regexp = "^[A-Za-z]+$")
          public String name;

      ~~~

      From SwaggerUI-> OpenAPI, the document does not include the Pattern validation
      components:
        schemas:
          Fruit:
            required:
            - name
            type: object
            properties:
              name:
                maxLength: 4
                minLength: 1
                type: string
                nullable: false
              description:
                type: string

            medgar@redhat.com Michael Edgar
            rhn-support-asaji Anu Saji
            Fedor Dudinskii Fedor Dudinskii
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: