swagger-2.0

How to confirgure swagger to handle custom Controller-level PathVariable annotations?

牧云@^-^@ 提交于 2019-12-24 08:26:42
问题 In my Spring (4.3.2) project I'm using Swagger (2.7.0) to automatically generate docs and swagger-ui for my project. This worked great so far. But now I determined that I need to be able to declare Path Variables at the Controller level (not method level). And I need to teach swagger to discover these path variables and add them to docs and swagger-ui. I've created custom annotation @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface HasCommonPathVariable { /** *

Swagger doesn't pick up customized API Info and always shows default values

半世苍凉 提交于 2019-12-24 07:48:57
问题 While I am trying to integrate Swagger into a very simple Spring Boot REST app, Swagger-UI.html won't display and pick up my customized API Info. How should I make changes to below code so Swagger UI page will display the customized API Information? I cannot debug the SwaggerConfig class as well, put breakpoints in but when run as Spring Boot app, breakpoints won't stop. What I have in pom.xml: <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2

Swagger 2 integration with Spring boot application

只谈情不闲聊 提交于 2019-12-24 07:30:03
问题 Getting error while integrating Swagger2 with spring boot application. I am stuck with this implementation. Any problem with the implementation or configuration? Below are the configurations I have done to integrate Swagger2. SwaggerConfig.java import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox

Swagger 2 integration with Spring boot application

淺唱寂寞╮ 提交于 2019-12-24 07:29:16
问题 Getting error while integrating Swagger2 with spring boot application. I am stuck with this implementation. Any problem with the implementation or configuration? Below are the configurations I have done to integrate Swagger2. SwaggerConfig.java import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox

Override Swagger sorting

浪子不回头ぞ 提交于 2019-12-24 01:27:31
问题 I want to organize my swagger api in reverse alphabetical order but it defaults to alphabetical. Is there a simple way to do this? Specifically using Swashbuckle.Core 5.2.1 回答1: You can create a sorter for the UI for both the operations ( operationsSorter ) and tags ( apisSorter ). 来源: https://stackoverflow.com/questions/33746676/override-swagger-sorting

How using ref into examples Swagger?

假如想象 提交于 2019-12-23 21:17:33
问题 JSON spec: "responses": { "200": { "description": "Успешный ответ сервиса", "schema": { "$ref": "#/definitions/BaseResponse" }, "examples": { "application/json": { "status": true, "response": { "$ref": "#/definitions/Product" }, "errors": null } } } } Result: But I need: { "status": true, "response": { "ProductNumber": "number", "Barcode": "number", "Length": 12, "Width": 34, "Height": 423, "Volume": 1232 } }, "errors": null } How I can using $refs into example array for custom format

Issue Using Custom Index.Html in Swagger / Swashbuckle for .NET Core

橙三吉。 提交于 2019-12-23 19:48:27
问题 I am having difficulty using a custom index.html and other assets with swashbuckle. Swashbuckle/Swagger do not seem to recognizing or using them at all. I do have app.UseDefaultFiles() and app.UseStaticFiles() set. I am trying to understand what I am doing incorrectly. I have attempted to set up my configuration somewhat similar to what is defined on the Microsoft article without success. (https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger?tabs=visual

How to ignore swagger resource property for specific http verb(GET,POST,PUT)

一世执手 提交于 2019-12-23 13:26:32
问题 We are implemented spring fox swagger 2 of version 2.6.1, i wanted to display a specific property of a resource for HTTP GET METHOD and not for POST METHOD, i haven't find any approach using swagger 2. Please help thanks. For example: Class Employee{ Integer id; String name; } Request URI: GET /api/employee/{id} i should see the swagger request document as { id:"", name:"" } Request URI: POST /api/employee i should see the swagger request sample as { name:"" } 回答1: I upgraded to version 2.8.0

Is It Possible to Dynamically Add SwaggerEndpoints For SwaggerUI?

心已入冬 提交于 2019-12-23 12:25:36
问题 We're building out a services oriented architecture in .NET Core. We've decided to use Ocelot as our API gateway. I have integrated Ocelot with Consul for service discovery. Now I'm trying to attempt to create a unified Swagger UI for all the downstream services. Prior to service discovery we had Swagger setup like this: // Enable middleware to serve generated Swagger as a JSON endpoint app.UseSwagger(c => { c.RouteTemplate = "{documentName}/swagger.json"; }); // Enable middleware to serve

Why if (arg0.length > 0 && arg0[0].equals(“exitcode”))?

好久不见. 提交于 2019-12-23 02:47:14
问题 I found this SpringBoot Application code which throws Exit Code 10 when executed with argument "exitcode". public class Swagger2SpringBoot implements CommandLineRunner { @Override public void run(String... arg0) throws Exception { if (arg0.length > 0 && arg0[0].equals("exitcode")) { throw new ExitException(); } } public static void main(String[] args) throws Exception { new SpringApplication(SpringBootEntityApp.class).run(args); } class ExitException extends RuntimeException implements