Spec Extensions
react-openapi is configured entirely by x- extensions inside the OpenAPI
document. This page is the catalogue; the repository README.md carries the
complete authoring guide with a minimal worked spec.
Validation levels โ error (the admin will not render), warning
(renders, shown in a snackbar), info (informational note).
๐ฆ Schema level
| Extension | Required | Purpose |
|---|---|---|
x-resource |
โ | Marks the schema as a resource; value must equal the collection path segment (pets โ /pets). Schemas without it are skipped entirely (use for ErrorBody, Metadata, โฆ). |
x-primary-key |
โ | Property used as the :id path parameter. Must exist in properties. |
x-display-format |
โ | Template such as "{name} - #{id}"; used for row labels, detail titles and FK options. |
x-list-columns |
โ | Ordered property names for the datatable; every entry must exist. |
๐ฆ Property level
| Extension | Required | Purpose |
|---|---|---|
x-label |
โ | Label for form field, table header and detail view. |
x-order |
โ | Field ordering; ties break alphabetically. |
x-description |
โ | Helper text / placeholder; falls back to x-label. |
x-hidden |
โ | { form, list, detail } visibility; missing keys default to false. |
x-filterable |
โ | Marks the field filterable (UI integration reserved). |
x-sortable |
โ | Sends ?sort=field / ?sort=-field on the list endpoint. |
x-edit-as |
โ | e.g. date โ edit a date-time field with a date input. |
x-fk |
โ | { resource, prefetch } โ render a dropdown or multi-select for a $ref. |
x-ui-type |
โ | image โ file/image upload control. |
x-upload / x-upload-url |
โ | Raw-binary upload (type: image\|pdf\|html\|csv\|file) or an image POST endpoint with {id}. |
Foreign keys
- Single
$refโFkSelectFielddropdown;type: arrayโFkMultiSelectField. - Options are fetched as
GET /{target}?limit=0(paginated) orGET /{target}, then formatted with the target'sx-display-format. - Validator rules:
resourcemust match somex-resource, and that target must havex-display-format+x-primary-key. - A
$refwithoutx-fkrenders read-only (InlineRefFieldchips, or a disabled JSON text field in forms) and emits aninfomessage.
๐ฆ Path level
| Extension | Purpose |
|---|---|
x-sse |
Marks a path as a Server-Sent Events stream instead of REST CRUD. |
An x-sse resource is excluded from the sidebar, list/detail routes and CRUD
hooks โ it appears only in the streaming collection and is reachable through
useResource(name).stream / SseStreamView.
๐ฆ Security / auth
Derived from components.securitySchemes.bearerAuth:
| Extension | Meaning |
|---|---|
x-server-url |
Auth server base URL โ AuthConfig.serverUrl |
x-login-path |
โ loginPath |
x-register-path |
โ registerPath |
x-logout-path |
โ logoutPath |
x-me-path |
โ mePath |
x-introspect-path |
โ introspectPath |
Requests carry Authorization: Bearer <token> from
SpecConfiguration.getToken. On a 401 the stored token is cleared so a
refresh flow can take over.
๐ฆ Profile (x-profile)
x-profile operations describe the current-user view/edit/create screens.
SpecConfiguration.profileComponents supplies React components for them, and
they are mounted through the exported ProfileRoutes.
โ Validator rules (summary)
For each schema with x-resource:
x-primary-key,x-display-format,x-list-columnspresent and valid.- Every property has
x-labelandx-order. $refwithoutx-fkโinfo;x-fktarget must exist and be displayable.- The
x-resourcepath exists with GET + POST. - The item path
/{resource}/{id}exists with GET + PUT + DELETE. - If pagination params exist,
limitmust carry aschema.default.