@edoc-space/plugin-openapi
v1.0.0
Published
OpenAPI reference component for E-Doc MDX pages.
Maintainers
Readme
@edoc-space/plugin-openapi
OpenAPI reference component for E-Doc MDX pages.
Use it when a documentation page needs to render an OpenAPI JSON specification without writing the endpoint list by hand.
Installation
Install the plugin into the E-Doc local plugin overlay, not into the core application package:
cd local/plugins
yarn add @edoc-space/plugin-openapiOr with npm:
cd local/plugins
npm install @edoc-space/plugin-openapiUsage
Put the specification into local/storage/edoc/static, for example:
local/storage/edoc/static/openapi.jsonThen import the component from an .mdx page:
import { OpenApi } from '@edoc-space/plugin-openapi'
<OpenApi source="/storage/edoc/static/openapi.json" />The package imports its CSS from the entrypoint. E-Doc resolves the package from local/plugins/node_modules.
You can also pass operations directly:
<OpenApi
title="Project API"
operations={[
{
method: 'get',
path: '/users',
summary: 'List users',
tags: ['Users'],
responses: {
'200': { description: 'User list' },
},
},
]}
/>Props
type OpenApiProps = {
title?: string;
source?: string;
operations?: OpenApiOperation[];
groupBy?: 'tag' | 'none';
showSearch?: boolean;
defaultExpanded?: boolean;
};Local Development
This repository uses the same package shape as the published npm package:
yarn install
yarn typecheck
yarn build
npm pack --dry-runBefore publishing, make sure the dry-run output contains only dist, README.md, README_RU.md, LICENSE, and package metadata.
