-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): re-format multipart fern def (#4922)
multipart Co-authored-by: fern-bot <[email protected]>
- Loading branch information
1 parent
44a67c1
commit 120b257
Showing
4 changed files
with
79 additions
and
23 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
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
24 changes: 24 additions & 0 deletions
24
fern/pages/api-definition/fern-definition/endpoints/multipart.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,24 @@ | ||
--- | ||
title: Multipart File Upload | ||
--- | ||
|
||
Endpoints in Fern are defined underneath the `endpoints` key. If your endpoint request includes file uploads, you can use the `file` type to indicate the request is of a `multiform` content type. The example below demonstrates an endpoint which includes a file in the request body. | ||
|
||
<CodeBlock title="document.yml"> | ||
```yaml {12} | ||
service: | ||
base-path: /documents | ||
auth: false | ||
endpoints: | ||
uploadDocument: | ||
path: /upload | ||
method: POST | ||
request: | ||
name: UploadDocumentRequest | ||
body: | ||
properties: | ||
file: file | ||
``` | ||
</CodeBlock> | ||
Within a given multipart request, a string parameter with `format:binary` will represent an arbitrary file. |
45 changes: 45 additions & 0 deletions
45
fern/pages/api-definition/fern-definition/endpoints/rest.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,45 @@ | ||
--- | ||
title: HTTP JSON Endpoints | ||
--- | ||
|
||
Endpoints in Fern are defined underneath the `endpoints` key. Below is an example of defining | ||
a single REST endpoint: | ||
|
||
```yml title="users.yml" maxLines=0 | ||
service: | ||
base-path: /users | ||
auth: false | ||
endpoints: | ||
createUser: | ||
path: /create | ||
method: POST | ||
request: | ||
body: | ||
properties: | ||
userName: string | ||
``` | ||
## Examples | ||
You can provide examples of requests and responses by using the `examples` key. | ||
|
||
```yaml {11-17} | ||
service: | ||
base-path: /users | ||
auth: false | ||
endpoints: | ||
getUser: | ||
path: /{userId} | ||
path-parameters: | ||
userId: string | ||
method: GET | ||
response: User | ||
examples: | ||
- path-parameters: | ||
userId: alice-user-id | ||
response: | ||
body: | ||
userId: alice-user-id | ||
name: Alice | ||
``` | ||
|