Closed MeowningMaster closed 1 year ago
Why don't you work on one?
It's difficult for me to find free time now. But maybe later I do
Here's my code, adapted from @Fdawgs comment
docs/index.ts
// const { docsGetSchema } = require('./schema');
import { getDocsSchema } from './schemas';
export const DocsController = (context, _opts, done) => {
context.register(require('@fastify/static'), {
root: __dirname,
serve: false,
});
context.get('/', getDocsSchema, (req, res) => {
res.header('cache-control', 'public, max-age=300');
res.removeHeader('pragma');
res.removeHeader('expires');
res.removeHeader('surrogate-control');
res.type('text/html; charset=utf-8');
res.sendFile('index.html');
});
done();
};
- Create a file in /docs/index.html and copy the html code from https://redocly.com/docs/redoc/quickstart/
- Change spec-url to to /docs/json
Prerequisites
🚀 Feature Proposal
Separating the spec generation from the UI was a great idea! Are there plans to add a plugin with Redoc UI?
Motivation
It's open source and has basic support for OpenAPI 3.1 which fits very well in fastify/typebox/Ajv stack.
Example
No response