How to export swagger.json (or yaml)

The URL of the API definiton is displayed in the top bar of Swagger UI – in your example it’s /v2/api-docs?group=full-petstore-api So the full URL appears to be http://localhost:8080/v2/api-docs?group=full-petstore-api In newer versions of Swagger UI, the link to the API definition is often displayed below the API title, so you can right-click the link and … Read more

How to send custom headers with requests in Swagger UI?

You can add a header parameter to your request, and Swagger-UI will show it as an editable text box: swagger: “2.0” info: version: 1.0.0 title: TaxBlaster host: taxblaster.com basePath: /api schemes: – http paths: /taxFilings/{id}: get: parameters: – name: id in: path description: ID of the requested TaxFiling required: true type: string – name: auth … Read more

How to configure Spring Security to allow Swagger URL to be accessed without authentication

Adding this to your WebSecurityConfiguration class should do the trick. @Configuration public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers(“/v2/api-docs”, “/configuration/ui”, “/swagger-resources/**”, “/configuration/security”, “/swagger-ui.html”, “/webjars/**”); } }

Setting up Swagger (ASP.NET Core) using the Authorization headers (Bearer)

ApiKeyScheme was deprecated, in version 5 you can use like this: services.AddSwaggerGen(c => { c.SwaggerDoc(“v1”, new Info { Title = “You api title”, Version = “v1” }); c.AddSecurityDefinition(“Bearer”, new OpenApiSecurityScheme { Description = @”JWT Authorization header using the Bearer scheme. \r\n\r\n Enter ‘Bearer’ [space] and then your token in the text input below. \r\n\r\nExample: ‘Bearer … Read more

Swagger UI Web Api documentation Present enums as strings?

Enable globally From the docs: httpConfiguration .EnableSwagger(c => { c.SingleApiVersion(“v1”, “A title for your API”); c.DescribeAllEnumsAsStrings(); // this will do the trick }); Enum/string conversion on particular property Also, if you want this behavior only on a particular type and property, use the StringEnumConverter: public class Letter { [Required] public string Content {get; set;} [Required] … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)