swagger-2.0

JSON Schema - array of different objects

蓝咒 提交于 2021-02-19 07:44:20
问题 I'd like to know how to specify a JSON schema for an array of different objects. This thread gives me half the answer, but fails when I have multiple instances of each type of object. Here's a sample XML, based on the example given here but with the " Product " object being repeated:- { "things": [ { "entityType" : "Product", "name" : "Pepsi Cola", "brand" : "pepsi" }, { "entityType" : "Product", "name" : "Coca Cola", "brand" : "coke" }, { "entityType" : "Brand", "name" : "Pepsi Cola" } ] }

How can I denote decimal floating point in swagger specs?

ぃ、小莉子 提交于 2021-02-08 13:53:55
问题 I would like to denote decimal with 2 places and decimal with 1 place in my api documentation. I'm using swagger 2.0, Is there inbuilt defined type or any other 'round' parameter in the specs, or my only option is to use 'x-' extension? 回答1: OpenAPI (fka Swagger) Specification uses a subset of JSON Schema to describe the data types. If the parameter is passed as a number, you can try using multipleOf as suggested in this Q&A: type: number multipleOf: 0.1 # up to 1 decimal place, e.g. 4.2 #

Maven: package io.swagger.annotations does not exist

半世苍凉 提交于 2021-02-07 12:26:23
问题 I want to document my project with swagger. I add swagger annotations and io.springfox dependencies to my project but when I run mvn clean package I have a lot of errors: PS D:\parent-project> mvn clean package [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] parent-project [pom] [INFO] module-common-lib [jar] [INFO] module1 [jar] [INFO] module2 [jar] [INFO] [INFO] ------------< parent

Swagger: Additional properties not allowed: allOf

让人想犯罪 __ 提交于 2021-02-07 10:24:12
问题 I'm trying to figure out this swagger API inheritance stuff by using allOf . This is my swagger yaml file. swagger: '2.0' info: title: Test API version: '1' basePath: /api/v1 schemes: - https produces: - application/json paths: /users: get: summary: Collection of users tags: - users responses: 200: description: A list of Users schema: $ref: "#/definitions/Users" 500: $ref: "#/responses/BadRequest" definitions: User: required: - username properties: firstName: type: string lastName: type:

Swagger: Additional properties not allowed: allOf

匆匆过客 提交于 2021-02-07 10:23:20
问题 I'm trying to figure out this swagger API inheritance stuff by using allOf . This is my swagger yaml file. swagger: '2.0' info: title: Test API version: '1' basePath: /api/v1 schemes: - https produces: - application/json paths: /users: get: summary: Collection of users tags: - users responses: 200: description: A list of Users schema: $ref: "#/definitions/Users" 500: $ref: "#/responses/BadRequest" definitions: User: required: - username properties: firstName: type: string lastName: type:

Setting Customized Example for @ApiResponse

与世无争的帅哥 提交于 2021-02-04 08:31:45
问题 I am facing issue with example in response. @ApiResponse(code=200, message="fetch list of Service/Config Resources", response = testing.class, responseContainer = "List", examples=@Example( value = @ExampleProperty( mediaType = MediaType.APPLICATION_JSON_VALUE, value = "{testingId: 1234, testingName = Testing Name}" ) ) ) But getting response example as [ { "testingId": "string", "testingName": "string" } ] 来源: https://stackoverflow.com/questions/60484171/setting-customized-example-for

Setting Customized Example for @ApiResponse

坚强是说给别人听的谎言 提交于 2021-02-04 08:31:30
问题 I am facing issue with example in response. @ApiResponse(code=200, message="fetch list of Service/Config Resources", response = testing.class, responseContainer = "List", examples=@Example( value = @ExampleProperty( mediaType = MediaType.APPLICATION_JSON_VALUE, value = "{testingId: 1234, testingName = Testing Name}" ) ) ) But getting response example as [ { "testingId": "string", "testingName": "string" } ] 来源: https://stackoverflow.com/questions/60484171/setting-customized-example-for

How to Use Swagger with Rails dockerized project

江枫思渺然 提交于 2021-01-29 15:19:02
问题 hope you are fine Actually, I have to make documentation of my rails APIs & for this, I integrate gem rswag in my application and follow the documentation step by step but when I run RAILS_ENV=test rails g rswag:specs:install I stuck in an error Can't connect to local MySQL server through socket '/authenticate/tmp/sockets/puma.sock' but I don't know as my app is dockerized , if I have to user Swager docker image or, make a MySql service in dockercompose.yml to solve this issue ? 来源: https:/

I am getting 404 for https://localhost:8080/swagger-ui.html

天大地大妈咪最大 提交于 2021-01-28 20:22:52
问题 I am getting a valid response for http://localhost:8080/v2/api-docs/ but while I am trying to access, I am getting http://localhost:8080/swagger-ui.html. Here I have attached pom.xml <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</artifactId> </dependency> <dependency> <groupId>org.springframework.boot<

Weird “Could not resolve reference: undefined Not Found” messages in Swagger UI 3

こ雲淡風輕ζ 提交于 2021-01-28 11:54:53
问题 While migrating Alfresco's REST API Explorer from Swagger UI 2 to Swagger UI 3 (3.38.0), a single API definition raised two Could not resolve reference: undefined Not Found errors at : paths./search.post.parameters.0.schema.properties.pivots.items.properties.pivots.items.$ref and paths./search.post.responses.200.schema.properties.list.properties.context.properties.request.properties.pivots.items.properties.pivots.items.$ref All the API definitions were working fine in Swagger UI 2 All the API