Skip to content

Commit

Permalink
fix: allow grouping for plugin-oas
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhulle committed Jan 15, 2025
1 parent 2454d78 commit cd539c4
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 353 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-dancers-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kubb/plugin-oas": patch
---

allow `grouping`
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ title: Changelog

## 3.5.1
- [`core`](/plugins/core): build of `@kubb/core` with correct types
- [`plugin-oas`](/plugins/plugin-oas): allow `grouping`

## 3.5.0
- [`core`](/plugins/core): support banner with context for Oas
Expand Down
24 changes: 24 additions & 0 deletions docs/plugins/plugin-oas/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,30 @@ Add a footer text at the end of every file.
| Type: | `string \| (oas: Oas) => string` |
| Required: | `false` |


### group
<!--@include: ../core/group.md-->

#### group.type
Define a type where to group the files on.

| | |
|----------:|:--------|
| Type: | `'tag'` |
| Required: | `true` |

<!--@include: ../core/groupTypes.md-->

#### group.name

Return the name of a group based on the group name, this will be used for the file and name generation.

| | |
|----------:|:------------------------------------|
| Type: | `(context: GroupContext) => string` |
| Required: | `false` |
| Default: | `(ctx) => '${ctx.group}Controller'` |

### validate

Validate your [`input`](/getting-started/configure#input) based on `@readme/openapi-parser`.
Expand Down
7 changes: 6 additions & 1 deletion examples/advanced/configs/kubb.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ export default defineConfig(() => {
done: ['npm run typecheck', 'biome format --write ./', 'biome lint --apply-unsafe ./src'],
},
plugins: [
pluginOas({ validate: true }),
pluginOas({
validate: true,
}),
pluginOas({
output: {
path: 'schemas2',
},
group: {
type: 'tag',
},
validate: false,
}),
pluginRedoc(),
Expand Down
Loading

0 comments on commit cd539c4

Please sign in to comment.