Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add OpenAPI Tool File Format Guide #373

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 78 additions & 1 deletion api-playground/openapi/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,83 @@ document in either JSON or YAML format that follows the
[OpenAPI specification](https://swagger.io/specification/). Your document must
follow OpenAPI specification 3.0+.

## OpenAPI File Formats

OpenAPI specifications can be written in either YAML or JSON format. Both formats are equally valid and contain the same information - choose the one that best fits your workflow.

### YAML Format

YAML is often preferred for its readability and concise syntax:

```yaml
openapi: 3.0.0
info:
title: Sample API
version: 1.0.0
paths:
/users:
get:
summary: Returns a list of users
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
```

### JSON Format

JSON format is also widely used, especially when working with JavaScript tools:

```json
{
"openapi": "3.0.0",
"info": {
"title": "Sample API",
"version": "1.0.0"
},
"paths": {
"/users": {
"get": {
"summary": "Returns a list of users",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}
```

## Autogenerating the API playground

You can either [autogenerate the API playground](/settings/navigation#tabs) or
Expand Down Expand Up @@ -151,4 +228,4 @@ openapi-schema: "schema-key"
---
```

</CodeGroup>
</CodeGroup>
19 changes: 14 additions & 5 deletions mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@
},
{
"group": "Advanced",
"pages": [{
"pages": [
{
"icon": "code",
"group": "Custom Scripts",
"pages": [
Expand Down Expand Up @@ -196,7 +197,10 @@
},
{
"group": "SDKs",
"pages": ["integrations/sdks/speakeasy", "integrations/sdks/stainless"]
"pages": [
"integrations/sdks/speakeasy",
"integrations/sdks/stainless"
]
},
{
"group": "Support",
Expand All @@ -208,7 +212,10 @@
},
{
"group": "Privacy",
"pages": ["integrations/privacy/overview", "integrations/privacy/osano"]
"pages": [
"integrations/privacy/overview",
"integrations/privacy/osano"
]
},
{
"group": "Components",
Expand Down Expand Up @@ -240,7 +247,9 @@
},
{
"group": "Changelog",
"pages": ["changelog/overview"]
"pages": [
"changelog/overview"
]
}
],
"footer": {
Expand Down Expand Up @@ -324,4 +333,4 @@
"publicApiKey": "pk_76a6caa274e800f3ceff0b2bc6b9b9d82ab8"
}
}
}
}