You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/pages/api-definition/fern-definition/audiences.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Audiences in Fern Definition
3
3
subtitle: Use audiences in your Fern Definition to segment your API for different groups of consumers.
4
4
---
5
5
6
-
Audiences are a useful tool for segmenting your API for different consumers. You can configure your Fern Docs to publish documentation specific to an `Audience`. You can use [audiences in your OpenAPI specification](/learn/api-definition/openapi/extensions#audiences), too.
6
+
Audiences are a useful tool for segmenting your API for different consumers. You can configure your Fern Docs to publish documentation specific to an `Audience`. You can use [audiences in your OpenAPI Specification](/learn/api-definition/openapi/extensions#audiences), too.
Copy file name to clipboardExpand all lines: fern/pages/api-definition/introduction/what-is-an-api-definition.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Fern integrates with several API definition formats:
17
17
Formerly known as Swagger, [OpenAPI](https://swagger.io/specification/) is the most popular API definition format.
18
18
OpenAPI can be used to document RESTful APIs and is defined in a YAML or JSON file.
19
19
20
-
Check out an example OpenAPI spec for the Petstore API [here](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
20
+
Check out an example OpenAPI Specification for the Petstore API [here](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
21
21
22
22
```yaml maxLines={0}
23
23
openapi: 3.0.2
@@ -218,7 +218,7 @@ Fern integrates with several API definition formats:
218
218
## Why create an API Definition ?
219
219
220
220
Once you have an API definition, Fern will use it as an input to generate artifacts
221
-
like SDKs and API reference documentation. Every time you update the API definition,
221
+
like SDKs and API Reference documentation. Every time you update the API definition,
222
222
you can regenerate these artifacts and ensure they are always up-to-date.
Copy file name to clipboardExpand all lines: fern/pages/api-definition/openapi/extensions/others.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -472,11 +472,11 @@ shown in the third tab.
472
472
473
473
## Embedding extensions
474
474
475
-
If instead of overlaying your extensions within an overrides file, as mentioned above. Certain frameworks that generate OpenAPI specs make it easy to embed extensions directly from code.
475
+
If instead of overlaying your extensions within an overrides file, as mentioned above. Certain frameworks that generate OpenAPI Specifications make it easy to embed extensions directly from code.
476
476
477
477
### FastAPI
478
478
479
-
Please view our page on [FastAPI](/learn/api-definition/openapi/frameworks/fastapi) for more information on how to extend your OpenAPI spec within FastAPI.
479
+
Please view our page on [FastAPI](/learn/api-definition/openapi/frameworks/fastapi) for more information on how to extend your OpenAPI Specification within FastAPI.
description: An overview of how to define your API using an OpenAPI specification, then use Fern to generate SDKs and API reference documentation for the API.
3
+
description: An overview of how to define your API using an OpenAPI Specification, then use Fern to generate SDKs and API Reference documentation for the API.
4
4
---
5
5
6
-
Fern supports the use of the [OpenAPI specification](https://www.openapis.org/) (up to and including version 3.1) to define APIs. Alternatively, you can use Fern's simpler format called [Fern Definition](/learn/api-definition/fern/overview).
6
+
Fern supports the use of the [OpenAPI Specification](https://www.openapis.org/) (up to and including version 3.1) to define APIs. Alternatively, you can use Fern's simpler format called [Fern Definition](/learn/api-definition/fern/overview).
7
7
8
-
Fern generates SDKs and API reference documentation from your OpenAPI spec. Get started by creating a `fern/` project through one of our [Quickstarts](/learn/docs/getting-started/quickstart), then replace the file in the `fern/openapi/` folder with your own. You can use either JSON or YAML for your file.
8
+
Fern generates SDKs and API Reference documentation from your OpenAPI Specification. Get started by creating a `fern/` project through one of our [Quickstarts](/learn/docs/getting-started/quickstart), then replace the file in the `fern/openapi/` folder with your own. You can use either JSON or YAML for your file.
9
9
10
-
Run `fern check` to validate the OpenAPI spec. Resolve any errors.
10
+
Run `fern check` to validate the OpenAPI Specification. Resolve any errors.
11
11
Having trouble? Reach out in the [Fern Discord server](https://discord.com/invite/JkkXumPzcG).
12
12
13
13
If you're having trouble understanding the errors, run the command [`fern write-definition`](/learn/cli-api/cli-reference/commands#fern-write-definition).
14
-
This command will convert your OpenAPI spec into a Fern Definition.
14
+
This command will convert your OpenAPI Specification into a Fern Definition.
15
15
16
16
If there are no errors, you can run [fern generate](/learn/cli-api/cli-reference/commands#fern-generate) to generate SDKs or [fern generate --docs](/learn/cli-api/cli-reference/commands#fern-generate) to generate docs.
Copy file name to clipboardExpand all lines: fern/pages/api-definition/openapi/overrides.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,11 @@ title: How to use OpenAPI Overrides
3
3
subtitle: Use overrides to customize user-facing documentation fields, examples, and naming.
4
4
---
5
5
6
-
When you generate your OpenAPI from server code, you may want to further customize portions of your OpenAPI spec. You can do this with OpenAPI Overrides. When you run `fern generate`, Fern will automatically apply these overrides on top of your OpenAPI spec.
6
+
When you generate your OpenAPI from server code, you may want to further customize portions of your OpenAPI Specification. You can do this with OpenAPI Overrides. When you run `fern generate`, Fern will automatically apply these overrides on top of your OpenAPI Specification.
7
7
8
8
## How to use OpenAPI Overrides
9
9
10
-
To use OpenAPI Overrides, create a file named `openapi-overrides.yml`. You can put the file anywhere in your project. This file contains the overrides you want to apply to your OpenAPI spec. For more on the extensions available, visit our page on [OpenAPI Extensions](https://buildwithfern.com/learn/api-definition/openapi/extensions).
10
+
To use OpenAPI Overrides, create a file named `openapi-overrides.yml`. You can put the file anywhere in your project. This file contains the overrides you want to apply to your OpenAPI Specification. For more on the extensions available, visit our page on [OpenAPI Extensions](https://buildwithfern.com/learn/api-definition/openapi/extensions).
Copy file name to clipboardExpand all lines: fern/pages/api-definition/openapi/server-frameworks/fastapi.mdx
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: FastAPI Instrumentation
3
-
description: Learn about best practices for creating rich OpenAPI specs when instrumenting FastAPI applications.
3
+
description: Learn about best practices for creating rich OpenAPI Specifications when instrumenting FastAPI applications.
4
4
---
5
5
6
6
[FastAPI](https://fastapi.tiangolo.com/) is a popular Python web framework developed by [tiangolo](https://github.com/tiangolo).
@@ -9,38 +9,38 @@ The offering brands itself as
9
9
10
10
> FastAPI is a modern, fast (high-performance), web framework for building APIs with Python based on standard Python type hints.
11
11
12
-
FastAPI plays very nicely with Fern because it has the power to output OpenAPI specs! Below we'll outline some tips for generating a rich OpenAPI with FastAPI.
12
+
FastAPI plays very nicely with Fern because it has the power to output OpenAPI Specifications! Below we'll outline some tips for generating a rich OpenAPI with FastAPI.
13
13
14
14
15
15
## OpenAPI generation
16
16
17
-
By default, FastAPI will generate an OpenAPI spec for you based on your routes and your data models! You can access this spec by visiting `/docs` on your FastAPI server.
17
+
By default, FastAPI will generate an OpenAPI Specification for you based on your routes and your data models! You can access this spec by visiting `/docs` on your FastAPI server.
18
18
19
-
If you are not seeing any OpenAPI spec (or the Swagger UI), you may need to review your FastAPI server configuration as the path may have been changed, or completely omitted.
19
+
If you are not seeing any OpenAPI Specification (or the Swagger UI), you may need to review your FastAPI server configuration as the path may have been changed, or completely omitted.
20
20
21
21
```python {6-8}
22
22
from fastapi import FastAPI
23
23
24
24
...
25
25
26
26
FastAPI(
27
-
openapi_url="/openapi.json", # <-- this is the file and URL needed to access the OpenAPI spec, `docs_url` and `redoc_url` are convenient wrappers that display the file in a UI!
28
-
docs_url="/docs", # <-- this is the URL to access the Swagger UI, which will point to your OpenAPI spec
29
-
redoc_url="/redoc"# <-- this is the URL to access the ReDoc UI, which will point to your OpenAPI spec
27
+
openapi_url="/openapi.json", # <-- this is the file and URL needed to access the OpenAPI Specification, `docs_url` and `redoc_url` are convenient wrappers that display the file in a UI!
28
+
docs_url="/docs", # <-- this is the URL to access the Swagger UI, which will point to your OpenAPI Specification
29
+
redoc_url="/redoc"# <-- this is the URL to access the ReDoc UI, which will point to your OpenAPI Specification
30
30
)
31
31
```
32
32
33
33
## Specifying servers
34
34
35
-
Fern will automatically generate clients that point to the servers you configure within your OpenAPI spec, so it's important to specify the servers that your API will be hosted on.
35
+
Fern will automatically generate clients that point to the servers you configure within your OpenAPI Specification, so it's important to specify the servers that your API will be hosted on.
@@ -52,7 +52,7 @@ Below, we've annotated a "good" route within FastAPI that has it's typings as we
52
52
```python {5-9}
53
53
@router.post(
54
54
"/your/post/endpoint",
55
-
response_model=YourResponseModel, # <-- with FastAPI, it is important to specify your response model so that it comes through to the OpenAPI spec
55
+
response_model=YourResponseModel, # <-- with FastAPI, it is important to specify your response model so that it comes through to the OpenAPI Specification
56
56
summary="Get some response for your req", # <-- if you'd like to add a description to your endpoint, you can do so here
57
57
openapi_extra={ # <-- finally, you can add in your Fern extensions here, these extensions will produce SDK code that looks something like: `client.endpoints.create(...)` in python
58
58
"x-fern-sdk-method-name": "create",
@@ -89,4 +89,4 @@ class MyObject(BaseModel):
89
89
90
90
## Additional customization
91
91
92
-
FastAPI has a lot of flexibility in how you can customize your OpenAPI spec. Please refer to the [FastAPI documentation](https://fastapi.tiangolo.com/how-to/extending-openapi/#modify-the-openapi-schema) for more information.
92
+
FastAPI has a lot of flexibility in how you can customize your OpenAPI Specification. Please refer to the [FastAPI documentation](https://fastapi.tiangolo.com/how-to/extending-openapi/#modify-the-openapi-schema) for more information.
0 commit comments