I want to implement GET api that returns ZIP file. I defined api using openapi As far as I understand my api should return byte[], so my controller looks like below Is it ok to return byte[] or it should be some stream, end user will get the zip? Implementation. I have map of objects that I am parsing using
Tag: openapi
Swagger/Openapi – How to document imported modules in a Spring boot project?
I have an authentication module which is imported inside our projects to provide authentication related APIs. AppConfig.java I’ve configured Swagger/OpenAPI in my projects and I wish to find a way to manage these imported endpoints: Specifically, I wish to set an order on the Example object’s fields. Right now it is sorted alphabetically by default. The reason for doing that
Is there any way to use something like List.class?
I’m using SpringBoot with OpenAPI and SwaggerUI to implement a rest api. I want to annotate a @GetMapping method with @ApiResponses to provide the schema of the response, but I’m struggling with the parameter implementation of @Schema. The return type of my method is List<ScanDTO>, so I tried the following: But this doesn’t work. Things like ScanDTO.class would work. The
OpenAPI generator Java Client SE
I’ve an OperAPI like this, with content “application/x-www-form-urlencoded” that i must use (the external API to implement support only that): The OpenAPI Generator Maven’s plugin creates a request class “GenerateTokenRequest” for the schema object but in API implementation class it doesn’t use. It generate a method with all requested fields as a list of parameter. The method is this: So,
OpenAPI generated classes and applying JsonView for the generated classes
I’m using OpenAPI to define my api and resources and the classes are auto-generated. I’ve been looking for a way to have a single model and multiple representations so am looking at JsonViews or Filters. Is there any way to add JsonViews to the properties of the generated model classes ? I haven’t been able to figure it out. Answer
Quarkus OpenApi adding x-tokenName extension to SecurityScheme in application.properties
I want to add the x-tokenName extension to the openApi security scheme component in quarkus using the application.properties file. I’am using microsoft as provider for openIdConnect, and therefore i got a response containing an access_token and a id_token. My configuration so far, look somehow like this: The corresponding openapi.yaml looks for the security scheme part like this: I did not
openapi-generator-maven-plugin upgrade openapi spec to 3.1.0
I am using plugin openapi-generator-maven-plugin in version 5.3.1. Upgrading openapi spec from 3.0.3 to 3.1.0 causes generation phase errors: Spec sample: plugin error: Previous version of openapi works fine.. I couldn’t find information if plugin supports that version of spec, but error message is very vauge. How to use openapi-generator-maven-plugin with spec 3.1.0? Answer As of July 2022, OpenAPI Generator
Unable to generate interface with openapi-generator-gradle-plugin
I’m trying to generate models and controller interfaces with openapi-generator-gradle-plugin. The problem I’m having is that the plugin in generating classes instead of interfaces. A generated class looks like this: While I’m trying to generate an interface, so that I can implement it in my rest controller. When looking at the configuration, I assumed that the interfaceOnly parameter will make
Replace @PathVariable object with ID only for Springdoc
I am currently trying to migrate from Springfox to Springdoc. Most of my endpoints contain a @PathVariable Instance. Obviously I am only passing in the ID of the instance and Spring would automatically resolve the object for me. Here is an example: Called as /api/myInstance/role. Springfox would handle this correctly for me, only generating {instance} as a String mapping to
OpenAPI @RequestBody variables of type Map are not populated
I’ve a simple POST API where the @RequestBody contains a variable of type HashMap. The problem is that the variable “myMap” is never populated. Swagger UI shows the entry field correctly, with corresponding default values. I also added the a static block in the Configuration file, otherwise Swagger UI doesn’t show the entry field of type Map. What is needed