Skip to content

Commit

Permalink
Support void as unknownType
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorcamachoo committed Feb 25, 2025
1 parent 7603554 commit 64d83d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/plugin-oas/src/SchemaGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {

export type SchemaGeneratorOptions = {
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date'
unknownType: 'any' | 'unknown'
unknownType: 'any' | 'unknown' | 'void'
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'
enumSuffix?: string
usedEnumNames?: Record<string, number>
Expand Down Expand Up @@ -260,6 +260,9 @@ export class SchemaGenerator<
if (options.unknownType === 'any') {
return schemaKeywords.any
}
if (options.unknownType === 'void') {
return schemaKeywords.void
}

return schemaKeywords.unknown
}
Expand Down
2 changes: 2 additions & 0 deletions packages/plugin-oas/src/SchemaMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export type SchemaKeywordMapper = {
null: { keyword: 'null' }
any: { keyword: 'any' }
unknown: { keyword: 'unknown' }
void: { keyword: 'void' }
blob: { keyword: 'blob' }
schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }
name: { keyword: 'name'; args: string }
Expand Down Expand Up @@ -110,6 +111,7 @@ export const schemaKeywords = {
email: 'email',
uuid: 'uuid',
url: 'url',
void: 'void',
/* intersection */
default: 'default',
const: 'const',
Expand Down

0 comments on commit 64d83d1

Please sign in to comment.