What is the correct way to declare a date in an OpenAPI / Swagger-file?

The OpenAPI Specification says that you must use: type: string format: date # or date-time The patterns supported are defined in RFC 3339, section 5.6 (effectively ISO 8601) and examples are provided in section 5.8. So for date values should look like “2018-03-20” and for date-time, “2018-03-20T09:12:28Z”. As such, when using date or date-time, the … 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/**”); } }

How to define a property that can be string or null in OpenAPI (Swagger)?

This depends on the OpenAPI version. OpenAPI 3.1 Your example is valid in OpenAPI 3.1, which is fully compatible with JSON Schema 2020-12. type: – ‘null’ # Note the quotes around ‘null’ – string # same as type: [‘null’, string] The above is equivalent to: oneOf: – type: ‘null’ # Note the quotes around ‘null’ … Read more

How can I represent ‘Authorization: Bearer ‘ in a Swagger Spec (swagger.json)

Maybe this can help: swagger: ‘2.0’ info: version: 1.0.0 title: Bearer auth example description: > An example for how to use Bearer Auth with OpenAPI / Swagger 2.0. host: basic-auth-server.herokuapp.com schemes: – http – https securityDefinitions: Bearer: type: apiKey name: Authorization in: header description: >- Enter the token with the `Bearer: ` prefix, e.g. “Bearer … Read more

How to import Swagger APIs into Postman?

I work on PHP and have used Swagger 2.0 to document the APIs. The Swagger Document is created on the fly (at least that is what I use in PHP). The document is generated in the JSON format. Sample document { “swagger”: “2.0”, “info”: { “title”: “Company Admin Panel”, “description”: “Converting the Magento code into … Read more

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