OpenAPI: Change default value of per to operation

This commit is contained in:
fuma-nama
2024-08-13 18:06:51 +08:00
parent 6a11e7cd81
commit 70172f1f28
4 changed files with 11 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': minor
---
Change default value of `per` to `operation`
@@ -46,7 +46,7 @@ void generateFiles({
### Per
Customise how the page is generated, default to `file`.
Customise how the page is generated, default to `operation`.
| mode | Generate a page for |
| --------- | ----------------------------------- |
@@ -185,7 +185,7 @@ import { createOpenAPI } from 'fumadocs-openapi/server';
export const openapi = createOpenAPI({
renderer: {
Root(props, child) {
Root(props) {
// your own (server) component
},
},
+3 -3
View File
@@ -17,10 +17,10 @@ export interface Config extends GenerateOptions {
/**
* tag: Generate a page for each tag
*
* file: Generate a page for each schema
* operation: Generate a page for each API endpoint/operation
*
* @defaultValue file
* @defaultValue 'operation'
*/
per?: 'tag' | 'file' | 'operation';
@@ -50,7 +50,7 @@ export async function generateFiles(options: Config): Promise<void> {
input,
output,
name: nameFn,
per = 'file',
per = 'operation',
groupBy = 'none',
cwd = process.cwd(),
} = options;
+1
View File
@@ -66,6 +66,7 @@ describe('Generate documents', () => {
await generateFiles({
input: ['./fixtures/*.yaml'],
output: './out',
per: 'file',
cwd,
});