openapi

OpenAPI (aka Swagger) in Azure Functions V2

余生长醉 提交于 2020-05-14 16:38:06
问题 I'm creating a V2 Function App and want to use Swagger/Open API for docs, however it is not yet supported in the Azure Portal for V2 Functions. Any suggestions on how I can use Swagger with V2 Functions in VSTS to create the docs on each build? 回答1: TL;DR - use the NuGet package to render Open API document and Swagger UI through Azure Functions. —- Microsoft hasn’t officially started supporting Open API (or Swagger) yet. But there is a community-driven NuGet package currently available: https

Autorest Failed resolving swagger.json against file when swagger.json is served by localhost

冷暖自知 提交于 2020-05-07 08:16:24
问题 I am able to use Autorest_core 3 to generate the client when swagger.json is hosted on a website but not when it is hosted on localhost. However if I cut and paste the swagger.json from local host into a file then I can generate the client. In startup.ConfigureServices I have services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" }); c.CustomOperationIds( d => (d.ActionDescriptor as ControllerActionDescriptor)?.ActionName); And in Startup.Configure

Swagger: Representing enum property in hash error

为君一笑 提交于 2020-04-17 07:18:58
问题 I am currently working on a Swagger documentation for Ruby on Rails API. The API has lots of enumerators (enums) which are included in various models. The enums are stored as hashes and not arrays in the app/models/concerns directory so that they can be modified without issues later. State Enum (state.rb) module State extend ActiveSupport::Concern included do enum state: { state1: 'State 1', state2: 'State 2', state3: 'State 3', state4: 'State 4', state5: 'State 5' } end end However, when I

Swagger: Representing enum property in hash error

老子叫甜甜 提交于 2020-04-17 07:18:14
问题 I am currently working on a Swagger documentation for Ruby on Rails API. The API has lots of enumerators (enums) which are included in various models. The enums are stored as hashes and not arrays in the app/models/concerns directory so that they can be modified without issues later. State Enum (state.rb) module State extend ActiveSupport::Concern included do enum state: { state1: 'State 1', state2: 'State 2', state3: 'State 3', state4: 'State 4', state5: 'State 5' } end end However, when I

How does one indicate that a number is prohibited for use in swagger documentation?

谁都会走 提交于 2020-04-16 02:29:49
问题 I am trying to specify a property in my swagger documentation called myNumber , which can be any integer in [-1, 10] except 0. This is what I have so far: myNumber: type: integer description: You can use any number in [-1, 10] except 0. minimum: -1 maximum: 10 How can I be explicit that 0 is prohibited? I haven't found any specification for this in the openAPI docs. Is this even possible? 回答1: Option 1: enum If the list of possible values is small, you can list them all in an enum : myNumber:

How does one indicate that a number is prohibited for use in swagger documentation?

感情迁移 提交于 2020-04-16 02:28:30
问题 I am trying to specify a property in my swagger documentation called myNumber , which can be any integer in [-1, 10] except 0. This is what I have so far: myNumber: type: integer description: You can use any number in [-1, 10] except 0. minimum: -1 maximum: 10 How can I be explicit that 0 is prohibited? I haven't found any specification for this in the openAPI docs. Is this even possible? 回答1: Option 1: enum If the list of possible values is small, you can list them all in an enum : myNumber:

generating swagger.json with backwardly compatible enum using serializeAsV2

谁说胖子不能爱 提交于 2020-04-14 07:27:41
问题 This bounty has ended . Answers to this question are eligible for a +100 reputation bounty. Bounty grace period ends in 3 hours . Kirsten Greed wants to draw more attention to this question. Recently I upgraded my api from netcore2.1 to netcore3.1 I was hoping not to ask the api users to re-write their client. Thus I expect I need the swagger.json to be backwardly compatible. In the old swagger.json an enum would look like But now it looks like I am using Swashbuckle.AspNetCore 5.2.1 I have

Open API 3 - How to read Spring Boot Pagination Properties?

时间秒杀一切 提交于 2020-03-21 11:01:24
问题 I am using Spring Boot + Spring Rest Pagination + Open API 3. @Operation(summary = "Find Contacts by name", description = "Name search by %name% format", tags = { "contact" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Contact.class)))) }) @Parameter(in = ParameterIn.QUERY, description = "Zero-based page index (0..N)", name = "page" , content = @Content(schema =

How to set the Accept header globally in OpenAPI 3.0?

会有一股神秘感。 提交于 2020-03-16 05:40:06
问题 I have a new OpenAPI setup via SwaggerHub. Is there an option to force a certain Accept header globally? I have set up the Content-Type on the response: openapi: 3.0.0 paths: /test-path: get: responses: '200': description: OK content: application/vnd.company.v1.0.0+json: When inserting a different Accept header via cURL request, the following out is made: {"message":"Missing matching response for specified Accept header"} That makes sense, since we aren't providing any response for that. 回答1:

How to set the Accept header globally in OpenAPI 3.0?

谁说胖子不能爱 提交于 2020-03-16 05:39:11
问题 I have a new OpenAPI setup via SwaggerHub. Is there an option to force a certain Accept header globally? I have set up the Content-Type on the response: openapi: 3.0.0 paths: /test-path: get: responses: '200': description: OK content: application/vnd.company.v1.0.0+json: When inserting a different Accept header via cURL request, the following out is made: {"message":"Missing matching response for specified Accept header"} That makes sense, since we aren't providing any response for that. 回答1: