How to use the editor
- Start from something. The editor opens with a small sample API. Replace it by pasting
your own document, or use Open file for a
.yamlor.jsonfile. JSON is read as it is; there is no need to convert first. - Edit on the left, read on the right. The documentation redraws a moment after you stop
typing. Each operation opens to show its parameters, request body, responses and the schemas behind them,
with every
$reffollowed for you. - Fix what is listed. Problems appear above the documentation with a line number, and the same lines are marked in the margin of the editor. Click a problem to jump to it.
- Try an operation. Every operation ends with a cURL command built from its path, required parameters, security scheme and an example body. Open in API tester loads the same request into the request console, ready to send.
- Take it away. Download saves the document as
openapi.yamloropenapi.json. The draft also stays in this browser, so closing the tab does not lose it.
What the editor checks
Two kinds of mistake stop an OpenAPI document from working. The first is in the YAML or JSON itself, and the second is in what it describes. The editor reports both, with the line.
Syntax
| Mistake | What it looks like |
|---|---|
| Indentation that does not line up | A key one space too deep, or a line indented under a plain text value |
| A tab used for indentation | YAML allows only spaces |
| A colon inside an unquoted value | summary: List: all pets — YAML reads a second key. Quote the value. |
| The same key twice | Two get: under one path; the second would silently replace the first |
| Unclosed quote or bracket | tags: [pets |
| JSON that only YAML accepts | A trailing comma. It reads here, but a JSON parser will refuse the file. |
Structure
- The version line.
openapi: 3.0andswagger: 2.0are numbers to YAML, not text. Writeopenapi: 3.0.3andswagger: "2.0". The same goes forinfo.version: 1.0, which needs quotes. - Required fields:
info.title,info.version,paths, adescriptionon every response,responseson every operation (optional from OpenAPI 3.1),nameandinon every parameter. - Path parameters. Every
{name}in a path must be declared as a parameter within: pathandrequired: true, and every declared path parameter must appear in the path. Two paths that differ only in a parameter name are reported, as requests cannot be told apart. - References. Every
$refthat starts with#/must point at something that exists. Names are case-sensitive, and a Swagger 2.0 style#/definitions/Petin an OpenAPI 3 document is called out as such. - Fields in the wrong place or version:
responsesdirectly under a path,GETin capitals,definitionsorhostin OpenAPI 3,requestBodyorcomponentsin Swagger 2.0,typebeside a parameter where OpenAPI 3 wants it insideschema. - Schemas: a type that does not exist, such as
intordatetime; an array with noitems;required: trueon a property, where a schema wants a list of names on the parent object. - Names that must match up: duplicate
operationIdvalues, duplicate parameters and tags, a security requirement naming a scheme that is not defined, a server URL variable with no definition.
What it does not check
These are structural checks, chosen because they are the mistakes that stop documentation generators, code generators and gateways from reading a description. They are not a full validation against the OpenAPI specification. The editor does not verify every field of every object, does not check examples against their schemas, and does not fetch or follow references to other files or URLs; it counts those and says so. No errors found means none of these checks failed, not that the document is certified valid. Before publishing an API description, run it through the validator or linter your toolchain uses.
Swagger or OpenAPI?
They are the same format at different ages. The format began as the Swagger specification. Version 2.0 is the last to carry that name; when the specification was handed to the OpenAPI Initiative it was renamed, and version 3.0 onward is OpenAPI. "Swagger" now properly refers to the family of tools SmartBear builds around the format, Swagger Editor and Swagger UI among them, although plenty of people still say "the Swagger file" for any OpenAPI document. The Swagger alternative page separates those tools from one another.
| Swagger 2.0 | OpenAPI 3.0 and 3.1 | |
|---|---|---|
| First line | swagger: "2.0" | openapi: 3.0.3 |
| Where the API lives | host, basePath, schemes | servers, a list of URLs |
| Reusable schemas | definitions | components.schemas |
| Request body | A parameter with in: body | requestBody, with a schema per media type |
| Media types | consumes and produces | Keys under content |
| Security schemes | securityDefinitions | components.securitySchemes |
OpenAPI 3.1 brought the schema language into line with JSON Schema, which is why
nullable: true from 3.0 becomes type: [string, "null"], and it added
webhooks for requests your API sends, which are covered in the
webhook guide. The editor applies the rules of whichever version the
first line declares; documents declaring a later 3.x version are read with the 3.1 rules. It does not
convert a document from one version to another.
YAML or JSON?
An OpenAPI document may be written in either, and the two say exactly the same thing. YAML is the usual choice for writing by hand, since it is shorter and allows comments; JSON is what programs prefer to produce and consume. Convert to JSON and Convert to YAML switch the whole document over, and the result is read back and compared before it replaces your text.
Three things about YAML catch people out in API descriptions:
- Unquoted values are typed.
1.0is a number,trueis a boolean and an empty value is null. A version, a postcode or a phone number wants quotes. - Response codes are written in quotes, as
"200":. The specification asks for this so that the same document means the same thing in YAML and in JSON. The YAML this editor writes follows that convention, and quotes words such asyesandnothat older YAML readers take for booleans. - Long text belongs in a block. A description that runs over several lines, or that
contains a colon, is safest after a
|, with the text indented on the lines beneath. Descriptions may contain Markdown; this editor shows them as plain text, and the Markdown preview renders one.
Converting loses YAML comments, because JSON has nowhere to put them, and expands anchors and aliases into the content they stand for. For a file that is not an API description, the YAML to JSON converter does the same job without the OpenAPI checks.
From description to request
A description is a claim about how an API behaves, and the quickest way to test the claim is to make the call. Open any operation and the editor shows the request it describes:
curl -X POST 'https://api.bookshop.example/v1/books' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"title": "The Left Hand of Darkness",
"author": "Ursula K. Le Guin",
"published": "2026-01-01",
"price": 9.99,
"tags": [
"string"
]
}'
The URL comes from the selected server and the path. Required query and header parameters are included, and optional ones are left out. The credential is a placeholder shaped by the security scheme: a bearer token, an API key header, or basic auth. The body is the example from the document when there is one, and otherwise a value built from the schema, with read-only properties left out.
Open in API tester carries that request to the console on the home page, where you replace the placeholders and send it. If the response does not match what the document promises — a 422 for a body the schema allows, a field the schema does not mention — one of the two is wrong, and you now know which line to look at. The REST API testing guide covers what else to check, and the cURL converter turns the command into Python, JavaScript or PHP.
Frequently asked questions
Is this the official Swagger Editor?
No. Swagger Editor is made by SmartBear. This is an independent editor on api-tester.com for the same file format, with live documentation and structural checks. It does not include code generation or full validation against the OpenAPI specification.
What is the difference between Swagger and OpenAPI?
OpenAPI is the specification format. It was called Swagger up to version 2.0 and has been called OpenAPI since version 3.0. Swagger now refers to the tools SmartBear builds around the format, such as Swagger Editor and Swagger UI.
Which versions does the editor support?
OpenAPI 3.0, OpenAPI 3.1 and Swagger 2.0, in YAML or JSON. The checks follow the version declared on the first line of the document. Later 3.x versions are read with the 3.1 rules.
How do I validate an OpenAPI file?
Paste it into the editor. YAML or JSON syntax errors and structural problems, such as a missing required field or a reference that does not resolve, are listed with their line numbers. These checks catch the common mistakes; they are not a complete validation against the specification.
How do I convert Swagger YAML to JSON?
Paste the YAML and press Convert to JSON. To go the other way, paste JSON and press Convert to YAML. The content is unchanged; only YAML comments are lost, because JSON cannot hold them.
Can it convert Swagger 2.0 to OpenAPI 3?
No. It reads and checks both, and converts either between YAML and JSON, but it does not rewrite a Swagger 2.0 document as OpenAPI 3.
Why does openapi: 3.0 give an error?
YAML reads 3.0 as a number, and the version must be text with three parts. Write openapi: 3.0.3. For the same reason Swagger 2.0 documents need swagger: "2.0" in quotes.
Is my API description uploaded?
No. The document is read and checked by JavaScript in your browser, and the draft is stored only in this browser's local storage. Nothing is sent to a server unless you choose to open a request in the API tester and send it.
Related tools and reference
API Tester
Send the request an operation describes and see the real response.
Swagger Alternative
Swagger UI, Editor, Codegen and SwaggerHub: which is which.
YAML to JSON
Convert any YAML document, not only an API description.
JSON Validator
Find the exact character that breaks a JSON file.
cURL Converter
Turn an operation's cURL command into Python, JavaScript or PHP.
REST API Testing
What to check on an endpoint beyond a 200 response.