Files
mintlify__docs/components/fields.mdx

102 lines
2.6 KiB
Plaintext

---
title: "Fields"
description: "Set parameters for your API or SDK references"
icon: "letter-text"
---
Use fields to document API parameters and responses. There are two types of fields: parameter fields and response fields.
## Parameter field
The `<ParamField>` component is used to define parameters for your APIs or SDKs. Adding a `ParamField` automatically adds an [API Playground](/api-playground/overview).
<ParamField path="param" type="string" required>
An example of a parameter field
</ParamField>
```mdx
<ParamField path="param" type="string" required>
An example of a parameter field
</ParamField>
```
### Properties
<ParamField body="query, path, body, or header" type="string">
Whether the parameter is a query, path, body, or header. Followed by the
parameter name.
</ParamField>
<ParamField body="type" type="string">
Expected type of the parameter's value.
Supports `number`, `string`, `boolean`, `object`.
Arrays can be defined using the `[]` suffix. For example `string[]`.
</ParamField>
<ParamField body="required" type="boolean">
Indicate whether the parameter is required.
</ParamField>
<ParamField body="deprecated" type="boolean">
Indicate whether the parameter is deprecated.
</ParamField>
<ParamField body="default" type="any">
Default value populated when the request value is empty
</ParamField>
<ParamField body="placeholder" type="string">
Placeholder text for the input in the playground.
</ParamField>
<ParamField body="children" type="string">
Description of the parameter (Markdown-enabled).
</ParamField>
## Response field
The `<ResponseField>` component defines the return values of an API.
<ResponseField name="response" type="string" required>
An example of a response field
</ResponseField>
```mdx
<ResponseField name="response" type="string" required>
A response field example
</ResponseField>
```
### Properties
<ResponseField name="name" type="string" required>
The name of the response value.
</ResponseField>
<ResponseField name="type" type="string" required>
Expected type of the response value. This can be any arbitrary string.
</ResponseField>
<ResponseField name="default" type="string">
The default value.
</ResponseField>
<ResponseField name="required" type="boolean">
Indicate whether the response is required.
</ResponseField>
<ResponseField name="deprecated" type="boolean">
Whether a field is deprecated.
</ResponseField>
<ResponseField name="pre" type="string[]">
Labels that are shown before the name of the field.
</ResponseField>
<ResponseField name="post" type="string[]">
Labels that are shown after the name of the field.
</ResponseField>