Reference for the attachment MDX component, including usage notes and examples.
Attachment embeds an object’s OpenAPI, ERD, or MDX attachment directly in spec documentation.
When to use
- Linking OpenAPI, ERD, or handbook files to design decisions
- Showing the contract or data model next to the decision that requires it
- Keeping docs and attachment paths aligned
Supported props
| Prop | Type | Required | Default | Purpose |
|---|---|---|---|---|
model_key | string | no | current route model | Model context for attachment lookup |
object_id | string | yes* | current route object | Object path that owns the attachment tab |
attachment_key | string | yes* | none | Attachment tab key to load |
type | 'erd' | 'openapi' | 'mdx' | yes* | none | Controls renderer and file target |
* In specs pages there is usually no model/object route context, so set object_id, attachment_key, and type explicitly.
Important
path and title are not supported props for Attachment. Use object_id
attachment_key+type.
Example
Source syntax
<Attachment
model_key="logic"
object_id="logic.iomodel.api"
attachment_key="openapi"
type="openapi"
/>Rendered output
If the attachment exists, the component renders:
type="openapi": interactive OpenAPI viewertype="erd": ERD paneltype="mdx": embedded MDX document
If required props are missing or attachment is not found, it shows an inline error placeholder.
Common pitfalls
- Using unsupported props (
path,title) - Passing
typeoutsideerd/openapi/mdx - Forgetting that
attachment_keyis required in non-model routes
Last updated on