Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

460
Views
Anotación Swagger para enumeración como componente

tengo una enumeración:

 public enum UserType { ADMIN("Admin"), GUEST("Guest"), SUPERVIOR("Supervisor"), NORMAL("Normal"); private final String type; UserType(final String type) { this.type = type; }

Y lo estoy usando como parámetro de consulta con anotación Swagger:

 @GET @AsyncTimed @Path("/all") void all( @ApiParam @PathParam(USER_ID) @Parameter(in = ParameterIn.PATH, name = USER_ID, required = true) final UserId userId, @QueryParam(TYPES) final Set<UserType> userTypes, @Suspended final AsyncResponse asyncResponse );

Sin embargo, el archivo OpenAPI generado no crea un componente a partir de la enumeración y, en cambio, proporciona:

 get: parameters: - name: UserId in: path required: true schema: $ref: '#/components/schemas/UserId' - name: Types in: query schema: uniqueItems: true type: array items: type: string enum: - ADMIN - GUEST - SUPERVISOR - NORMAL

¿Hay alguna manera de hacer que la enumeración sea un esquema de componente? Si uso esta enumeración en otros componentes, esos componentes también usan enum: en lugar de $ref .

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Debe anotar la enumeración y/o el parámetro correspondiente con @Schema(..., enumAsRef=true) .

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!