Questions tagged [swagger-editor]

Swagger Editor allows users to create API specifications using YAML inside the browser and to preview documentation in real time.

Swagger Editor allows to edit API specifications in YAML inside the browser and to preview documentations in real time.

https://github.com/swagger-api/swagger-editor

486 questions
170
votes
7 answers

How can I represent 'Authorization: Bearer ' in a Swagger Spec (swagger.json)

I am trying to convey that the authentication/security scheme requires setting a header as follows: Authorization: Bearer This is what I have based on the swagger documentation: securityDefinitions: APIKey: type: apiKey name:…
Elmer Thomas
  • 2,068
  • 2
  • 13
  • 11
81
votes
2 answers

How to format Swagger 2.0 text descriptions?

I would like to format my Swagger API descriptions so that they are not simple paragraphs of text. Preferably, I'd like to add a small table to it. I did not find an online reference about text formatting in Swagger descriptions. If I launch the…
TERACytE
  • 7,553
  • 13
  • 75
  • 111
70
votes
5 answers

Validating JSON against Swagger API schema

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…
Peter G.
  • 7,816
  • 20
  • 80
  • 154
61
votes
6 answers

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

I'm using http://editor.swagger.io to design an API and I get an error which I don't know how to address: Schema error at paths['/employees/{employeeId}/roles'].get.parameters[0] should NOT have additional properties additionalProperty: type,…
Emanuel Ey
  • 2,724
  • 5
  • 30
  • 38
37
votes
1 answer

How to refer to enclosing type definition recursively in OpenAPI / Swagger?

I'm writing an OpenAPI definition in Swagger Editor. One of my type definitions contains an array containing child elements of the same type as the parent. I.e. something like this: definitions: TreeNode: type: object properties: …
Morten
  • 684
  • 1
  • 5
  • 15
36
votes
3 answers

Swagger complex response model with dynamic key value hash maps

I'm struggling with the syntax of swagger to describe a response type. What I'm trying to model is a hash map with dynamic keys and values. This is needed to allow a localization. The languages may vary, but english should always be provided. The…
user1736217
  • 425
  • 1
  • 4
  • 7
36
votes
5 answers

Multi-line literals in swagger editor?

I am trying to get a multi-line literal in Swagger editor (awesome tool, by the way!). post: summary: Translate one or more identifiers description: | Translate one or more identifiers for one entity into the identifiers of another entity.…
fool4jesus
  • 2,147
  • 3
  • 23
  • 34
35
votes
4 answers

Slate vs Swagger - Which is better and which have more options?

I have to document my API's. I have to use any one of them Slate Or Swagger. I want to know which one have more options, pros and cons, which one is better.
Sariban D'Cl
  • 2,197
  • 2
  • 28
  • 42
33
votes
2 answers

Swagger Editor multiple parameters in body

So I understand that if we want body parameters we have to have a schema, which I do. The issue is no matter how I try to define my schema it does not allow me to have multiple body parameters. Here is an example of one of the methods I have tried.…
Jacob Brauchler
  • 579
  • 2
  • 7
  • 22
32
votes
2 answers

How to specify that a pdf is returned in swagger?

I have a get call in my swagger REST API that needs to return a pdf file. There is no clear example / documentation on how to do this without causing a syntax error. responses: 200: description: Returns PDF schema:…
Scottingham
  • 906
  • 2
  • 11
  • 26
30
votes
3 answers

How to make a field in a definition required for some operations and not others

I'm writing my swagger definition in yaml. Say I have a definition that looks something like this. paths: /payloads: post: summary: create a payload ... parameters: - in: body name: payload description:…
Joseph Downing
  • 1,099
  • 2
  • 12
  • 25
29
votes
4 answers

Swagger: Add description with ref

I want to add a description to an object property that his definition is referenced. Something like that: newCreditCard: type: object properties: billingPhone: description: Phone number of the card holder …
Jonathan Huet
  • 395
  • 1
  • 4
  • 12
26
votes
2 answers

How to document dynamic query parameter names in OpenAPI (Swagger)?

Is there any way to document the following query? GET api/v1/users?name1=value1&name2=value where the query parameter names are dynamic and will be received from the client. I'm using the latest Swagger API.
Sharad Ahire
  • 758
  • 2
  • 16
  • 32
26
votes
1 answer

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

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,…
user2152081
  • 777
  • 1
  • 9
  • 17
26
votes
2 answers

"discriminator" in polymorphism, OpenAPI 2.0 (Swagger 2.0)

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…
Musa Haidari
  • 2,109
  • 5
  • 30
  • 53
1
2 3
32 33