Swagger with Springboot add personalized information whith java anotations

dante :

How do I personalize the information displayed on the page in swagger-UI whith java anotations?

in swagger petstore

dante :

if you want to customize the api information you can include java style annotations:



    @OpenAPIDefinition(
        info = @Info(
                 title = "API personas", 
                 description = "Este es un ejemplo de servidor Personas-Server."
            + "Usted puyede encontrar mas acerca de Swagger " ++"[http://swagger.io](http://swagger.io) o en "
            + "[irc.freenode.net, #swagger](http://swagger.io/irc/).",
            termsOfService = "http://swagger.io/terms/", 
              license = @License(
                          name = "Apache 2.0", 
                          url = "http://springdoc.org"), 
       version = "otra"
    ))
    @Tag(name = "persona", description = "API para personas")
    @RestController
    @RequestMapping("persona")
    public class PersonaRest extends GeneralRest {}

can also be generated for special methods:



     @Operation(
         summary = "traer todas las personas", 
         description = "api para traer todas las personas, aqui no se tienen en cuenta paginaciones, ni filtros, trae todos los registros", 
         tags = { "persona" }
         )
     @ApiResponses(
         value = {
         @ApiResponse(
             responseCode = "200", 
             description = "Operación exitosa", 
             content = @Content(
                 mediaType = "application/json", 
                 array = @ArraySchema(
                     schema = @Schema(
                         implementation = PersonaTO.class
                         )))),
         @ApiResponse(
             responseCode = "401", 
             description = "Sin autorización", 
             content = @Content(
                 mediaType = "application/json", 
                 schema = @Schema(
                     implementation = Object.class
                     ))),
     })
     @GetMapping
     public List personas() {
            return personaServicio.obtenerTodo();
        }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Swagger UI with swagger.yaml in SpringBoot

Add personalized methods and attributes to CategoricalDtype

Trouble with POST request whith angular and SpringBoot

How to check user password in ldap whith java with given LdapContext?

Add user-specified information to java stack traces

How to add JSR-045 SMAP information to Java stacktraces at runtime?

How to add debug information when compiling with Java's Compiler API

How can I run my own personalized bash shell in Java?

Swagger: Add description with ref

Array of anotations in kotlin

How to add <a href> link to make an element clickable in java for Swagger

Swagger Editor, how to add additional "hidden" information?

Springboot swagger with JsonView

Show Swagger validation information

How to add a database to a java application whith different intances in different computers

When running docker-compose up whith elasticsearch image throwing Java error

How to add dictionary value to 'v-model' whith given key?

Swagger OpenAPI 3 not display on springboot 2 if add Converter with a WebMvcConfigurationSupport

Is it possible to retrieve information about higher-level dependencies whith SpaCy (Python)?

How to add information to MySQL database using java code

How to combine two RDD whith different keys in java Spark?

Is it possible to add personalized column to CPLEX Optimizer Node Log?

SpringFox Swagger integration with Springboot app

Setting up Java Web Start for Firefox when the JDK is in a personalized location

Swashbuckle / swagger Document missing information

How to add a information section in swagger php

tkinter mysql - how to get different information while using entries whith the 'fetch' method?

How to add information from if-else statements to an array Java

Android/Java: How to create personalized schemes without https in it?