swagger-2.0

Swagger UI not sending array correctly

蓝咒 提交于 2019-12-29 09:21:57
问题 I am trying to send multiple values (an array) (refer to on line 93 in spec ->... name: recipients[] ...) The problem I am facing is the Swagger-ui call the endpoints as below: Actual recipients[]=value1%2Cvalue2 Expected recipients[]=value1&recipients[]=value2 The %2C means , (comma). Below are the required details swagger-ui version 2.1.1 Below is the link for content of the swagger spec file reproducing the issue: http://pastebin.com/V3ZuCjVz 回答1: It looks like the way to specify this is

How to describe this POST JSON request body in OpenAPI (Swagger)?

心已入冬 提交于 2019-12-29 03:32:53
问题 I have a POST request that uses the following JSON request body. How can I describe this request body using OpenAPI (Swagger)? { "testapi": { "testapiContext": { "messageId": "kkkk8", "messageDateTime": "2014-08-17T14:07:30+0530" }, "testapiBody": { "cameraServiceRq": { "osType": "android", "deviceType": "samsung555" } } } } So far I tried the following, but I'm stuck at defining the body schema . swagger: "2.0" info: version: 1.0.0 title: get camera license: name: MIT host: localhost

How to get nested array in swagger definition [duplicate]

久未见 提交于 2019-12-29 02:10:55
问题 This question already has an answer here : How do I wrap JSON objects? (1 answer) Closed 9 days ago . Trying to get this Json outpun with swagger definitions: { "attachments":[{ "attachment": { "filename": "string", "filedata": "string", "filetype": "string" } }, { "attachment": { "filename": "string", "filedata": "string", "filetype": "string" } }] } My swagger.json looks like this: "attachments": { "type":"array", "items": { "$ref": "#/definitions/attachment" } }, "attachment": { "type":

Swagger: wildcard path parameters

本小妞迷上赌 提交于 2019-12-28 14:41:49
问题 I have an API which allows any arbitrary path to be passed in, for example all of these: /api/tags /api/tags/foo /api/tags/foo/bar/baz Are valid paths. I tried to describe it as follows: /tags{tag_path}: get: parameters: - name: tag_path in: path required: true type: string default: "/" However, https://generator.swagger.io encodes slashes in the path, so it doesn't work. So is there a way to describe my API in Swagger? 回答1: So this is not going to be supported soon (it's not even planned for

Controller does not appear in swagger-ui.html

天涯浪子 提交于 2019-12-25 08:27:34
问题 I use Swagger 2 with non-spring-boot and I also can deploy my app on Tomcat and run it successfully. But the controller does not appear in swagger-ui.html , just the empty page with the green swagger title show up. I have spent two days on this issue. Would you give me some advice? @Controller means the class as bellow: @Api @Controller @RequestMapping("/user") public class UserController { protected Logger logger = LoggerFactory.getLogger(UserController.class); @Autowired private UserService

how to replace Model schema Body parameter with actual example

十年热恋 提交于 2019-12-24 14:01:46
问题 I have spring-boot/spring-mvc and springfox swagger2 integration. I have attached sample screen shot. In parameter type of 'body' I have a Model schema which describe elements data types. string, 0 etc! How can I replace it with actual example so that I can 'Try it out' . That would be more useful for my API consumer. 回答1: Not sure if you found the answer to this one, but I am going to answer this anyways. The @ApiModelProperty has a property called example . You can make use of that.

Change model schema for java.sql.Time in swagger-ui

筅森魡賤 提交于 2019-12-24 12:58:31
问题 In my spring-boot application, I use swagger2 to document the web-services. I use some classes that have java.sql.Time and java.util.Date attributes. In swagger-ui, they appears like this : Date : Time : I want to modify this to display : "change_date": "YYYY-MM-DD" "change_time": "mm:ss" Here is my class : @lombok.Data @JsonRootName("translation_value") @ApiModel(value="TranslationValue", description="Traduction de valeur") public class TranslationValue implements Serializable {

OData query in swagger ui

ⅰ亾dé卋堺 提交于 2019-12-24 11:27:26
问题 I was checking out the following tutorial: http://blogs.msdn.com/b/martinkearn/archive/2015/03/10/using-odata-query-syntax-with-web-api.aspx And I was curious if there was support in swagger ui somehow to show the query parameters. Essentially I wanted all calls tagged with [EnableQueryAttribute] attribute to have swagger ui for inputting query parameters and I don't want to add these parameters to the method call I still want them to be in the URL and pulled out for the Owin context. Any

Returning an array of objects that properly defines the SDK response

℡╲_俬逩灬. 提交于 2019-12-24 10:58:06
问题 I have a typical RESTful endpoint that returns a collection of models, but the generated Ruby SDK returns a new model, Matters instead of an array of models. I can hack at the generated source code to return Array<Matter> but that is a maintenance headache. How do I specify that I want to return Array<Matter> in the YAML? paths: /matters: get: ... responses: 200: schema: $ref: "#/definitions/Matters" ... definitions: Matter: type: "object" properties: id: type: "string" description: "Database

How to send a JSON object as part of a multipart request in Swagger Editor?

谁说胖子不能爱 提交于 2019-12-24 09:07:35
问题 I'm writing API documentation using Swagger Editor, but having a problem with a multipart POST request containing a JSON object. Here is my Swagger YAML file: swagger: '2.0' info: version: 1.0.0 title: Documentation API paths: /agent: post: consumes: - multipart/form-data produces: - text/html parameters: - in: query name: method description: name of method to access required: true type: string - in: body name: param description: parameter to send required: true schema: $ref: "#/definitions