swagger-editor

Following swagger specifications, how can I define json of nested objects to yaml?

北战南征 提交于 2019-12-19 19:44:57
问题 I am having a problem in defining the array of objects in swagger yaml. Swagger editor is giving an error everytime I try to define the type: array part of the yaml. I defined it, but it is not right as it is giving an error. Following is the json I am trying to define in swagger yaml. { "CountryCombo": { "options": { "option": [{ "id": "GB", "value": "GB Great Britain" }, { "id": "US", "value": "US United States" }, { "id": "AD", "value": "AD Andorra, Principality of" }] } } } I defined this

Following swagger specifications, how can I define json of nested objects to yaml?

对着背影说爱祢 提交于 2019-12-19 19:44:32
问题 I am having a problem in defining the array of objects in swagger yaml. Swagger editor is giving an error everytime I try to define the type: array part of the yaml. I defined it, but it is not right as it is giving an error. Following is the json I am trying to define in swagger yaml. { "CountryCombo": { "options": { "option": [{ "id": "GB", "value": "GB Great Britain" }, { "id": "US", "value": "US United States" }, { "id": "AD", "value": "AD Andorra, Principality of" }] } } } I defined this

Swagger: “equivalent path already exists” despite different parameters

☆樱花仙子☆ 提交于 2019-12-17 20:46:18
问题 I'm trying to turn the Atom Publishing Protocol (RFC5023) in to a Swagger / OpenAPI spec to exercise writing those specs. I ran into the following problem: in Atom there are different types of URIs, e.g. Collection and Member URIs. My idea was to document it like this: paths: /{CollectionURI}: get: summary: List Collection Members ... post: summary: Create a Resource ... parameters: - $ref: "#/parameters/CollectionURI" /{MemberURI}: get: summary: Retrieve a Resource ... parameters: - $ref: "#

“discriminator” in polymorphism, OpenAPI 2.0 (Swagger 2.0)

杀马特。学长 韩版系。学妹 提交于 2019-12-17 19:57:17
问题 Referencing OpenAPI 2.0, Schema Object, or Swagger 2.0, Schema Object, and the definition of discriminator field as: Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the required property list. When used, the value MUST be the name of this schema or any schema that inherits it. My confusions/ questions: It is ambiguous

Validating JSON against Swagger API schema

家住魔仙堡 提交于 2019-12-17 18:14:51
问题 I created an API spec from some JSON files and I am trying to test if the files validate against the API spec. There are some good tools to validate against JSON Schema, but I did not have chance to find a tool to validate against specs created in the Swagger (tool for creating API schema). The only solution I found is generating a client/server in the Swagger-Editor, it is quite cumbersome. Is there already an existing tool to validate JSON against Swagger Schema? 回答1: Arnaud in the comments

How to write OpenAPI 3 (Swagger) specification for property name in `map` object?

时光总嘲笑我的痴心妄想 提交于 2019-12-17 09:58:30
问题 The API I'm trying to describe has a structure where the root object can contain an arbitrary number of child objects (properties that are themselves objects). The "key", or property in the root object, is the unique identifier of the child object, and the value is the rest of the child object's data. { "child1": { ... bunch of stuff ... }, "child2": { ... bunch of stuff ... }, ... } This could similarly be modeled as an array, e.g.: [ { "id": "child1", ... bunch of stuff ... }, { "id":

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

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

How to define a reusable body parameter that is a primitive data type in OpenAPI 3.0?

放肆的年华 提交于 2019-12-11 13:34:54
问题 I'm creating an OpenAPI 3.0 specification/description of an API in which many of the request bodies include some of the same parameters, and those parameters are primitive data types like strings or integers. For example: imei: type: integer format: int64 description: 4G hardware device identifier I'd like to define those parameters just once in the "components" object and then use $ref to include them where needed instead of having the same parameter defined in a dozen different request