swagger-api / swagger-api/swagger-ui

display constraints from x-field-extra-annotation parameter of Swagger/OpenAPI definition

Open
#10,246 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Content & configuration

Swagger/OpenAPI definition:

components:
 schemas:
   SomeDto:
     required:
       - someProperty
     type: object
     properties:
       someProperty:
         type: string
         x-field-extra-annotation:
               - "@jakarta.validation.constraints.NotEmpty"
              - "@org.hibernate.validator.constraints.UUID(allowNil = false)"

Swagger-UI configuration options:

SwaggerUI({
  // your config options here
})
?yourQueryStringConfig
Is your feature request related to a problem?

I use openapi-generator-maven-plugin to build DTO and Controller classes. I have to put some constraint annotations into x-field-extra-annotation of a parameter. But When I run the application I do not see these constraint annotations in swagger-ui.

Describe the solution you'd like

I want that swagger-ui displays values of x-field-extra-annotation for assosiated parameters of dto.

Describe alternatives you've considered

I tried to "override" indeh.html, and write there custom js plug whicj could display at least names on annotations from x-field-extra-annotation. But I figured out that swagger-ui does not receive any information from Swagger/OpenAPI definition .yaml file which is not shown in swagger-ui. I mean the dto's property does not contain x-field-extra-annotation parateters at all.

Additional context

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 with the Swagger/OpenAPI schema in the issue and the SwaggerUI configuration path, then trace how vendor extensions are retained and rendered for DTO properties and parameters. Done means values from x-field-extra-annotation are visible for the associated parameters in Swagger UI.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation, frontend
Issue type
Feature
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.