swagger-2.0

Swagger 2 @ApiIgnore properties toggle in config server

ε祈祈猫儿з 提交于 2020-01-25 03:59:25
问题 I am using swagger 2 (2.9.2) in Sprinngboot app. Dependency : <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.9.2</version> </dependency> <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.9.2</version> </dependency> Code : package com.khan

How to test error codes with swagger and dredd?

最后都变了- 提交于 2020-01-25 03:55:42
问题 Any Idea how the rest api error codes can be tested with Dredd in combination with swagger .yaml file? Is there a best practice how to test all the different errors for the paths? Example: Path /task/{id} can have 3 type of responses: 200 -> OK 404 -> Task not found 403 -> Forbidden(not your task) Is it possible to test all 3 "workflows" for this path with swagger / dredd? 回答1: It is possible with hooks. See the Choosing HTTP Transactions and Multiple Requests and Responses sections in Dredd

How to reuse swagger definitions and remove some of the parameters in it? [duplicate]

妖精的绣舞 提交于 2020-01-21 20:45:10
问题 This question already has answers here : Re-using model with different required properties (2 answers) Closed 6 months ago . This is my code: definitions: User: type: object properties: id: type: integer username: type: string first_name: type: string last_name: type: string password: type: string created_at: type: string format: date-time updated_at: type: string format: date-time required: - username - first_name - last_name - password /api/users: post: description: Add a new user

How to reuse swagger definitions and remove some of the parameters in it? [duplicate]

霸气de小男生 提交于 2020-01-21 20:42:06
问题 This question already has answers here : Re-using model with different required properties (2 answers) Closed 6 months ago . This is my code: definitions: User: type: object properties: id: type: integer username: type: string first_name: type: string last_name: type: string password: type: string created_at: type: string format: date-time updated_at: type: string format: date-time required: - username - first_name - last_name - password /api/users: post: description: Add a new user

How to refer to an external JSON file containing response examples in Swagger?

一个人想着一个人 提交于 2020-01-17 06:26:09
问题 In my Swagger spec file, I want to return example responses, for that I can add examples in response. But that makes my spec file quite big and error prone. Is there a way to refer to a file containing JSON of an example object? I tried something like below but it doesn't seem to work. get: tags: - businesses summary: Get Taxable Entities details description: '' operationId: getTaxableEntities produces: - application/json parameters: - name: business_id in: path required: true type: integer

Overloading description in Swagger file (YAML)

你离开我真会死。 提交于 2020-01-15 10:15:33
问题 I have an issue writing my swagger file. When I describe a parameter the description is overloaded by the description of the $ref of this same parameter (see the example bellow). a-body: description: The body type: object properties: my_param: description: Full description $ref: '#/definitions/reference' definitions: reference: type: object required: [req] description: an http reference properties: req: type: string The result: the description is overloaded Can somebody help me get through

Can we set global “consumes” and “produces” in Swagger?

牧云@^-^@ 提交于 2020-01-14 14:04:06
问题 In the each path I need to set consumes and produces . Can I set them globally? post: summary: "" description: "" consumes: - "application/json" - "application/xml" produces: - "application/xml" - "application/json" 回答1: Sure. You can specify consumes and produces on the root level of the spec, and they will be inherited by all operations. Global consumes and produces can be overridden on the operation level if needed. consumes: - application/json - application/xml produces: - application/xml

In Swagger, how to define an API that consumes a file along with a schema parameter?

偶尔善良 提交于 2020-01-14 09:38:54
问题 I am trying to use Swagger to define an API that accepts an actual file and a schema object that describes the contents of a file. Here is a snippet of the Swagger YAML. However it won't validate in the Swagger Editor. /document: post: summary: Api Summary description: Api Description consumes: - multipart/form-data parameters: - name: documentDetails in: formData description: Document Details required: true schema: $ref: '#/definitions/Document' - name: document in: formData description: The

How to update AutoRest in visual studio 2017

我怕爱的太早我们不能终老 提交于 2020-01-14 08:50:31
问题 Context I would like to use AutoRest generated client for a webapi service by using "Add"/"REST API Client..." in visual studio 2017. However, it gives the following error: [Info] AutoRest Core 0.16.0.0 ... [Fatal]Error generating client model: Collection format "multi" is not supported (in parameter 'xxx'). The older version of AutoRest (e.g. 0.16.0) does not support "multi" collection format. So I installed the latest version AutoRest 0.17.3. using Nuget. But when I use "Add"/"REST API

How to specify multiple 404 causes in OpenAPI (Swagger)?

回眸只為那壹抹淺笑 提交于 2020-01-11 08:57:09
问题 I'm defining a path for a nested resource (content belonging to a delivery). If the client gets a 404 it could either because the delivery ID was not found, or the delivery did not contain any content of the specified type. How do I model that using OpenAPI (YAML)? I've got this right now... paths: '/deliveries/{id}/content/articles': get: summary: Retrieves articles from a delivery description: Retrieves all articles from a single delivery [...] responses: '200': description: articles found