swagger-2.0

Swashbuckle Swagger - How to annotate content types?

风格不统一 提交于 2019-12-17 19:27:15
问题 How do I annotate my ASP.NET WebAPI actions so that the swagger metadata includes the content-types that my resources support? Specifically, I want the documentation to show that one of my resources can return the 'original' application/json and application/xml but also now returns a new format, application/vnd.blah+json or +xml . 回答1: What you need to do is this; Swagger spec: you need to add your response-type to the list of response-types for that operation "produces": [ "application/json"

Swagger/Swashbuckle list acceptable values?

喜欢而已 提交于 2019-12-14 04:18:43
问题 I have implemented Swashbuckle/Swagger on my Web API application successfully, but am not happy with the output. One of my web api methods (An enterprise event logging tool) accepts a JSON object of a Complex object value. The issue is that the parameters are listed as string objects when there is a selected list of acceptable values that can be used. I have set default values so that if something incorrect is sent, I set to default. I guess I could add other service calls that return the

How to link to another endpoint in Swagger

孤街醉人 提交于 2019-12-14 03:46:49
问题 I'm writing a Swagger specification for an future public API that requires a very detailed and clean documentation. Is there a way to reference/link/point to another endpoint at some other location in the swagger.yml file? For example, here is what I am trying to achieve: paths: /my/endpoint: post: tags: - Some tag summary: Do things description: > This endpoint does things. See /my/otherEndpoint for stuff # Here I would like to have some kind of hyperlink operationId: doThings consumes: -

Can a swagger object passed as a parameter have default values in swagger-ui?

不打扰是莪最后的温柔 提交于 2019-12-14 01:02:40
问题 I define a path that takes MyObject as a parameter. MyObject has properties for cats and dogs. These have default values. In swagger-editor, the example doesn't show the default values, but try-it-out does create a MyObject with correct defaults. In swagger-ui, I can see the defaults under Models, but not in the API. Is there a way to set these defaults ? swagger: '2.0' info: title: pass object with default properties as a parameter description: etc version: "Draft 0.1.1" host: example.com

Add new column in responses(Swagger-ui)

大城市里の小女人 提交于 2019-12-13 15:51:52
问题 I am using Swagger-ui for the api documentation, when i come to responses i want to add a new column of any name in every response, screen shot is attached, highlighted text is ok, i want to add a new column at place of the circle. My response JSON is "responses" : { "400" : { "description" : "Invalid ID Supplied" }, "404" : { "description" : "Order not found" } } how to add new column in it? Is there any way type of Intellisense provided for Swagger-ui JSON? 回答1: You can extend the API

Generate sample request and responses from Swagger Definition

梦想与她 提交于 2019-12-13 13:13:15
问题 I want to generate a sample request and response from a swagger definition file(yaml/json). The intent is to stub out these APIs. Unfortunately I do not have admin rights to install any of the server frameworks listed in the generate server list of the swagger editor. I've also tried mocking it with soapui(5.x) and ready api , but both of them are not able to resolve the schema references within the response objects of the definition file - Eg: "responses": { "200": { "description": "pet

Swagger Editor shows the “Schema error: should NOT have additional properties” error for a path parameter

断了今生、忘了曾经 提交于 2019-12-13 03:42:06
问题 I am creating an OpenAPI (Swagger) definition and checking its validity in http://editor.swagger.io. For some reason, Swagger Editor shows this error: Schema error at paths['/some-endpoint/{id}/name-and-address'].get.parameters[0] should NOT have additional properties additionalProperty: type, allowEmptyValue, enum, name, in, description, required Jump to line 142 Below is my YAML file: paths: '/some-endpoint/{id}/name-and-address': get: tags: - InvolvedParty summary: Retrieve basic

Spring boot swagger2 404

喜夏-厌秋 提交于 2019-12-13 02:47:19
问题 I am converting an older java 6 SOAP project to java 8 with spring boot and swagger. I used to be able to use swagger before autowiring a service but now I get a white page in browser with errors rapidly appearing in the console of chrome. pom.xml <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.8.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.8.0</version> <

Swagger header definitions

邮差的信 提交于 2019-12-12 12:16:43
问题 I can't seem to find if it is possible to declare a header object in order to reuse it in response headers, there are examples defining objects for response schemas, but it doesn't transpose to response headers. I have only managed to make a reusable response object like this: responses: DownloadOk: description: Dowload Ok headers: Content-Length: description: response length type: integer Document-Length: description: document length type: integer But as I said, I'd like to keep the header

API methods Sorting : Swagger version 3.0.2

徘徊边缘 提交于 2019-12-12 10:59:12
问题 I am using swagger version 3.0.2 , I have also followed this answer but there was no effect on the method order. window.onload = function() { const ui = SwaggerUIBundle({ ..... apisSorter: "alpha", layout: "StandaloneLayout" }) Can any one tell the best way to change the order of the API methods. 回答1: Swagger UI 3.0.7 added support for 2.x's operationsSorter parameter that controls method sorting inside each API/tag. operationsSorter Apply a sort to the operation list of each API. It can be