-
Notifications
You must be signed in to change notification settings - Fork 207
API playground docs refresh #723
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
Merged
Merged
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
fd072b6
add outline
ethanpalm 437dd60
update overview
ethanpalm da2aeb5
add a quickstart
ethanpalm 46d4a36
update grouping and titles
ethanpalm 7c18796
Add getting started info to overview
ethanpalm 43885b4
update info on adding openAPI doc
ethanpalm 9721bd4
remove repeated link
ethanpalm 54f87d0
update info on auto-generating pages
ethanpalm 85e07ea
remove mindsdb image
ethanpalm 90d2868
update MDX info
ethanpalm e240f76
remove files combined into OpenAPI setup
ethanpalm 8fd4c1b
add redirects
ethanpalm 79586d7
rewrite MDX intro
ethanpalm de02346
upate steps
ethanpalm dcff49e
undo reorging MDX content
ethanpalm 2776e34
create files for customization group
ethanpalm fd3c41c
update `docs.json`
ethanpalm 8929c2e
add content for complex data types
ethanpalm ed12618
add content for managing page visibility
ethanpalm be1399d
Add SDK examples content
ethanpalm 4e9f0ae
delete advanced features page
ethanpalm 3595bac
add description for SDK page
ethanpalm 4fcdbdc
add info on multiple responses
ethanpalm 1b13d76
fix broken links
ethanpalm ab16562
Copilot edits
ethanpalm 7297901
Copy edit overview
ethanpalm 10cfd1e
Copy edit of OpenAPI setup
ethanpalm 627adf9
Copyedit customization pages
ethanpalm f154424
consistent heading capitalization
ethanpalm cc2a98a
add reviewer feedback
ethanpalm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| --- | ||
| title: "Adding SDK examples" | ||
| description: "Display language-specific code samples alongside your API endpoints to show developers how to use your SDKs" | ||
| --- | ||
|
|
||
| If your users interact with your API using an SDK rather than directly through a network request, you can use the `x-codeSamples` extension to add code samples to your OpenAPI document and display them in your OpenAPI pages. | ||
|
|
||
| This property can be added to any request method and has the following schema. | ||
|
|
||
| <ParamField body="lang" type="string" required> | ||
| The language of the code sample. | ||
| </ParamField> | ||
|
|
||
| <ParamField body="label" type="string"> | ||
| The label for the sample. This is useful when providing multiple examples for a single endpoint. | ||
| </ParamField> | ||
|
|
||
| <ParamField body="source" type="string" required> | ||
| The source code of the sample. | ||
| </ParamField> | ||
|
|
||
| Here is an example of code samples for a plant tracking app, which has both a Bash CLI tool and a JavaScript SDK. | ||
|
|
||
| ```yaml | ||
| paths: | ||
| /plants: | ||
| get: | ||
| ... | ||
| x-codeSamples: | ||
| - lang: bash | ||
| label: List all unwatered plants | ||
| source: | | ||
| planter list -u | ||
| - lang: javascript | ||
| label: List all unwatered plants | ||
| source: | | ||
| const planter = require('planter'); | ||
| planter.list({ unwatered: true }); | ||
| - lang: bash | ||
| label: List all potted plants | ||
| source: | | ||
| planter list -p | ||
| - lang: javascript | ||
| label: List all potted plants | ||
| source: | | ||
| const planter = require('planter'); | ||
| planter.list({ potted: true }); | ||
| ``` | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| title: "Complex data types" | ||
| description: "Describe APIs with flexible schemas, optional properties, and multiple data formats using `oneOf`, `anyOf`, and `allOf` keywords" | ||
| --- | ||
|
|
||
| When your API accepts multiple data formats, has conditional fields, or uses inheritance patterns, OpenAPI's schema composition keywords help you document these flexible structures. Using `oneOf`, `anyOf`, and `allOf`, you can describe APIs that handle different input types or combine multiple schemas into comprehensive data models. | ||
|
|
||
| ## `oneOf`, `anyOf`, `allOf` keywords | ||
|
|
||
| For complex data types, OpenAPI provides keywords for combining schemas: | ||
|
|
||
| - `allOf`: Combines multiple schemas (like merging objects or extending a base schema). Functions like an `and` operator. | ||
| - `anyOf`: Accepts data matching any of the provided schemas. Functions like an `or` operator. | ||
| - `oneOf`: Accepts data matching exactly one of the provided schemas. Functions like an `exclusive-or` operator. | ||
|
|
||
| <Warning>Mintlify treats `oneOf` and `anyOf` identically since the practical difference rarely affects using the API.</Warning> | ||
|
|
||
| For detailed specifications of these keywords see the [OpenAPI documentation](https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/). | ||
|
|
||
| <Info>The `not` keyword is currently unsupported.</Info> | ||
|
|
||
| ### Combining schemas with `allOf` | ||
|
|
||
| When you use `allOf`, Mintlify performs some preprocessing on your OpenAPI document to display complex combinations in a readable way. For example, when you combine two object schemas with `allOf`, Mintlify combines the properties of both into a single object. This becomes especially useful when leveraging OpenAPI's reusable [`components`](https://swagger.io/docs/specification/components/). | ||
|
|
||
| ```yaml | ||
| org_with_users: | ||
| allOf: | ||
| - $ref: '#/components/schemas/Org' | ||
| - type: object | ||
| properties: | ||
| users: | ||
| type: array | ||
| description: An array containing all users in the organization | ||
| ... | ||
| components: | ||
| schemas: | ||
| Org: | ||
| type: object | ||
| properties: | ||
| id: | ||
| type: string | ||
| description: The ID of the organization | ||
| ``` | ||
|
|
||
| <ParamField body="org_with_users" type="object"> | ||
| <Expandable> | ||
| <ParamField body="id" type="string"> | ||
| The ID of the organization | ||
| </ParamField> | ||
| <ParamField body="users" type="object[]"> | ||
| An array containing all users in the organization | ||
| </ParamField> | ||
| </Expandable> | ||
| </ParamField> | ||
|
|
||
| ### Providing options with `oneOf` and `anyOf` | ||
|
|
||
| When you use `oneOf` or `anyOf`, Mintlify displays the options in a tabbed container. Specify a `title` field in each subschema to give your options names. For example, here's how you might display two different types of delivery addresses: | ||
|
|
||
| ```yaml | ||
| delivery_address: | ||
| oneOf: | ||
| - title: StreetAddress | ||
| type: object | ||
| properties: | ||
| address_line_1: | ||
| type: string | ||
| description: The street address of the recipient | ||
| ... | ||
| - title: POBox | ||
| type: object | ||
| properties: | ||
| box_number: | ||
| type: string | ||
| description: The number of the PO Box | ||
| ... | ||
| ``` | ||
|
|
||
| <ParamField body="delivery_address" type="object"> | ||
| <div className="mt-4 rounded-xl border border-gray-100 px-4 pb-4 pt-2 dark:border-white/10"> | ||
| <Tabs> | ||
| <Tab title="StreetAddress"> | ||
| <ParamField body="address_line_1" type="string"> | ||
| The street address of the residence | ||
| </ParamField> | ||
| </Tab> | ||
| <Tab title="POBox"> | ||
| <ParamField body="box_number" type="string"> | ||
| The number of the PO Box | ||
| </ParamField> | ||
| </Tab> | ||
| </Tabs> | ||
| </div> | ||
| </ParamField> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| --- | ||
| title: "Managing page visibility" | ||
| description: "Control which endpoints from your OpenAPI specification appear in your documentation navigation" | ||
| --- | ||
|
|
||
| You can control which OpenAPI operations get published as documentation pages and their visibility in navigation. This is useful for internal-only endpoints, deprecated operations, beta features, or endpoints that should be accessible via direct URL but not discoverable through site navigation. | ||
|
|
||
| If your pages are autogenerated from an OpenAPI document, you can manage page visibility with the `x-hidden` and `x-excluded` extensions. | ||
|
|
||
| ## `x-hidden` | ||
|
|
||
| The `x-hidden` extension creates a page for an endpoint, but hides it from navigation. The page is only accessible by navigating directly to its URL. | ||
|
|
||
| Common use cases for `x-hidden` are: | ||
|
|
||
| - Endpoints you want to document, but not promote. | ||
| - Pages that you will link to from other content. | ||
| - Endpoints for specific users. | ||
|
|
||
| ## `x-excluded` | ||
|
|
||
|
|
||
| The `x-excluded` extension completely excludes an endpoint from your documentation. | ||
|
|
||
| Common use cases for `x-excluded` are: | ||
|
|
||
| - Internal-only endpoints. | ||
| - Deprecated endpoints that you don't want to document. | ||
| - Beta features that are not ready for public documentation. | ||
|
|
||
| ## Implementation | ||
|
|
||
| Add the `x-hidden` or `x-excluded` extension under the HTTP method in your OpenAPI specification. | ||
|
|
||
| Here are examples of how to use each property in an OpenAPI schema document for an endpoint and a webhook path. | ||
|
|
||
| ```json {11, 19} | ||
| "paths": { | ||
| "/plants": { | ||
| "get": { | ||
| "description": "Returns all plants from the store", | ||
| "parameters": { ... }, | ||
| "responses": { ... } | ||
| } | ||
| }, | ||
| "/hidden_plants": { | ||
| "get": { | ||
| "x-hidden": true, | ||
| "description": "Returns all somewhat secret plants from the store", | ||
| "parameters": { ... }, | ||
| "responses": { ... } | ||
| } | ||
| }, | ||
| "/secret_plants": { | ||
| "get": { | ||
| "x-excluded": true, | ||
| "description": "Returns all top secret plants from the store (do not publish this endpoint!)", | ||
| "parameters": { ... }, | ||
| "responses": { ... } | ||
| } | ||
| } | ||
| }, | ||
| ``` | ||
|
|
||
| ```json {9, 15} | ||
| "webhooks": { | ||
| "/plants_hook": { | ||
| "post": { | ||
| "description": "Webhook for information about a new plant added to the store", | ||
| } | ||
| }, | ||
| "/hidden_plants_hook": { | ||
| "post": { | ||
| "x-hidden": true, | ||
| "description": "Webhook for somewhat secret information about a new plant added to the store" | ||
| } | ||
| }, | ||
| "/secret_plants_hook": { | ||
| "post": { | ||
| "x-excluded": true, | ||
| "description": "Webhook for top secret information about a new plant added to the store (do not publish this endpoint!)" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| --- | ||
| title: "Multiple responses" | ||
| description: "Show response variations for the same endpoint" | ||
| --- | ||
|
|
||
| If your API returns different responses based on input parameters, user context, or other conditions of the request, you can document multiple response examples with the `examples` property. | ||
|
|
||
| This property can be added to any response and has the following schema. | ||
|
|
||
| ```yaml | ||
| responses: | ||
| "200": | ||
| description: Successful response | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: "#/components/schemas/YourResponseSchema" | ||
| examples: | ||
| us: | ||
| summary: Response for United States | ||
| value: | ||
| countryCode: "US" | ||
| currencyCode: "USD" | ||
| taxRate: 0.0825 | ||
| gb: | ||
| summary: Response for United Kingdom | ||
| value: | ||
| countryCode: "GB" | ||
| currencyCode: "GBP" | ||
| taxRate: 0.20 | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.