-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docs): move audiences docs into own page (#4389)
- Loading branch information
Showing
3 changed files
with
107 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
104 changes: 104 additions & 0 deletions
104
fern/pages/api-definition/openapi/extensions/audiences.mdx
This file contains 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,104 @@ | ||
--- | ||
title: Audiences | ||
subtitle: Use `x-fern-audiences` to filter to relevant endpoints, schemas and properties | ||
--- | ||
|
||
Audiences are a useful tool for segmenting your API for different consumers. Common examples of audiences include `public` | ||
and `beta`. | ||
|
||
<Info> | ||
Remember to filter your SDKs and Docs after specifying audiences. If **no audiences** are specified, | ||
nothing will be filtered. | ||
|
||
<AccordionGroup> | ||
|
||
<Accordion title="SDKs"> | ||
The following example configures the SDK to filter to the `public` audience: | ||
|
||
```yaml title="generators.yml" {3-4} | ||
groups: | ||
sdks: | ||
audiences: | ||
- public | ||
generators: | ||
- name: fernapi/fern-tyepscript-node-sdk | ||
version: 0.8.8 | ||
``` | ||
</Accordion> | ||
<Accordion title="Docs"> | ||
The following example configures the docs to filter to the `public` audience: | ||
|
||
```yaml title="docs.yml" {3-4} | ||
navigation: | ||
- api: API Reference | ||
audiences: | ||
- public | ||
``` | ||
</Accordion> | ||
|
||
</AccordionGroup> | ||
|
||
</Info> | ||
|
||
## Audiences for Endpoints | ||
|
||
To mark an endpoint with a particular audience, add the `x-fern-audiences` extension to the relevant endpoint. | ||
|
||
In the example below, the `POST /users/sendEmail` endpoint is only available to public consumers: | ||
|
||
```yaml title="openapi.yml" {4-5} | ||
paths: | ||
/users/sendEmail: | ||
post: | ||
x-fern-audiences: | ||
- public | ||
operationId: send_email | ||
``` | ||
|
||
## Audiences for Schemas | ||
|
||
Schemas can be marked for different audiences, as well. | ||
|
||
In this example, the `Email` type is available to both public and beta customers. | ||
|
||
```yaml title="openapi.yml" {13-15} | ||
components: | ||
schemas: | ||
Email: | ||
title: Email | ||
type: object | ||
properties: | ||
subject: | ||
type: string | ||
body: | ||
type: string | ||
to: | ||
type: string | ||
x-fern-audiences: | ||
- public | ||
- beta | ||
``` | ||
|
||
## Audiences for Properties | ||
|
||
Properties can be marked for different audiences, as well. | ||
|
||
In this example, the `to` property is available to beta customers only. | ||
|
||
```yaml title="openapi.yml" {13-17} | ||
components: | ||
schemas: | ||
Email: | ||
title: Email | ||
type: object | ||
properties: | ||
subject: | ||
type: string | ||
body: | ||
type: string | ||
to: | ||
type: string | ||
x-fern-audiences: | ||
- beta | ||
``` |
This file contains 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