openapi

Why is the Authorization header missing in requests sent from Swagger UI?

天涯浪子 提交于 2020-07-31 04:50:49
问题 I want to add a documentation to my Node.js API, for this I have a YAML file where I put my definitions, the swagger doc is at localhost:5000/api-doc and working fine. Now I have to add Bearer authorization but Swagger with the following definition: swagger: "2.0" info: version: 1.0.0 title: My API documentation description: > My API documentation host: localhost:5000 basePath: "/v1" schemes: - http securityDefinitions: Bearer: type: apiKey description: "Value: Bearer " name: Authorization in

Why is the Authorization header missing in requests sent from Swagger UI?

橙三吉。 提交于 2020-07-31 04:50:41
问题 I want to add a documentation to my Node.js API, for this I have a YAML file where I put my definitions, the swagger doc is at localhost:5000/api-doc and working fine. Now I have to add Bearer authorization but Swagger with the following definition: swagger: "2.0" info: version: 1.0.0 title: My API documentation description: > My API documentation host: localhost:5000 basePath: "/v1" schemes: - http securityDefinitions: Bearer: type: apiKey description: "Value: Bearer " name: Authorization in

Enable Authorize button in springdoc-openapi-ui for Bearer Token Authentication (JWT)

ぃ、小莉子 提交于 2020-07-18 12:53:23
问题 How to enable "Authorize" button in springdoc-openapi-ui (OpenAPI 3.0 /swagger-ui.html ) for Bearer Token Authentication, for example JWT. What annotations have to be added to Spring @Controller and @Configuration classes? 回答1: Define a global security scheme for OpenAPI 3.0 using annotation @io.swagger.v3.oas.annotations.security.SecurityScheme in a @Configuration bean: @Configuration @OpenAPIDefinition(info = @Info(title = "My API", version = "v1")) @SecurityScheme( name = "bearerAuth",

Using Swashbuckle 5.x specify nullable = true on a Generic T Parameter reference property

有些话、适合烂在心里 提交于 2020-06-28 06:09:07
问题 I recently upgraded my API to a .net core 3.1 server using Swashbuckle 5 with the newtonsoft json nuget, which produces an openapi 3 schema. I then use NSwag to generate a C# API. Previously I had a .net core 2.2 server with swashbuckle 4, producing a swagger 2.0 api schema. I have a generic response class for all responses, containing some metadata about the response like status code and a message, plus a Payload property of Generic type T containing the meat of the response. When the

DRF YASG Customizing

主宰稳场 提交于 2020-06-25 04:50:05
问题 I'm trying to customize my api documentation buuild with yasg. First off, I would like to determine the naming of my own sections, and what endpoints should be included in this section. It seems that the naming of sections is based on the first prefix not belonging to the longest common prefix e.g.: if we have the urls api/v1/message and api/v1/test than the sections will be named message and test. Is there a way for me to determine A custom naming for this section? Furthermore, the

How to define JSON array with concrete item definition for every index in OpenAPI?

故事扮演 提交于 2020-06-22 04:13:50
问题 I need to define in OpenAPI a JSON response with an array. The array always contains 2 items and the first one is always a number and second one is always a string. [1, "a"] //valid ["a", 1] //invalid [1] //invalid [1, "a", 2] //invalid I've found out that JSON schema does support that by passing a list of items in items instead of single object (source), but OpenAPI explicitly forbids that and accepts only a single object (source). How can that be expressed in OpenAPI? 回答1: OpenAPI 3.1

How to define JSON array with concrete item definition for every index in OpenAPI?

六月ゝ 毕业季﹏ 提交于 2020-06-22 04:13:47
问题 I need to define in OpenAPI a JSON response with an array. The array always contains 2 items and the first one is always a number and second one is always a string. [1, "a"] //valid ["a", 1] //invalid [1] //invalid [1, "a", 2] //invalid I've found out that JSON schema does support that by passing a list of items in items instead of single object (source), but OpenAPI explicitly forbids that and accepts only a single object (source). How can that be expressed in OpenAPI? 回答1: OpenAPI 3.1

How to define JSON array with concrete item definition for every index in OpenAPI?

守給你的承諾、 提交于 2020-06-22 04:13:18
问题 I need to define in OpenAPI a JSON response with an array. The array always contains 2 items and the first one is always a number and second one is always a string. [1, "a"] //valid ["a", 1] //invalid [1] //invalid [1, "a", 2] //invalid I've found out that JSON schema does support that by passing a list of items in items instead of single object (source), but OpenAPI explicitly forbids that and accepts only a single object (source). How can that be expressed in OpenAPI? 回答1: OpenAPI 3.1