- templates/app/openapi.yaml description no longer references react/vet - react-openapi x- catalog docstring now names the standards sample as the reference application; refreshed the vendored react-openapi MCP module
869 lines
60 KiB
JSON
869 lines
60 KiB
JSON
{
|
|
"module": "react-openapi",
|
|
"content": {
|
|
"path": "react-openapi",
|
|
"docstring": "`@aetoskia/react-openapi` - a spec-driven admin UI for OpenAPI/REST\r\nbackends (npm.aetoskia.com).\r\n\r\nPoint it at an OpenAPI document and it derives a full CRUD admin (list,\r\ndetail, create/edit, filtering, FK selects, streaming views) from the paths\r\nand schemas, plus optional profile screens and auth wiring. No per-resource\r\nhand-written screens are required.\r\n\r\n# Quick start\r\n\r\n```tsx\r\nimport { AppProvider, Admin } from \"@aetoskia/react-openapi\";\r\n\r\n<AppProvider specConfiguration={{ specUrl: \"/openapi.json\" }}>\r\n <Admin basePath=\"/admin\" />\r\n</AppProvider>\r\n```\r\n\r\n# How it works\r\n\r\n- `AppProvider` loads the spec, validates it, builds a `ResourceConfig` per\r\n collection, parses `x-profile` operations, derives auth endpoints and\r\n initializes the shared axios client.\r\n- `useAppContext` exposes that state; `useResource(name)` adds CRUD helpers\r\n and filter widgets for one resource.\r\n- `Admin` renders the sidebar + routes; the field renderers\r\n (`ListCellRenderer`, `DetailFieldRenderer`, `FormFieldRenderer`) turn each\r\n `FieldConfig` into the right UI; `SseStreamView` renders live streams.\r\n\r\n# Spec extensions\r\n\r\nThe canonical, agent-facing catalog of every `x-` extension this library\r\nunderstands lives in `src/spec-extensions.ts` and is exported here as\r\n`specExtensions` (plus `responseConventions`, `pathConventions`,\r\n`paginationConventions`, `validationRules`). It is rendered into the\r\n`react-openapi` MCP bundle by doc-weaver — read it from\r\n`docs://modules/react-openapi` when authoring or validating a spec.\r\n\r\nLevels covered: schema (`x-resource`, `x-primary-key`, `x-display-format`,\r\n`x-list-columns`), property (`x-label`, `x-order`, `x-description`,\r\n`x-hidden`, `x-filterable`, `x-sortable`, `x-fk`, `x-edit-as`,\r\n`x-ui-type`, `x-upload-url`, `x-upload`, `x-autocomplete`), path\r\n(`x-sse`), operation (`x-profile`), and securityScheme (`x-server-url`,\r\n`x-login-path`, `x-register-path`, `x-logout-path`, `x-me-path`,\r\n`x-introspect-path`).\r\n\r\n# Notes\r\n\r\n- Requires React 18, React Router and MUI (peer dependencies).\r\n- `Admin` and `ProfileRoutes` must be nested inside an `AppProvider` and a\r\n router.\r\n- Pair with `@aetoskia/react-auth` for the auth-server login/register/\r\n session layer; feed its `tokenStore` into `SpecConfiguration.getToken`.",
|
|
"objects": {
|
|
"AdminProps": {
|
|
"name": "AdminProps",
|
|
"kind": "interface",
|
|
"path": "react-openapi.AdminProps",
|
|
"signature": "AdminProps",
|
|
"docstring": "Props for `Admin`.",
|
|
"members": {
|
|
"basePath": {
|
|
"name": "basePath",
|
|
"kind": "property",
|
|
"path": "react-openapi.AdminProps.basePath",
|
|
"signature": "basePath: string",
|
|
"docstring": "Base path the admin routes are mounted under, e.g. `\"/admin\"`."
|
|
}
|
|
}
|
|
},
|
|
"AuthConfig": {
|
|
"name": "AuthConfig",
|
|
"kind": "interface",
|
|
"path": "react-openapi.AuthConfig",
|
|
"signature": "AuthConfig",
|
|
"docstring": "Auth server config extracted from `securitySchemes` extensions.",
|
|
"members": {
|
|
"introspectPath": {
|
|
"name": "introspectPath",
|
|
"kind": "property",
|
|
"path": "react-openapi.AuthConfig.introspectPath",
|
|
"signature": "introspectPath: string",
|
|
"docstring": "Token introspection endpoint path."
|
|
},
|
|
"loginPath": {
|
|
"name": "loginPath",
|
|
"kind": "property",
|
|
"path": "react-openapi.AuthConfig.loginPath",
|
|
"signature": "loginPath: string",
|
|
"docstring": "Login endpoint path."
|
|
},
|
|
"logoutPath": {
|
|
"name": "logoutPath",
|
|
"kind": "property",
|
|
"path": "react-openapi.AuthConfig.logoutPath",
|
|
"signature": "logoutPath: string",
|
|
"docstring": "Logout endpoint path."
|
|
},
|
|
"mePath": {
|
|
"name": "mePath",
|
|
"kind": "property",
|
|
"path": "react-openapi.AuthConfig.mePath",
|
|
"signature": "mePath: string",
|
|
"docstring": "\"Current user\" endpoint path."
|
|
},
|
|
"registerPath": {
|
|
"name": "registerPath",
|
|
"kind": "property",
|
|
"path": "react-openapi.AuthConfig.registerPath",
|
|
"signature": "registerPath: string",
|
|
"docstring": "Registration endpoint path."
|
|
},
|
|
"serverUrl": {
|
|
"name": "serverUrl",
|
|
"kind": "property",
|
|
"path": "react-openapi.AuthConfig.serverUrl",
|
|
"signature": "serverUrl: string",
|
|
"docstring": "Base URL of the auth server."
|
|
}
|
|
}
|
|
},
|
|
"FieldConfig": {
|
|
"name": "FieldConfig",
|
|
"kind": "interface",
|
|
"path": "react-openapi.FieldConfig",
|
|
"signature": "FieldConfig",
|
|
"docstring": "Resolved metadata for a single field, used by the list, form and detail\nrenderers and by the filter bar.",
|
|
"members": {
|
|
"autocomplete": {
|
|
"name": "autocomplete",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.autocomplete",
|
|
"signature": "autocomplete: \"text\" | \"token\" | \"email\" | \"phone\"",
|
|
"docstring": "Server-side filter widget hint (`text`/`token`/`email`/`phone`)."
|
|
},
|
|
"defaultValue": {
|
|
"name": "defaultValue",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.defaultValue",
|
|
"signature": "defaultValue: any",
|
|
"docstring": "Schema-level `default` used to seed create-form state."
|
|
},
|
|
"description": {
|
|
"name": "description",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.description",
|
|
"signature": "description: string",
|
|
"docstring": "Description, if provided in the schema."
|
|
},
|
|
"discriminatorProperty": {
|
|
"name": "discriminatorProperty",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.discriminatorProperty",
|
|
"signature": "discriminatorProperty: string",
|
|
"docstring": "Property name that discriminates a `oneOf` field."
|
|
},
|
|
"editAs": {
|
|
"name": "editAs",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.editAs",
|
|
"signature": "editAs: string",
|
|
"docstring": "`x-edit-as: date` - edit a `date-time` field with a plain date input; submits midnight."
|
|
},
|
|
"enumValues": {
|
|
"name": "enumValues",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.enumValues",
|
|
"signature": "enumValues: string[]",
|
|
"docstring": "Allowed values for enum fields."
|
|
},
|
|
"filterable": {
|
|
"name": "filterable",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.filterable",
|
|
"signature": "filterable: boolean",
|
|
"docstring": "Whether the field can be filtered (`x-filterable`)."
|
|
},
|
|
"fk": {
|
|
"name": "fk",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.fk",
|
|
"signature": "fk: FKFieldConfig",
|
|
"docstring": "Foreign-key relationship, if this field references another resource."
|
|
},
|
|
"format": {
|
|
"name": "format",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.format",
|
|
"signature": "format: string",
|
|
"docstring": "OpenAPI `format` (`\"date\"`, `\"date-time\"`, `\"email\"`, ...)."
|
|
},
|
|
"hidden": {
|
|
"name": "hidden",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.hidden",
|
|
"signature": "hidden: { detail: boolean; form: boolean; list: boolean }",
|
|
"docstring": "Where the field is hidden."
|
|
},
|
|
"inlineDisplayFormat": {
|
|
"name": "inlineDisplayFormat",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.inlineDisplayFormat",
|
|
"signature": "inlineDisplayFormat: string",
|
|
"docstring": "Display template for inline references."
|
|
},
|
|
"isArray": {
|
|
"name": "isArray",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.isArray",
|
|
"signature": "isArray: boolean",
|
|
"docstring": "Whether the value is an array."
|
|
},
|
|
"label": {
|
|
"name": "label",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.label",
|
|
"signature": "label: string",
|
|
"docstring": "Display label (`x-label`)."
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.name",
|
|
"signature": "name: string",
|
|
"docstring": "Property name in the schema."
|
|
},
|
|
"oneOfOptions": {
|
|
"name": "oneOfOptions",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.oneOfOptions",
|
|
"signature": "oneOfOptions: OneOfOption[]",
|
|
"docstring": "Branches for discriminated-union fields."
|
|
},
|
|
"order": {
|
|
"name": "order",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.order",
|
|
"signature": "order: number",
|
|
"docstring": "Sort order (`x-order`)."
|
|
},
|
|
"readOnly": {
|
|
"name": "readOnly",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.readOnly",
|
|
"signature": "readOnly: boolean",
|
|
"docstring": "Whether the field is read-only."
|
|
},
|
|
"refSchema": {
|
|
"name": "refSchema",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.refSchema",
|
|
"signature": "refSchema: string",
|
|
"docstring": "Schema name for inline (non-FK) object references."
|
|
},
|
|
"required": {
|
|
"name": "required",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.required",
|
|
"signature": "required: boolean",
|
|
"docstring": "Whether the field is required."
|
|
},
|
|
"sortable": {
|
|
"name": "sortable",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.sortable",
|
|
"signature": "sortable: boolean",
|
|
"docstring": "Whether the list can be sorted by this field."
|
|
},
|
|
"type": {
|
|
"name": "type",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.type",
|
|
"signature": "type: string",
|
|
"docstring": "OpenAPI type (`\"string\"`, `\"integer\"`, `\"object\"`, ...)."
|
|
},
|
|
"uiType": {
|
|
"name": "uiType",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.uiType",
|
|
"signature": "uiType: string",
|
|
"docstring": "UI-type override such as `\"currency\"` or `\"image\"`."
|
|
},
|
|
"upload": {
|
|
"name": "upload",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.upload",
|
|
"signature": "upload: { type: string; url: string }",
|
|
"docstring": "Parsed upload config (`{ type, url }`)."
|
|
},
|
|
"uploadUrl": {
|
|
"name": "uploadUrl",
|
|
"kind": "property",
|
|
"path": "react-openapi.FieldConfig.uploadUrl",
|
|
"signature": "uploadUrl: string",
|
|
"docstring": "Upload endpoint for file/image fields."
|
|
}
|
|
}
|
|
},
|
|
"FilterComponentProps": {
|
|
"name": "FilterComponentProps",
|
|
"kind": "interface",
|
|
"path": "react-openapi.FilterComponentProps",
|
|
"signature": "FilterComponentProps",
|
|
"docstring": "Props passed to a filter widget produced by `useResource().components`.",
|
|
"members": {
|
|
"data": {
|
|
"name": "data",
|
|
"kind": "property",
|
|
"path": "react-openapi.FilterComponentProps.data",
|
|
"signature": "data: any[]",
|
|
"docstring": "The current page of rows (used by client-mode suggestions)."
|
|
},
|
|
"labelOverride": {
|
|
"name": "labelOverride",
|
|
"kind": "property",
|
|
"path": "react-openapi.FilterComponentProps.labelOverride",
|
|
"signature": "labelOverride: string",
|
|
"docstring": "Overrides the field's label for this filter widget."
|
|
},
|
|
"onChange": {
|
|
"name": "onChange",
|
|
"kind": "property",
|
|
"path": "react-openapi.FilterComponentProps.onChange",
|
|
"signature": "onChange: void",
|
|
"docstring": "Called with the updated filter value."
|
|
},
|
|
"value": {
|
|
"name": "value",
|
|
"kind": "property",
|
|
"path": "react-openapi.FilterComponentProps.value",
|
|
"signature": "value: string",
|
|
"docstring": "Current filter value (comma-joined for multi-value filters)."
|
|
}
|
|
}
|
|
},
|
|
"FKFieldConfig": {
|
|
"name": "FKFieldConfig",
|
|
"kind": "interface",
|
|
"path": "react-openapi.FKFieldConfig",
|
|
"signature": "FKFieldConfig",
|
|
"docstring": "Parsed `x-fk` configuration describing a foreign-key field.",
|
|
"members": {
|
|
"prefetch": {
|
|
"name": "prefetch",
|
|
"kind": "property",
|
|
"path": "react-openapi.FKFieldConfig.prefetch",
|
|
"signature": "prefetch: boolean",
|
|
"docstring": "Load options eagerly instead of on field open."
|
|
},
|
|
"resource": {
|
|
"name": "resource",
|
|
"kind": "property",
|
|
"path": "react-openapi.FKFieldConfig.resource",
|
|
"signature": "resource: string",
|
|
"docstring": "Target resource name (must exist as a collection in the spec)."
|
|
},
|
|
"value": {
|
|
"name": "value",
|
|
"kind": "property",
|
|
"path": "react-openapi.FKFieldConfig.value",
|
|
"signature": "value: string",
|
|
"docstring": "Target property used as the wire value (defaults to the target's primary key)."
|
|
}
|
|
}
|
|
},
|
|
"FkOption": {
|
|
"name": "FkOption",
|
|
"kind": "interface",
|
|
"path": "react-openapi.FkOption",
|
|
"signature": "FkOption",
|
|
"docstring": "A single option for a foreign-key select.",
|
|
"members": {
|
|
"label": {
|
|
"name": "label",
|
|
"kind": "property",
|
|
"path": "react-openapi.FkOption.label",
|
|
"signature": "label: string",
|
|
"docstring": "Human-readable label (target `x-display-format`)."
|
|
},
|
|
"value": {
|
|
"name": "value",
|
|
"kind": "property",
|
|
"path": "react-openapi.FkOption.value",
|
|
"signature": "value: any",
|
|
"docstring": "Wire value sent to the API (target primary key, or `x-fk.value`)."
|
|
}
|
|
}
|
|
},
|
|
"ProfileComponents": {
|
|
"name": "ProfileComponents",
|
|
"kind": "interface",
|
|
"path": "react-openapi.ProfileComponents",
|
|
"signature": "ProfileComponents",
|
|
"docstring": "Components used to render the `x-profile: true` operations.\n\nSupply any subset; a mode with no component renders nothing for that route.",
|
|
"members": {
|
|
"create": {
|
|
"name": "create",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileComponents.create",
|
|
"signature": "create: React.ComponentType<any>",
|
|
"docstring": "Rendered for profile \"create\" operations (if any)."
|
|
},
|
|
"edit": {
|
|
"name": "edit",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileComponents.edit",
|
|
"signature": "edit: React.ComponentType<any>",
|
|
"docstring": "Rendered for profile \"edit\" operations (PUT/PATCH)."
|
|
},
|
|
"view": {
|
|
"name": "view",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileComponents.view",
|
|
"signature": "view: React.ComponentType<any>",
|
|
"docstring": "Rendered for profile \"view\" operations (GET)."
|
|
}
|
|
}
|
|
},
|
|
"ProfileOperation": {
|
|
"name": "ProfileOperation",
|
|
"kind": "interface",
|
|
"path": "react-openapi.ProfileOperation",
|
|
"signature": "ProfileOperation",
|
|
"docstring": "Represents a single operation marked with `x-profile: true` in the spec.",
|
|
"members": {
|
|
"method": {
|
|
"name": "method",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileOperation.method",
|
|
"signature": "method: string",
|
|
"docstring": "HTTP method in upper case, e.g. `\"GET\"`."
|
|
},
|
|
"operationId": {
|
|
"name": "operationId",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileOperation.operationId",
|
|
"signature": "operationId: string",
|
|
"docstring": "`operationId` from the spec."
|
|
},
|
|
"path": {
|
|
"name": "path",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileOperation.path",
|
|
"signature": "path: string",
|
|
"docstring": "Spec path template, e.g. `\"/users/me\"`."
|
|
},
|
|
"summary": {
|
|
"name": "summary",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileOperation.summary",
|
|
"signature": "summary: string",
|
|
"docstring": "Human-readable summary, when present."
|
|
}
|
|
}
|
|
},
|
|
"ProfileRoute": {
|
|
"name": "ProfileRoute",
|
|
"kind": "interface",
|
|
"path": "react-openapi.ProfileRoute",
|
|
"signature": "ProfileRoute",
|
|
"docstring": "A route describing a profile screen, derived from an `x-profile` operation.",
|
|
"members": {
|
|
"method": {
|
|
"name": "method",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileRoute.method",
|
|
"signature": "method: string",
|
|
"docstring": "HTTP method in upper case, e.g. `\"GET\"`."
|
|
},
|
|
"operationId": {
|
|
"name": "operationId",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileRoute.operationId",
|
|
"signature": "operationId: string",
|
|
"docstring": "`operationId` from the spec."
|
|
},
|
|
"path": {
|
|
"name": "path",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileRoute.path",
|
|
"signature": "path: string",
|
|
"docstring": "Spec path template, e.g. `\"/users/me\"`."
|
|
},
|
|
"summary": {
|
|
"name": "summary",
|
|
"kind": "property",
|
|
"path": "react-openapi.ProfileRoute.summary",
|
|
"signature": "summary: string",
|
|
"docstring": "Human-readable summary, when present."
|
|
}
|
|
}
|
|
},
|
|
"ResourceConfig": {
|
|
"name": "ResourceConfig",
|
|
"kind": "interface",
|
|
"path": "react-openapi.ResourceConfig",
|
|
"signature": "ResourceConfig",
|
|
"docstring": "Fully resolved metadata for one resource, derived from the OpenAPI paths\nand schemas. This is the object every list/form/detail view is driven by.",
|
|
"members": {
|
|
"displayFormat": {
|
|
"name": "displayFormat",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.displayFormat",
|
|
"signature": "displayFormat: string",
|
|
"docstring": "Template used to render a row/item title (`x-display-format`)."
|
|
},
|
|
"displayName": {
|
|
"name": "displayName",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.displayName",
|
|
"signature": "displayName: string",
|
|
"docstring": "Human-friendly label used in navigation and titles."
|
|
},
|
|
"fields": {
|
|
"name": "fields",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.fields",
|
|
"signature": "fields: FieldConfig[]",
|
|
"docstring": "All fields, sorted by `x-order` then name."
|
|
},
|
|
"listColumns": {
|
|
"name": "listColumns",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.listColumns",
|
|
"signature": "listColumns: string[]",
|
|
"docstring": "Columns shown in the list view (`x-list-columns`)."
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.name",
|
|
"signature": "name: string",
|
|
"docstring": "Resource name (path segment), e.g. `\"expenses\"`."
|
|
},
|
|
"operations": {
|
|
"name": "operations",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.operations",
|
|
"signature": "operations: { create: boolean; delete: boolean; get: boolean; list: boolean; patch: boolean; update: boolean }",
|
|
"docstring": "Which CRUD operations the spec exposes."
|
|
},
|
|
"orderedFields": {
|
|
"name": "orderedFields",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.orderedFields",
|
|
"signature": "orderedFields: FieldConfig[]",
|
|
"docstring": "Fields in `fields` restricted to those with a defined order."
|
|
},
|
|
"pagination": {
|
|
"name": "pagination",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.pagination",
|
|
"signature": "pagination: null | { defaultLimit: number; limitParam: string; offsetParam: string }",
|
|
"docstring": "Pagination contract, or `null` when the collection is not paginated."
|
|
},
|
|
"parent": {
|
|
"name": "parent",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.parent",
|
|
"signature": "parent: { pathParam: string; resource: string }",
|
|
"docstring": "Set when this is a sub-resource (nested under a parent resource)."
|
|
},
|
|
"path": {
|
|
"name": "path",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.path",
|
|
"signature": "path: string",
|
|
"docstring": "Base API path for the collection, e.g. `\"/expenses\"`."
|
|
},
|
|
"primaryKey": {
|
|
"name": "primaryKey",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.primaryKey",
|
|
"signature": "primaryKey: string",
|
|
"docstring": "Primary-key property name (`x-primary-key`)."
|
|
},
|
|
"relationships": {
|
|
"name": "relationships",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.relationships",
|
|
"signature": "relationships: ResourceRelationship[]",
|
|
"docstring": "Foreign-key relationships for this resource."
|
|
},
|
|
"schemaName": {
|
|
"name": "schemaName",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.schemaName",
|
|
"signature": "schemaName: string",
|
|
"docstring": "Schema name used for display and lookups."
|
|
},
|
|
"streaming": {
|
|
"name": "streaming",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.streaming",
|
|
"signature": "streaming: boolean",
|
|
"docstring": "`true` when the collection is an `x-sse` event stream."
|
|
},
|
|
"subResources": {
|
|
"name": "subResources",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.subResources",
|
|
"signature": "subResources: string[]",
|
|
"docstring": "Names of nested sub-resources."
|
|
},
|
|
"updateMethod": {
|
|
"name": "updateMethod",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceConfig.updateMethod",
|
|
"signature": "updateMethod: \"put\" | \"patch\"",
|
|
"docstring": "Whether updates use `PUT` or `PATCH`."
|
|
}
|
|
}
|
|
},
|
|
"ResourceRelationship": {
|
|
"name": "ResourceRelationship",
|
|
"kind": "interface",
|
|
"path": "react-openapi.ResourceRelationship",
|
|
"signature": "ResourceRelationship",
|
|
"docstring": "A foreign-key relationship derived from a `x-fk` field, linking this\nresource to another resource.",
|
|
"members": {
|
|
"config": {
|
|
"name": "config",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceRelationship.config",
|
|
"signature": "config: FKFieldConfig",
|
|
"docstring": "Parsed `x-fk` configuration."
|
|
},
|
|
"fieldName": {
|
|
"name": "fieldName",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceRelationship.fieldName",
|
|
"signature": "fieldName: string",
|
|
"docstring": "Name of the FK field on this resource."
|
|
},
|
|
"targetSchemaName": {
|
|
"name": "targetSchemaName",
|
|
"kind": "property",
|
|
"path": "react-openapi.ResourceRelationship.targetSchemaName",
|
|
"signature": "targetSchemaName: string",
|
|
"docstring": "Name of the target resource schema."
|
|
}
|
|
}
|
|
},
|
|
"SpecConfiguration": {
|
|
"name": "SpecConfiguration",
|
|
"kind": "interface",
|
|
"path": "react-openapi.SpecConfiguration",
|
|
"signature": "SpecConfiguration",
|
|
"docstring": "Top-level configuration passed to `AppProvider`.\n\nDescribes where to load the OpenAPI document and how to talk to the API and\nauth server. See the README for the spec extensions react-openapi expects\n(`x-primary-key`, `x-display-format`, `x-list-columns`, `x-order`,\n`x-label`, `x-fk`, `x-sse`, `x-profile`, ...).",
|
|
"members": {
|
|
"baseApiUrl": {
|
|
"name": "baseApiUrl",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecConfiguration.baseApiUrl",
|
|
"signature": "baseApiUrl: string",
|
|
"docstring": "Base URL of the API; defaults to the spec's first `servers[].url`."
|
|
},
|
|
"getToken": {
|
|
"name": "getToken",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecConfiguration.getToken",
|
|
"signature": "getToken: null | string",
|
|
"docstring": "Called to obtain the current bearer token for API requests."
|
|
},
|
|
"profileComponents": {
|
|
"name": "profileComponents",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecConfiguration.profileComponents",
|
|
"signature": "profileComponents: ProfileComponents",
|
|
"docstring": "Components for `x-profile` operations (profile view/edit/create)."
|
|
},
|
|
"resourceConfig": {
|
|
"name": "resourceConfig",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecConfiguration.resourceConfig",
|
|
"signature": "resourceConfig: Record<string, ResourceConfiguration>",
|
|
"docstring": "Per-resource UI overrides keyed by resource name."
|
|
},
|
|
"specUrl": {
|
|
"name": "specUrl",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecConfiguration.specUrl",
|
|
"signature": "specUrl: string",
|
|
"docstring": "URL of the OpenAPI JSON/YAML document to load."
|
|
},
|
|
"title": {
|
|
"name": "title",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecConfiguration.title",
|
|
"signature": "title: string",
|
|
"docstring": "Overrides the app/site title shown in the layout."
|
|
}
|
|
}
|
|
},
|
|
"SpecExtensionDoc": {
|
|
"name": "SpecExtensionDoc",
|
|
"kind": "interface",
|
|
"path": "react-openapi.SpecExtensionDoc",
|
|
"signature": "SpecExtensionDoc",
|
|
"docstring": "Agent-facing index entry for one `x-` extension.\n\nThe behavioral documentation for each extension is in this file's module\ndocs (rendered onto the `specExtensions` export in the MCP bundle); this\narray is the machine-readable index of where each extension attaches and\nwhether it is required.",
|
|
"members": {
|
|
"example": {
|
|
"name": "example",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecExtensionDoc.example",
|
|
"signature": "example: string",
|
|
"docstring": "Minimal usage example."
|
|
},
|
|
"level": {
|
|
"name": "level",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecExtensionDoc.level",
|
|
"signature": "level: ExtensionLevel",
|
|
"docstring": "Where the extension attaches."
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecExtensionDoc.name",
|
|
"signature": "name: string",
|
|
"docstring": "Extension name including the `x-` prefix, e.g. `\"x-primary-key\"`."
|
|
},
|
|
"required": {
|
|
"name": "required",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecExtensionDoc.required",
|
|
"signature": "required: boolean",
|
|
"docstring": "`true` when the admin refuses to render the resource without it."
|
|
},
|
|
"value": {
|
|
"name": "value",
|
|
"kind": "property",
|
|
"path": "react-openapi.SpecExtensionDoc.value",
|
|
"signature": "value: string",
|
|
"docstring": "YAML value shape, e.g. `\"string\"`, `\"string[]\"`, `\"{ resource, prefetch }\"`."
|
|
}
|
|
}
|
|
},
|
|
"ExtensionLevel": {
|
|
"name": "ExtensionLevel",
|
|
"kind": "type-alias",
|
|
"path": "react-openapi.ExtensionLevel",
|
|
"signature": "ExtensionLevel: \"schema\" | \"property\" | \"path\" | \"operation\" | \"securityScheme\"",
|
|
"docstring": "Where an `x-` extension attaches in the OpenAPI document."
|
|
},
|
|
"FkResolver": {
|
|
"name": "FkResolver",
|
|
"kind": "type-alias",
|
|
"path": "react-openapi.FkResolver",
|
|
"signature": "FkResolver: Promise<any>",
|
|
"docstring": "Resolve a foreign-key wire value (e.g. an id) to the object to send.\n\n**Parameters:**\n\n- `resourceName` — The target resource name.\n- `fkValue` — The FK value to resolve.\n\n**Returns:**\n\nThe resolved object (or the original value when unresolved)."
|
|
},
|
|
"specExtensions": {
|
|
"name": "specExtensions",
|
|
"kind": "variable",
|
|
"path": "react-openapi.specExtensions",
|
|
"signature": "specExtensions: SpecExtensionDoc[]",
|
|
"docstring": "# OpenAPI `x-` extension catalog (canonical, agent-facing)\n\nThis export is the **canonical machine-readable reference** for every\nvendor extension `react-openapi` understands. Its docstring is rendered\nverbatim into the `react-openapi` MCP bundle by doc-weaver — agents\nbuilding or validating a spec should read it from\n`docs://modules/react-openapi` (object `specExtensions`) rather than\ninferring extensions from examples. The human-facing guide is the package\nREADME; the reference application is the standards sample (its\n`standards/src/templates/app/openapi.yaml` uses nearly every extension\nbelow).\n\n## How the spec drives the UI\n\n`AppProvider` loads the OpenAPI document at runtime, validates it, and —\nfor every schema carrying `x-resource` — derives a `ResourceConfig` from\nthe schema's properties and the matching paths. `Admin` then renders a\nsidebar, list/detail/form routes, FK dropdowns and SSE streams from those\nconfigs. No per-resource React code is required; adding a domain to the\nbackend surfaces it in the admin automatically.\n\n## Levels\n\nExtensions attach at five places: **schema** (on a `components.schemas`\nobject; marks a resource), **property** (inside a resource schema's\n`properties`), **path** (on a path item), **operation** (on an operation\nobject), and **securityScheme** (on the `bearerAuth` scheme).\n\n## Required vs optional / strictness\n\nA missing **required** extension is a spec **error**: the admin shows the\nvalidation screen and refuses to render the affected resource. Missing\noptional extensions degrade gracefully (defaults noted below). There are\nno fallbacks for required extensions and no flexible response parsing —\nthe spec is the contract and the admin throws at transform time when it is\nviolated.\n\n## Schema-level extensions\n\n- **`x-resource` (REQUIRED, string)** — marks a schema as an admin\n resource and names its collection path segment (`\"pets\"` maps to\n GET/POST `/pets`). Schemas without it are skipped entirely (use that for\n shared shapes like `Metadata` or error bodies). The value must match an\n existing path; the validator errors if missing.\n- **`x-primary-key` (REQUIRED, string)** — property that uniquely\n identifies a record; used as the `{id}` path parameter in every item\n request and as the FK wire value unless `x-fk.value` overrides it. Must\n reference a property that exists. Validator error if missing.\n- **`x-display-format` (REQUIRED, string template)** — template with\n `{propertyName}` placeholders rendered as the record's human label in\n list rows, detail titles and FK dropdown options, e.g. `\"{name} - #{id}\"`.\n Validator error if missing.\n- **`x-list-columns` (REQUIRED, string[])** — ordered property names shown\n as datatable columns; every entry must exist in `properties`. Cell\n display uses the target resource's `x-display-format` for FK fields and\n the parent resource's formatting for direct fields. Validator error if\n missing or invalid.\n\n## Property-level extensions\n\n- **`x-label` (REQUIRED, string)** — human-readable label for form fields,\n table headers and detail views. Required on every property of a resource\n schema; validator error if missing.\n- **`x-order` (REQUIRED, integer)** — field ordering in forms and detail\n views; lower first, ties broken alphabetically. Required (non-null) on\n every property; validator error if missing. List columns follow\n `x-list-columns`, not `x-order`.\n- **`x-description` (optional, string)** — helper text below form fields\n and placeholder text; falls back to `x-label`.\n- **`x-hidden` (optional, `{ form?, list?, detail? }`)** — per-view\n visibility; missing keys default to false (visible). Typical use: hide\n the auto-generated primary key from forms/lists.\n- **`x-filterable` (optional, boolean, default false)** — marks the field\n as filterable in the datatable filter bar.\n- **`x-sortable` (optional, boolean, default false)** — adds sort controls\n to the column header; clicking sends `?sort=field` (ascending) or\n `?sort=-field` (descending) to the list endpoint in server mode.\n- **`x-fk` (optional, `{ resource, prefetch?, value? }`)** — marks a\n `$ref` property as a foreign key. Non-array → `FkSelectField` (dropdown);\n array with `items.$ref` → `FkMultiSelectField` (multi-select). `resource`\n is the target's `x-resource` value (not the schema name) and must exist;\n the target must have `x-display-format` + `x-primary-key`. `prefetch=true`\n loads all options on mount, false (default) on focus. Options are fetched\n with `GET /{resource}?limit=0` for paginated targets (`limit=0` is the\n server convention for \"all records\") and formatted with the target's\n `x-display-format`. `value` names the wire-value property (defaults to\n the target's primary key). A `$ref` WITHOUT `x-fk` renders read-only\n inline (chips in list/detail, disabled JSON text field in forms).\n- **`x-edit-as` (optional, `\"date\"`)** — edit a date-time property with a\n plain date input; submits midnight of the chosen day.\n- **`x-ui-type` (optional, `\"image\" | \"currency\"`)** — `\"image\"` renders a\n file-upload form field with preview (Avatar in list/detail); with\n `x-upload-url` set and a record id present it POSTs the file there\n (`{id}` substituted) and stores the response URL, otherwise it falls back\n to an inline base64 data URL. `\"currency\"` renders a currency field (also\n settable per-field via `SpecConfiguration.resourceConfig.fieldTypes`).\n- **`x-upload-url` (optional, string path template)** — POST endpoint for\n `x-ui-type: image` uploads, e.g. `/pets/{id}/photo`.\n- **`x-upload` (optional, `{ type, url }`)** — generic file upload; the\n file is POSTed as raw `application/octet-stream` to `url` with a\n `Content-Disposition: attachment; filename=\"...\"` header; the response\n must contain a `saved_as` field which becomes the stored value. `type` is\n one of `image | pdf | html | csv | file` (Avatar vs clickable chip\n display, chip has delete/replace).\n- **`x-autocomplete` (optional, `\"text\" | \"token\" | \"email\" | \"phone\"`)** —\n server-side filter-bar widget hint for text-ish fields.\n\n## Path-level extensions\n\n- **`x-sse` (optional on a path item, boolean)** — marks a path as a\n Server-Sent Events stream. Excluded from CRUD derivation;\n `SseStreamView`/`useItemSse` connect with an EventSource and render the\n streaming resource's records as they arrive. The 200 response must be\n `text/event-stream`; give the event schema display metadata\n (`x-display-format`, `x-list-columns`, `x-primary-key`) so stream rows\n render like a list. Path parameters are supported\n (e.g. `/pets/{id}/actions`).\n\n## Operation-level extensions\n\n- **`x-profile` (optional on an operation, boolean)** — marks a profile\n (current-user) operation. `ProfileRoutes` renders the matching component\n from `SpecConfiguration.profileComponents` by mode: GET → view,\n PUT/PATCH → edit, POST → create.\n\n## securityScheme extensions (auth-server wiring)\n\nCarried on the `bearerAuth` scheme and extracted into `AuthConfig`; the\nbackend may template values from environment (e.g. `\"{AUTH_SERVER}\"`) and\nresolve them before serving the spec. Pair with `@aetoskia/react-auth`.\n\n- **`x-server-url`** — auth-server base URL (`AuthConfig.serverUrl`).\n- **`x-login-path`** — login endpoint path.\n- **`x-register-path`** — registration endpoint path.\n- **`x-logout-path`** — logout endpoint path.\n- **`x-me-path`** — current-user endpoint path (react-auth fetches the\n session user from it whenever the token changes).\n- **`x-introspect-path`** — token-introspection endpoint path.\n\n## Path conventions\n\nFor every schema with `x-resource: <r>` the spec MUST provide:\n`GET /<r>` (list — populates the datatable), `POST /<r>` (create),\n`GET /<r>/{id}` (detail), `PUT` or `PATCH /<r>/{id}` (edit — PATCH is\nhonored when present), and `DELETE /<r>/{id}` (delete).\n\n## Response conventions (strict — no fallbacks)\n\n- **Paginated list** (collection GET has BOTH `limit` and `offset` query\n params): body MUST be `{ total?, items: [] }`. `total` is optional\n (falls back to `items.length`); `items` is required and must be an\n array; anything else throws.\n- **Non-paginated list**: body MUST be a bare JSON array.\n- **Single item / create / update**: the resource object directly.\n- **Delete**: HTTP 204, no body.\n- **Errors**: FastAPI 422 arrays of `{ loc, msg, type }` (each `msg`\n rendered) or generic `{ detail: string }`.\n\n## Pagination conventions\n\nA resource is paginated iff its collection GET has both `limit` and\n`offset`, and `limit` MUST declare `schema.default` (e.g. 20). The\ndatatable then sends `?limit={rowsPerPage}&offset={page * rowsPerPage}`.\nFK option loading requests `?limit=0` on paginated targets — a server\nconvention meaning \"return all records\" (implement it, e.g. in the list\nhandler's pagination helper).\n\n## Validation rules (spec-validator.ts, in order)\n\n1. `x-primary-key` present. 2. `x-display-format` present.\n3. `x-list-columns` is an array of existing property names. 4. Every\nproperty has `x-label`. 5. Every property has `x-order`. 6. `$ref` without\n`x-fk` → info (read-only inline). 7. `x-fk.resource` matches some schema's\n`x-resource` and that target has `x-display-format` + `x-primary-key`.\n8. The `x-resource` path exists in `paths`. 9. Collection path has GET and\nPOST. 10. Item path has GET, PUT (or PATCH) and DELETE. 11. Paginated\ncollections declare `schema.default` on `limit`. Errors block rendering of\nthe affected resource; warnings/infos render alongside.\n\n## Index\n\nThe array value of this export is the machine-readable index (name, level,\nrequired, value shape, example) of the extensions documented above."
|
|
},
|
|
"Admin": {
|
|
"name": "Admin",
|
|
"kind": "component",
|
|
"path": "react-openapi.Admin",
|
|
"signature": "Admin(__namedParameters: AdminProps): React.JSX.Element",
|
|
"docstring": "Root admin UI driven entirely by the loaded OpenAPI spec.\r\n\r\nReads resources from `useAppContext` and renders a `Layout` with a\r\n`SideMenu` plus nested routes per resource:\r\n`/<basePath>/<resource>` (list), `/<resource>/new` (create),\r\n`/<resource>/:id` (detail) and `/<resource>/:id/edit`. Streaming (`x-sse`)\r\nresources render only the list. While the spec is loading it shows a\r\nspinner; spec validation errors are shown via `ValidationAlert`; warnings\r\nare shown as a dismissible alert above the layout.\r\n\r\nNotes:\r\n- Must be rendered inside an `AppProvider` and a router.\r\n- The index route redirects to the first top-level resource.\r\n\r\nProps: see `AdminProps`.\n\n**Example:**\n\n```tsx\r\n<Route path=\"/admin/*\" element={<Admin basePath=\"/admin\" />} />\r\n```"
|
|
},
|
|
"applyDisplayFormat": {
|
|
"name": "applyDisplayFormat",
|
|
"kind": "function",
|
|
"path": "react-openapi.applyDisplayFormat",
|
|
"signature": "applyDisplayFormat(item: any, format: string): string",
|
|
"docstring": "Render an item through a `{prop}` display template.\r\n\r\nReplaces each `{a.b}` placeholder with the (dot-path) nested value, formatted\r\nwith `formatIsoLike`. Non-object `item`s are stringified directly.\n\n**Parameters:**\n\n- `item` — The record to format.\n- `format` — Template such as `\"{first_name} {last_name}\"`.\n\n**Returns:**\n\nThe formatted string."
|
|
},
|
|
"AppProvider": {
|
|
"name": "AppProvider",
|
|
"kind": "component",
|
|
"path": "react-openapi.AppProvider",
|
|
"signature": "AppProvider(__namedParameters: AppProviderProps): React.FunctionComponentElement<React.ProviderProps<null | AppContextValue>>",
|
|
"docstring": "Load an OpenAPI spec and provide the derived app model to the tree.\r\n\r\nOn mount (and whenever `specConfiguration.specUrl` changes) it:\r\n1. Loads the spec (`loadSpec`).\r\n2. Validates it (`validateSpec`), collecting `errors` and `warnings`.\r\n3. If there are no errors, builds `resources` (`buildResourceConfigs`),\r\n applies per-resource `fieldTypes` overrides, and initializes the shared\r\n axios client via `initApi(baseApiUrl, getToken)`.\r\n\r\nIt also derives `authConfig` (from `securitySchemes.bearerAuth` `x-*`\r\nextensions) and `profileOperations` (operations flagged `x-profile: true`),\r\nand exposes everything through `AppContext` for `useAppContext`, `Admin`,\r\nand `ProfileRoutes`.\r\n\r\nNotes:\r\n- Must wrap any component that uses `useAppContext`, `Admin`, `useResource`\r\n or the profile screens.\r\n- Base API URL precedence: `specConfiguration.baseApiUrl`, then the spec's\r\n first `servers[].url`.\r\n\r\nProps: `specConfiguration` (see `SpecConfiguration`) and `children`.\n\n**Example:**\n\n```tsx\r\n<AppProvider specConfiguration={{ specUrl: \"/openapi.json\" }}>\r\n <Admin basePath=\"/admin\" />\r\n</AppProvider>\r\n```"
|
|
},
|
|
"CurrencyField": {
|
|
"name": "CurrencyField",
|
|
"kind": "component",
|
|
"path": "react-openapi.CurrencyField",
|
|
"signature": "CurrencyField(__namedParameters: CurrencyFieldProps): React.JSX.Element",
|
|
"docstring": "Display a monetary amount as tabular-numeral text, colored red when negative\r\nand green otherwise.\r\n\r\nProps:\r\n- `value` - the amount to display.\r\n- `currency` - ISO code (see `formatCurrency`); defaults to INR.\r\n- `large` - use a slightly larger font (for detail views)."
|
|
},
|
|
"DetailFieldRenderer": {
|
|
"name": "DetailFieldRenderer",
|
|
"kind": "component",
|
|
"path": "react-openapi.DetailFieldRenderer",
|
|
"signature": "DetailFieldRenderer(__namedParameters: DetailFieldProps): null | React.JSX.Element",
|
|
"docstring": "Render a labeled field in the detail view.\r\n\r\nFields hidden in detail render nothing. Currency values use `CurrencyField`\r\n(large), images render as a rounded avatar with the resolved media URL, and\r\nall other types delegate to `ListCellRenderer`.\r\n\r\nProps:\r\n- `field` - the field metadata to render.\r\n- `value` - the raw field value.\r\n- `displayFormat` - optional `{prop}` template for object values.\r\n- `basePath` - admin base path used to build FK navigation links."
|
|
},
|
|
"extractFields": {
|
|
"name": "extractFields",
|
|
"kind": "function",
|
|
"path": "react-openapi.extractFields",
|
|
"signature": "extractFields(schemaName: string, schema: any, schemas: Record<string, any>): FieldConfig[]",
|
|
"docstring": "Convert an OpenAPI schema's properties into `FieldConfig` objects.\r\n\r\nReads the react-openapi spec extensions (`x-label`, `x-description`,\r\n`x-order`, `x-hidden`, `x-filterable`, `x-sortable`, `x-ui-type`,\r\n`x-upload-url`, `x-upload`, `x-autocomplete`, `x-fk`, `x-edit-as`) and\r\nresolves `$ref`/array-of-`$ref`/`oneOf` properties into inline-ref metadata\r\n(`refSchema`, `inlineDisplayFormat`) or, for discriminated unions,\r\n`oneOfOptions` + `discriminatorProperty`. Enum values are lifted from array\r\nitems so arrays-of-enum render as multi-selects. Plain filterable strings\r\ndefault to the `\"text\"` autocomplete (with a warning); an `x-autocomplete`\r\non a non-filterable field records a validation error.\n\n**Parameters:**\n\n- `schemaName` — Schema name (used in diagnostics).\n- `schema` — The schema object whose `properties` are read.\n- `schemas` — The spec's `components.schemas` (for `$ref` resolution).\n\n**Returns:**\n\nThe resolved fields, in `properties` order."
|
|
},
|
|
"FkMultiSelectField": {
|
|
"name": "FkMultiSelectField",
|
|
"kind": "component",
|
|
"path": "react-openapi.FkMultiSelectField",
|
|
"signature": "FkMultiSelectField(__namedParameters: Props): React.JSX.Element",
|
|
"docstring": "Multi-select input for array foreign-key (`x-fk`) fields.\r\n\r\nBacked by an MUI `Autocomplete` over `fkOptions`; selected values are matched\r\nagainst the option list and emitted as an array of option values. On open it\r\ncalls `onOpen` (for lazy FK loading) and freezes the current selection so\r\nalready-picked options sort first. Only one chip is shown inline (plus a\r\n`+N` chip) to keep the row compact; `loading` reflects `fkLoading`.\r\n\r\nProps:\r\n- `field` - the field metadata (label, description, readOnly).\r\n- `value` - the current array of selected FK values.\r\n- `onChange` - called with the new array of values.\r\n- `fkOptions` - available `{ value, label }` options.\r\n- `fkLoading` - whether options are still loading.\r\n- `onOpen` - invoked when the dropdown opens (triggers lazy load)."
|
|
},
|
|
"formatCurrency": {
|
|
"name": "formatCurrency",
|
|
"kind": "function",
|
|
"path": "react-openapi.formatCurrency",
|
|
"signature": "formatCurrency(amount: number, currency?: string): string",
|
|
"docstring": "Format an amount as a currency string using the `en-IN` locale.\r\n\r\nFalls back to `INR` when `currency` is missing or unsupported. Only the\r\nmagnitude is formatted (the sign is handled by the caller). Formatters are\r\ncached per currency code.\n\n**Parameters:**\n\n- `amount` — The numeric amount (sign is ignored).\n- `currency` — ISO code; one of INR/USD/EUR/GBP/AED/SGD, else INR.\n\n**Returns:**\n\nThe formatted currency string, e.g. `₹1,234.50`."
|
|
},
|
|
"formatDate": {
|
|
"name": "formatDate",
|
|
"kind": "function",
|
|
"path": "react-openapi.formatDate",
|
|
"signature": "formatDate(value: any): string",
|
|
"docstring": "\"2026-08-24\" -> \"24 Aug 2026\"; non-ISO values pass through."
|
|
},
|
|
"formatDateTime": {
|
|
"name": "formatDateTime",
|
|
"kind": "function",
|
|
"path": "react-openapi.formatDateTime",
|
|
"signature": "formatDateTime(value: any): string",
|
|
"docstring": "\"2026-08-24T09:07:25\" -> \"24 Aug 2026, 09:07\"; non-ISO values pass through."
|
|
},
|
|
"FormFieldRenderer": {
|
|
"name": "FormFieldRenderer",
|
|
"kind": "component",
|
|
"path": "react-openapi.FormFieldRenderer",
|
|
"signature": "FormFieldRenderer(__namedParameters: FormFieldProps): null | React.JSX.Element",
|
|
"docstring": "Choose and render the correct input control for a form field.\r\n\r\nDispatch order: upload -> `FileUploadField`; read-only (non-image) -> text;\r\nimage -> `ImageField`; FK array -> `FkMultiSelectField`; FK single ->\r\n`FkSelectField`; enum array -> `MultiEnumField`; enum -> select; boolean ->\r\ntoggle; currency/number/integer -> numeric input; date/date-time ->\r\n`DateField`; discriminated union -> `DiscriminatorField`; inline ref ->\r\n`JsonField`; otherwise a plain text field. Fields hidden in the form render\r\nnothing.\r\n\r\nProps:\r\n- `field` - the field metadata to render.\r\n- `value` - the current form value.\r\n- `onChange` - called with the new value.\r\n- `error` - validation error to display, if any.\r\n- `fkOptions`, `fkLoading`, `onFkOpen` - FK select options, loading state and\r\n lazy loader (for `x-fk` fields).\r\n- `recordId` - record id used by image upload fields."
|
|
},
|
|
"getApi": {
|
|
"name": "getApi",
|
|
"kind": "function",
|
|
"path": "react-openapi.getApi",
|
|
"signature": "getApi(): AxiosInstance",
|
|
"docstring": "Get the shared axios client initialized by `AppProvider` / `initApi`.\r\n\r\nUse this anywhere you need to talk to the API (the CRUD helpers in\r\n`useResource` already do). Prefer it over a fresh axios instance so the base\r\nURL, auth header and `401` handling are consistent.\n\n**Returns:**\n\nThe shared `AxiosInstance`.\n\n**Throws:**\n\nIf the client has not been initialized (i.e. `AppProvider` has not\r\nmounted with a valid `baseApiUrl`/`servers[].url`).\n\n**Example:**\n\n```ts\r\nconst rows = await getApi().get(\"/expenses\");\r\n```"
|
|
},
|
|
"ListCellRenderer": {
|
|
"name": "ListCellRenderer",
|
|
"kind": "component",
|
|
"path": "react-openapi.ListCellRenderer",
|
|
"signature": "ListCellRenderer(__namedParameters: ListCellProps): React.JSX.Element",
|
|
"docstring": "Render one field value inside a list table cell.\r\n\r\nHandles every `FieldConfig` shape: `—` for `null`/`undefined`, inline\r\n(non-FK) objects via `InlineRefField`, clickable FK chips that navigate to\r\nthe referenced record, chip lists for FK arrays, enum chips, image avatars\r\nwith resolved media URLs, boolean Yes/No chips, currency via `CurrencyField`,\r\nand date/date-time formatting. Arrays of inline refs render chips that open a\r\ndialog listing the item's fields.\r\n\r\nProps:\r\n- `field` - the field metadata to render.\r\n- `value` - the raw cell value.\r\n- `displayFormat` - optional `{prop}` template for object values.\r\n- `basePath` - admin base path used to build FK navigation links."
|
|
},
|
|
"MultiEnumField": {
|
|
"name": "MultiEnumField",
|
|
"kind": "component",
|
|
"path": "react-openapi.MultiEnumField",
|
|
"signature": "MultiEnumField(__namedParameters: Props): React.JSX.Element",
|
|
"docstring": "Multi-select input for array enums (`type: array` of `enum`), backed by an\r\nMUI `Autocomplete`. Selects from `field.enumValues`, shows the current\r\nselection as chips, and is disabled when the field is read-only.\r\n\r\nProps:\r\n- `field` - the field metadata (label, description, `enumValues`, readOnly).\r\n- `value` - the current array value.\r\n- `onChange` - called with the new array of selected values.\r\n- `error` - validation error to display, if any."
|
|
},
|
|
"ProfileRoutes": {
|
|
"name": "ProfileRoutes",
|
|
"kind": "component",
|
|
"path": "react-openapi.ProfileRoutes",
|
|
"signature": "ProfileRoutes(): null | React.JSX.Element",
|
|
"docstring": "Render the current user's profile screen.\r\n\r\nResolves the profile operation from the spec and renders the configured\r\n`profileComponents.view` or `profileComponents.edit` component, wrapping it\r\nwith data fetching and submit handling. Only `/profile/me` and\r\n`/profile/me/edit` are valid; any other `/:username` redirects to `/me`.\r\nThe view operation is a `GET`; edit uses `PUT`/`PATCH`.\r\n\r\nNotes:\r\n- Renders nothing when no matching operation or component is configured.\r\n- Must be inside an `AppProvider` and a router.\n\n**Example:**\n\n```tsx\r\n<Route path=\"/profile/*\" element={<ProfileRoutes />} />\r\n```"
|
|
},
|
|
"sanitizePayload": {
|
|
"name": "sanitizePayload",
|
|
"kind": "function",
|
|
"path": "react-openapi.sanitizePayload",
|
|
"signature": "sanitizePayload(data: any, fields: FieldConfig[], schemas: Record<string, any>, resolveFk?: FkResolver): Promise<any>",
|
|
"docstring": "Normalize a form payload into the shape the API expects.\r\n\r\nRecursively walks `data` against `fields` and:\r\n- resolves FK fields without an `x-fk.value` (id -> object), mapping `null`/\r\n `\"\"` to `null` (or resolving each element for FK arrays);\r\n- recurses into inline (`refSchema`) objects using the referenced schema's\r\n fields, mapping empty values to `{}` or `[]`;\r\n- maps empty array fields to `[]` and empty object fields to `{}`.\r\n\r\nFields not present in `fields` are copied through untouched.\n\n**Parameters:**\n\n- `data` — The raw form value (object or array).\n- `fields` — Field metadata for the current level.\n- `schemas` — The spec's `components.schemas` (for inline-ref recursion).\n- `resolveFk` — Resolves FK values to objects (defaults to identity).\n\n**Returns:**\n\nA new, normalized payload.\n\n**Example:**\n\n```ts\r\nconst body = await sanitizePayload(form, resource.fields, schemas, resolveFk);\r\n```"
|
|
},
|
|
"SseConnectionStatus": {
|
|
"name": "SseConnectionStatus",
|
|
"kind": "component",
|
|
"path": "react-openapi.SseConnectionStatus",
|
|
"signature": "SseConnectionStatus(__namedParameters: SseConnectionStatusProps): React.JSX.Element",
|
|
"docstring": "Small \"Connected\"/\"Disconnected\" pill bound to a resource's SSE state.\r\n\r\nProps:\r\n- `resourceName` - the resource whose connection state to display."
|
|
},
|
|
"SseStreamView": {
|
|
"name": "SseStreamView",
|
|
"kind": "component",
|
|
"path": "react-openapi.SseStreamView",
|
|
"signature": "SseStreamView(__namedParameters: SseStreamViewProps): React.JSX.Element",
|
|
"docstring": "Live view of an `x-sse` streaming resource.\r\n\r\nSubscribes to the resource's event stream (via `useResource().stream`),\r\nstamps each event with `_received_at`/`_seq`, appends it to the shared SSE\r\ncache, and shows a snackbar with the formatted event. Renders the connection\r\nstatus, a running event count, and the latest event's formatted text;\r\nshows \"Waiting for events…\" until the first event arrives. Cached events\r\nare restored on mount; the connection flag is reset on unmount.\r\n\r\nProps:\r\n- `resource` - the `ResourceConfig` to stream (must be `streaming`).\r\n- `pathParams` - values to substitute into `{param}` path templates."
|
|
},
|
|
"useAppContext": {
|
|
"name": "useAppContext",
|
|
"kind": "hook",
|
|
"path": "react-openapi.useAppContext",
|
|
"signature": "useAppContext(): AppContextValue",
|
|
"docstring": "Read the app context.\n\n**Returns:**\n\nThe loaded spec state: `config`, `resources`, `profileOperations`,\r\n`profileComponents`, `authConfig`, `schemas`, `loading`, `errors` and\r\n`warnings`.\n\n**Throws:**\n\nIf called outside of an `AppProvider`.\n\n**Example:**\n\n```tsx\r\nconst { resources, loading, errors } = useAppContext();\r\n```"
|
|
},
|
|
"useFkFieldOptions": {
|
|
"name": "useFkFieldOptions",
|
|
"kind": "hook",
|
|
"path": "react-openapi.useFkFieldOptions",
|
|
"signature": "useFkFieldOptions(fields: FieldConfig[]): { fkLoading: Record<string, boolean>; fkOptions: Record<string, FkOption[]>; loadFkOnOpen: void }",
|
|
"docstring": "Loads select options for foreign-key (`x-fk`) fields in a field set.\r\n\r\nOption values bind to the target's `x-fk.value` property when set (e.g.\r\naccount names), otherwise to the target resource's primary key. Fields with\r\n`fk.prefetch === true` load immediately; others load on demand through the\r\nreturned `loadFkOnOpen`. Options are cached per field name.\r\n\r\nNotes:\r\n- For a paginated target it requests `?limit=0` and expects `{ items }`;\r\n for a non-paginated target it expects a bare array.\r\n- Invalid responses and request errors are swallowed, leaving the field\r\n without suggestions.\n\n**Parameters:**\n\n- `fields` — The field set to scan for `x-fk` relationships.\n\n**Returns:**\n\n`fkOptions` (per field name), `fkLoading` (per field name) and\r\n`loadFkOnOpen(fieldName)`.\n\n**Example:**\n\n```tsx\r\nconst { fkOptions, fkLoading, loadFkOnOpen } = useFkFieldOptions(resource.fields);\r\n```"
|
|
},
|
|
"useItemSse": {
|
|
"name": "useItemSse",
|
|
"kind": "hook",
|
|
"path": "react-openapi.useItemSse",
|
|
"signature": "useItemSse(url: null | string, handlers: ItemSseHandlers): ItemSseResult",
|
|
"docstring": "Subscribe to a Server-Sent Events (SSE) stream for a single item.\r\n\r\nOpens an `EventSource` for `url` (resolved against the shared API base URL)\r\nand pushes each parsed JSON message onto `events`. Connection state is\r\nexposed via `connected`. Pass `null` to disable the subscription; the socket\r\nis closed and `connected` reset on unmount or when `url` changes. Malformed\r\nJSON payloads are ignored.\n\n**Parameters:**\n\n- `url` — Absolute-from-base path of the stream, or `null` to disable.\n- `handlers` — `onEvent` (per message), plus optional `onOpen`/`onError`.\n\n**Returns:**\n\n`{ connected, events }` for the active subscription.\n\n**Example:**\n\n```tsx\r\nconst { connected, events } = useItemSse(`/tasks/${id}/events`, {\r\n onEvent: (e) => console.log(e),\r\n});\r\n```"
|
|
},
|
|
"useResource": {
|
|
"name": "useResource",
|
|
"kind": "hook",
|
|
"path": "react-openapi.useResource",
|
|
"signature": "useResource(resourceName: string): UseResourceReturn",
|
|
"docstring": "Resource-scoped CRUD helpers and filter-widget factory for one resource.\r\n\r\nResolves the resource by name from the app context and returns:\r\n- `resource` - the resolved `ResourceConfig` (or `null` until loaded).\r\n- `components` - a map of field name -> filter component. The widget is\r\n chosen by field shape (boolean, FK, enum, number, date, inline-ref, or, via\r\n `field.autocomplete`, text/token/email/phone). In `client` filter mode\r\n option suggestions derive from `data`; in `server` mode FK/ref options are\r\n fetched (FK options are cached globally per target resource).\r\n- `list`, `get`, `create`, `update`, `remove` - CRUD via the shared axios\r\n client. `create`/`update` run `sanitizePayload` (resolving FK ids to\r\n objects). `patch` is present only when the spec exposes a PATCH operation.\r\n- `stream` - subscribe to an `x-sse` stream via `EventSource`, resolving\r\n `{pathParams}`; present only for streaming resources.\r\n- `loading` / `error` - request state (`error` parsed from the response\r\n body: an array of `{msg}` errors, a `detail` string, or `message`).\r\n\r\nNotes:\r\n- `list`/`get` accept both a bare array and `{ total, items }`; paginated\r\n resources require the latter.\r\n- Methods throw (and set `error`) when the resource is not loaded yet.\n\n**Parameters:**\n\n- `resourceName` — The resource name (URL path segment) to bind to.\n\n**Returns:**\n\nThe bound resource, CRUD methods, filter `components`, streaming\r\nsubscription and request state.\n\n**Example:**\n\n```tsx\r\nconst { resource, list, create } = useResource(\"expenses\");\r\n```"
|
|
}
|
|
}
|
|
}
|
|
}
|