@kubb/plugin-oas 4.10.1 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SchemaGenerator-C2Rqz6y8.cjs → SchemaGenerator-BEyE5yFD.cjs} +6 -6
- package/dist/{SchemaGenerator-C2Rqz6y8.cjs.map → SchemaGenerator-BEyE5yFD.cjs.map} +1 -1
- package/dist/{SchemaGenerator-g4VcV8ci.js → SchemaGenerator-Bzj3I5Yv.js} +6 -6
- package/dist/{SchemaGenerator-g4VcV8ci.js.map → SchemaGenerator-Bzj3I5Yv.js.map} +1 -1
- package/dist/{SchemaMapper-BUV8vhg0.cjs → SchemaMapper-BN2pgCUs.cjs} +1 -1
- package/dist/{SchemaMapper-BUV8vhg0.cjs.map → SchemaMapper-BN2pgCUs.cjs.map} +1 -1
- package/dist/{SchemaMapper-GAIl5QsJ.js → SchemaMapper-eCHsqfmg.js} +1 -1
- package/dist/{SchemaMapper-GAIl5QsJ.js.map → SchemaMapper-eCHsqfmg.js.map} +1 -1
- package/dist/{generators--9_lTBjl.cjs → generators--YV0NNUJ.cjs} +2 -2
- package/dist/{generators--9_lTBjl.cjs.map → generators--YV0NNUJ.cjs.map} +1 -1
- package/dist/{generators-BoBhVZzp.js → generators-Cw71XBIe.js} +2 -2
- package/dist/{generators-BoBhVZzp.js.map → generators-Cw71XBIe.js.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.js +1 -1
- package/dist/{getFooter-fhkUhUdk.js → getFooter-C2vyr3vj.js} +2 -2
- package/dist/{getFooter-fhkUhUdk.js.map → getFooter-C2vyr3vj.js.map} +1 -1
- package/dist/{getFooter-BWck5e2D.cjs → getFooter-D-b_lr3d.cjs} +2 -2
- package/dist/{getFooter-BWck5e2D.cjs.map → getFooter-D-b_lr3d.cjs.map} +1 -1
- package/dist/{getSchemas-BTCpbjet.cjs → getSchemas-DdrlFGPi.cjs} +1 -1
- package/dist/{getSchemas-BTCpbjet.cjs.map → getSchemas-DdrlFGPi.cjs.map} +1 -1
- package/dist/{getSchemas-CyMcV4aw.js → getSchemas-XWPSn2uf.js} +1 -1
- package/dist/{getSchemas-CyMcV4aw.js.map → getSchemas-XWPSn2uf.js.map} +1 -1
- package/dist/hooks.cjs +2 -2
- package/dist/hooks.js +2 -2
- package/dist/index.cjs +74 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.js +73 -5
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +37 -4
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.js +37 -4
- package/dist/mocks.js.map +1 -1
- package/dist/utils.cjs +3 -3
- package/dist/utils.js +3 -3
- package/package.json +3 -3
- package/src/createParser.ts +141 -0
- package/src/index.ts +2 -0
- package/src/mocks/schemas.ts +53 -3
package/dist/mocks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","names":["basic: Array<{ name: string; schema: Schema }>","full: Array<{ name: string; schema: Schema[] }>"],"sources":["../src/mocks/schemas.ts"],"sourcesContent":["import { type Schema, schemaKeywords } from '../SchemaMapper'\n\nconst basic: Array<{ name: string; schema: Schema }> = [\n {\n name: 'any',\n schema: {\n keyword: schemaKeywords.any,\n },\n },\n {\n name: 'unknown',\n schema: {\n keyword: schemaKeywords.unknown,\n },\n },\n {\n name: 'string',\n schema: {\n keyword: schemaKeywords.string,\n },\n },\n {\n name: 'number',\n schema: {\n keyword: schemaKeywords.number,\n },\n },\n {\n name: 'integer',\n schema: {\n keyword: schemaKeywords.integer,\n },\n },\n {\n name: 'boolean',\n schema: {\n keyword: schemaKeywords.boolean,\n },\n },\n {\n name: 'primitiveDate',\n schema: {\n keyword: schemaKeywords.date,\n args: {\n type: 'date',\n },\n },\n },\n {\n name: 'date',\n schema: {\n keyword: schemaKeywords.date,\n args: {\n type: 'string',\n },\n },\n },\n {\n name: 'time',\n schema: {\n keyword: schemaKeywords.time,\n args: {\n type: 'string',\n },\n },\n },\n {\n name: 'stringOffset',\n schema: {\n keyword: schemaKeywords.datetime,\n args: {\n offset: true,\n },\n },\n },\n {\n name: 'stringLocal',\n schema: {\n keyword: schemaKeywords.datetime,\n args: {\n local: true,\n },\n },\n },\n {\n name: 'datetime',\n schema: {\n keyword: schemaKeywords.datetime,\n args: {\n offset: false,\n },\n },\n },\n {\n name: 'nullable',\n schema: {\n keyword: schemaKeywords.nullable,\n },\n },\n {\n name: 'undefined',\n schema: {\n keyword: schemaKeywords.undefined,\n },\n },\n {\n name: 'min',\n schema: {\n keyword: schemaKeywords.min,\n args: 2,\n },\n },\n {\n name: 'max',\n schema: {\n keyword: schemaKeywords.max,\n args: 2,\n },\n },\n {\n name: 'matchesReg',\n schema: {\n keyword: schemaKeywords.matches,\n args: '/node_modules/', // pure regexp\n },\n },\n {\n name: 'matches',\n schema: {\n keyword: schemaKeywords.matches,\n args: '^[A-Z]{2}$',\n },\n },\n {\n name: 'const',\n schema: {\n keyword: schemaKeywords.const,\n args: {\n name: '',\n value: '',\n format: schemaKeywords.string,\n },\n },\n },\n {\n name: 'ref',\n schema: {\n keyword: schemaKeywords.ref,\n args: {\n $ref: '$ref',\n name: 'Pet',\n path: './pet.ts',\n isImportable: true,\n },\n },\n },\n {\n name: 'enum',\n schema: {\n keyword: schemaKeywords.enum,\n args: {\n name: 'enum',\n typeName: 'Enum',\n asConst: false,\n items: [\n { name: 'A', value: 'A', format: schemaKeywords.string },\n { name: 'B', value: 'B', format: schemaKeywords.string },\n { name: 'C', value: 'C', format: schemaKeywords.string },\n { name: 2, value: 2, format: schemaKeywords.number },\n ],\n },\n },\n },\n {\n name: 'enumLiteralBoolean',\n schema: {\n keyword: schemaKeywords.enum,\n args: {\n asConst: true,\n items: [\n {\n format: 'boolean',\n name: 'true',\n value: true,\n },\n {\n format: 'boolean',\n name: 'false',\n value: false,\n },\n ],\n name: 'PetEnumLiteral',\n typeName: 'PetEnumLiteral',\n },\n },\n },\n {\n name: 'tuple',\n schema: {\n keyword: schemaKeywords.tuple,\n args: {\n items: [],\n },\n },\n },\n {\n name: 'tupleMulti',\n schema: {\n keyword: schemaKeywords.tuple,\n args: {\n items: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],\n },\n },\n },\n {\n name: 'array',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [\n {\n keyword: schemaKeywords.union,\n args: [{ keyword: schemaKeywords.number }, { keyword: schemaKeywords.string }],\n },\n ],\n },\n },\n },\n {\n name: 'arrayEmpty',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [],\n },\n },\n },\n {\n name: 'arrayRef',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [\n {\n keyword: schemaKeywords.ref,\n\n args: { name: 'Pet', $ref: '#component/schema/Pet', path: './pet.ts', isImportable: true },\n },\n ],\n },\n },\n },\n {\n name: 'arrayAdvanced',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [{ keyword: schemaKeywords.min, args: 1 }, { keyword: schemaKeywords.max, args: 10 }, { keyword: schemaKeywords.number }],\n min: 3,\n max: 10,\n },\n },\n },\n {\n name: 'arrayRegex',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [{ keyword: schemaKeywords.matches, args: '^[a-zA-Z0-9]{1,13}$' }],\n min: 3,\n max: 10,\n },\n },\n },\n {\n name: 'union',\n schema: {\n keyword: schemaKeywords.union,\n args: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],\n },\n },\n {\n name: 'unionOne',\n schema: {\n keyword: schemaKeywords.union,\n args: [{ keyword: schemaKeywords.string }],\n },\n },\n {\n name: 'catchall',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [\n {\n keyword: schemaKeywords.ref,\n args: { name: 'Pet', $ref: '#component/schema/Pet', path: './Pet.ts', isImportable: true },\n },\n ],\n },\n },\n },\n {\n name: 'and',\n schema: {\n keyword: schemaKeywords.and,\n args: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],\n },\n },\n {\n name: 'object',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n firstName: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.min, args: 2 }],\n address: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.nullable }, { keyword: schemaKeywords.describe, args: '\"Your address\"' }],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectOptional',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n firstName: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.optional }, { keyword: schemaKeywords.min, args: 2 }],\n address: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.nullable }, { keyword: schemaKeywords.describe, args: '\"Your address\"' }],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectArray',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n ids: [\n {\n keyword: schemaKeywords.array,\n args: {\n items: [{ keyword: schemaKeywords.matches, args: '^[a-zA-Z0-9]{1,13}$' }],\n min: 3,\n max: 10,\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectDates',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n dateTime: [{ keyword: schemaKeywords.datetime, args: { offset: true } }],\n date: [{ keyword: schemaKeywords.date, args: { type: 'string' } }],\n time: [{ keyword: schemaKeywords.time, args: { type: 'string' } }],\n nativeDate: [{ keyword: schemaKeywords.date, args: { type: 'date' } }],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectAnd',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n firstName: [\n { keyword: schemaKeywords.deprecated },\n { keyword: schemaKeywords.default, args: 'test' },\n {\n keyword: schemaKeywords.min,\n args: 2,\n },\n {\n keyword: schemaKeywords.string,\n },\n ],\n age: [\n { keyword: schemaKeywords.example, args: '2' },\n { keyword: schemaKeywords.default, args: 2 },\n {\n keyword: schemaKeywords.min,\n args: 3,\n },\n {\n keyword: schemaKeywords.number,\n },\n ],\n address: [\n {\n keyword: schemaKeywords.and,\n args: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],\n },\n { keyword: schemaKeywords.nullable },\n { keyword: schemaKeywords.describe, args: 'Your address' },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectEnum',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n version: [\n {\n keyword: schemaKeywords.schema,\n args: {\n format: 'string',\n type: 'string',\n },\n },\n {\n keyword: schemaKeywords.enum,\n args: {\n name: 'enum',\n typeName: 'Enum',\n asConst: false,\n items: [\n { name: 'A', value: 'A', format: schemaKeywords.string },\n { name: 'B', value: 'B', format: schemaKeywords.string },\n { name: 'C', value: 'C', format: schemaKeywords.string },\n { name: 2, value: 2, format: schemaKeywords.number },\n ],\n },\n },\n {\n keyword: schemaKeywords.min,\n args: 4,\n },\n { keyword: schemaKeywords.describe, args: 'Your address' },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectObjectEnum',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n prop1: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n prop2: [\n {\n keyword: schemaKeywords.schema,\n args: { format: 'string', type: 'string' },\n },\n {\n keyword: schemaKeywords.enum,\n args: {\n name: 'enum',\n typeName: 'Enum',\n asConst: false,\n items: [\n { name: 'A', value: 'A', format: schemaKeywords.string },\n { name: 'B', value: 'B', format: schemaKeywords.string },\n ],\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectArrayObject',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n ids: [\n {\n keyword: schemaKeywords.array,\n args: {\n items: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n enum: [\n {\n keyword: schemaKeywords.schema,\n args: {\n format: 'string',\n type: 'string',\n },\n },\n {\n keyword: schemaKeywords.enum,\n args: {\n name: 'enum',\n typeName: 'Enum',\n asConst: false,\n items: [\n { name: 'A', value: 'A', format: schemaKeywords.string },\n { name: 'B', value: 'B', format: schemaKeywords.string },\n { name: 'C', value: 'C', format: schemaKeywords.string },\n { name: 2, value: 2, format: schemaKeywords.number },\n ],\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n ],\n min: 3,\n max: 10,\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectEmpty',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [],\n },\n },\n },\n {\n name: 'default',\n schema: {\n keyword: schemaKeywords.default,\n },\n },\n {\n name: 'default',\n schema: {\n keyword: schemaKeywords.default,\n args: 'default',\n },\n },\n {\n name: 'blob',\n schema: {\n keyword: schemaKeywords.blob,\n },\n },\n {\n name: 'nullableAdditionalProperties',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [\n {\n keyword: schemaKeywords.string,\n },\n {\n args: {\n format: undefined,\n type: schemaKeywords.string,\n },\n keyword: schemaKeywords.schema,\n },\n {\n keyword: schemaKeywords.nullable,\n },\n ],\n },\n },\n },\n]\n\nconst full: Array<{ name: string; schema: Schema[] }> = [\n {\n name: 'Upload',\n schema: [\n {\n keyword: schemaKeywords.blob,\n },\n ],\n },\n {\n name: 'PageSizeNumber',\n schema: [\n {\n keyword: schemaKeywords.number,\n },\n {\n keyword: schemaKeywords.default,\n args: 10,\n },\n ],\n },\n {\n name: 'PageSizeInteger',\n schema: [\n {\n keyword: schemaKeywords.integer,\n },\n {\n keyword: schemaKeywords.default,\n args: 10,\n },\n ],\n },\n {\n name: 'Object',\n schema: [\n { keyword: schemaKeywords.nullable },\n { keyword: schemaKeywords.describe, args: 'Your address' },\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n firstName: [\n { keyword: schemaKeywords.deprecated },\n { keyword: schemaKeywords.default, args: 'test' },\n {\n keyword: schemaKeywords.min,\n args: 2,\n },\n {\n keyword: schemaKeywords.string,\n },\n ],\n age: [\n { keyword: schemaKeywords.example, args: '2' },\n { keyword: schemaKeywords.default, args: 2 },\n {\n keyword: schemaKeywords.min,\n args: 2,\n },\n {\n keyword: schemaKeywords.number,\n },\n ],\n address: [\n {\n keyword: schemaKeywords.and,\n args: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],\n },\n { keyword: schemaKeywords.nullable },\n { keyword: schemaKeywords.describe, args: 'Your address' },\n ],\n },\n additionalProperties: [],\n },\n },\n ],\n },\n {\n name: 'Order',\n schema: [\n {\n keyword: schemaKeywords.schema,\n args: {\n type: 'object',\n },\n },\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n status: [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: 'orderStatus',\n asConst: false,\n typeName: 'OrderStatus',\n items: [\n { name: 'Placed', value: 'placed', format: 'string' },\n { name: 'Approved', value: 'approved', format: 'string' },\n ],\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n ],\n },\n {\n name: 'nullableAdditionalProperties',\n schema: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [\n {\n keyword: schemaKeywords.string,\n },\n {\n args: {\n format: undefined,\n type: schemaKeywords.string,\n },\n keyword: schemaKeywords.schema,\n },\n {\n keyword: schemaKeywords.number,\n },\n ],\n },\n },\n ],\n },\n {\n name: 'Record',\n schema: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [\n {\n keyword: schemaKeywords.integer,\n },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: 'integer',\n format: 'int32',\n },\n },\n {\n keyword: schemaKeywords.optional,\n },\n ],\n },\n },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: 'integer',\n format: 'int32',\n },\n },\n {\n keyword: schemaKeywords.optional,\n },\n ],\n },\n]\n\nexport const schemas = {\n basic,\n full,\n}\n"],"mappings":";;;AAEA,MAAMA,QAAiD;CACrD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,KACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,SACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,QACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,QACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,SACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,SACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,MAAM,QACP;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,MAAM,UACP;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,MAAM,UACP;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,QAAQ,MACT;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,OAAO,MACR;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,QAAQ,OACT;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,UACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,WACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM;GACP;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM;GACP;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM;GACP;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM;GACP;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS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ACJ,MAAM;KACN,QAAQ;KACT;IACF;GACD,EACE,SAAS,eAAe,UACzB;GACF;EACF;CACF;AAED,MAAa,UAAU;CACrB;CACA;CACD"}
|
|
1
|
+
{"version":3,"file":"mocks.js","names":["basic: Array<{ name: string; schema: Schema }>","full: Array<{ name: string; schema: Schema[] }>"],"sources":["../src/mocks/schemas.ts"],"sourcesContent":["import { type Schema, schemaKeywords } from '../SchemaMapper'\n\nconst basic: Array<{ name: string; schema: Schema }> = [\n {\n name: 'any',\n schema: {\n keyword: schemaKeywords.any,\n },\n },\n {\n name: 'unknown',\n schema: {\n keyword: schemaKeywords.unknown,\n },\n },\n {\n name: 'string',\n schema: {\n keyword: schemaKeywords.string,\n },\n },\n {\n name: 'number',\n schema: {\n keyword: schemaKeywords.number,\n },\n },\n {\n name: 'integer',\n schema: {\n keyword: schemaKeywords.integer,\n },\n },\n {\n name: 'boolean',\n schema: {\n keyword: schemaKeywords.boolean,\n },\n },\n {\n name: 'primitiveDate',\n schema: {\n keyword: schemaKeywords.date,\n args: {\n type: 'date',\n },\n },\n },\n {\n name: 'date',\n schema: {\n keyword: schemaKeywords.date,\n args: {\n type: 'string',\n },\n },\n },\n {\n name: 'time',\n schema: {\n keyword: schemaKeywords.time,\n args: {\n type: 'string',\n },\n },\n },\n {\n name: 'stringOffset',\n schema: {\n keyword: schemaKeywords.datetime,\n args: {\n offset: true,\n },\n },\n },\n {\n name: 'stringLocal',\n schema: {\n keyword: schemaKeywords.datetime,\n args: {\n local: true,\n },\n },\n },\n {\n name: 'datetime',\n schema: {\n keyword: schemaKeywords.datetime,\n args: {\n offset: false,\n },\n },\n },\n {\n name: 'nullable',\n schema: {\n keyword: schemaKeywords.nullable,\n },\n },\n {\n name: 'undefined',\n schema: {\n keyword: schemaKeywords.undefined,\n },\n },\n {\n name: 'min',\n schema: {\n keyword: schemaKeywords.min,\n args: 2,\n },\n },\n {\n name: 'max',\n schema: {\n keyword: schemaKeywords.max,\n args: 2,\n },\n },\n {\n name: 'matchesReg',\n schema: {\n keyword: schemaKeywords.matches,\n args: '/node_modules/', // pure regexp\n },\n },\n {\n name: 'matches',\n schema: {\n keyword: schemaKeywords.matches,\n args: '^[A-Z]{2}$',\n },\n },\n {\n name: 'const',\n schema: {\n keyword: schemaKeywords.const,\n args: {\n name: '',\n value: '',\n format: schemaKeywords.string,\n },\n },\n },\n {\n name: 'ref',\n schema: {\n keyword: schemaKeywords.ref,\n args: {\n $ref: '$ref',\n name: 'Pet',\n path: './pet.ts',\n isImportable: true,\n },\n },\n },\n {\n name: 'enum',\n schema: {\n keyword: schemaKeywords.enum,\n args: {\n name: 'enum',\n typeName: 'Enum',\n asConst: false,\n items: [\n { name: 'A', value: 'A', format: schemaKeywords.string },\n { name: 'B', value: 'B', format: schemaKeywords.string },\n { name: 'C', value: 'C', format: schemaKeywords.string },\n { name: 2, value: 2, format: schemaKeywords.number },\n ],\n },\n },\n },\n {\n name: 'enumLiteralBoolean',\n schema: {\n keyword: schemaKeywords.enum,\n args: {\n asConst: true,\n items: [\n {\n format: 'boolean',\n name: 'true',\n value: true,\n },\n {\n format: 'boolean',\n name: 'false',\n value: false,\n },\n ],\n name: 'PetEnumLiteral',\n typeName: 'PetEnumLiteral',\n },\n },\n },\n {\n name: 'tuple',\n schema: {\n keyword: schemaKeywords.tuple,\n args: {\n items: [],\n },\n },\n },\n {\n name: 'tupleMulti',\n schema: {\n keyword: schemaKeywords.tuple,\n args: {\n items: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],\n },\n },\n },\n {\n name: 'array',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [\n {\n keyword: schemaKeywords.union,\n args: [{ keyword: schemaKeywords.number }, { keyword: schemaKeywords.string }],\n },\n ],\n },\n },\n },\n {\n name: 'arrayEmpty',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [],\n },\n },\n },\n {\n name: 'arrayRef',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [\n {\n keyword: schemaKeywords.ref,\n\n args: { name: 'Pet', $ref: '#component/schema/Pet', path: './pet.ts', isImportable: true },\n },\n ],\n },\n },\n },\n {\n name: 'arrayAdvanced',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [{ keyword: schemaKeywords.min, args: 1 }, { keyword: schemaKeywords.max, args: 10 }, { keyword: schemaKeywords.number }],\n min: 3,\n max: 10,\n },\n },\n },\n {\n name: 'arrayRegex',\n schema: {\n keyword: schemaKeywords.array,\n args: {\n items: [{ keyword: schemaKeywords.matches, args: '^[a-zA-Z0-9]{1,13}$' }],\n min: 3,\n max: 10,\n },\n },\n },\n {\n name: 'union',\n schema: {\n keyword: schemaKeywords.union,\n args: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.number }],\n },\n },\n {\n name: 'unionOne',\n schema: {\n keyword: schemaKeywords.union,\n args: [{ keyword: schemaKeywords.string }],\n },\n },\n {\n name: 'catchall',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [\n {\n keyword: schemaKeywords.ref,\n args: { name: 'Pet', $ref: '#component/schema/Pet', path: './Pet.ts', isImportable: true },\n },\n ],\n },\n },\n },\n {\n name: 'and',\n schema: {\n keyword: schemaKeywords.and,\n args: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n street: [{ keyword: schemaKeywords.string }],\n },\n additionalProperties: [],\n },\n },\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n city: [{ keyword: schemaKeywords.string }],\n },\n additionalProperties: [],\n },\n },\n ],\n },\n },\n {\n name: 'object',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n firstName: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.min, args: 2 }],\n address: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.nullable }, { keyword: schemaKeywords.describe, args: '\"Your address\"' }],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectOptional',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n firstName: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.optional }, { keyword: schemaKeywords.min, args: 2 }],\n address: [{ keyword: schemaKeywords.string }, { keyword: schemaKeywords.nullable }, { keyword: schemaKeywords.describe, args: '\"Your address\"' }],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectArray',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n ids: [\n {\n keyword: schemaKeywords.array,\n args: {\n items: [{ keyword: schemaKeywords.matches, args: '^[a-zA-Z0-9]{1,13}$' }],\n min: 3,\n max: 10,\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectDates',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n dateTime: [{ keyword: schemaKeywords.datetime, args: { offset: true } }],\n date: [{ keyword: schemaKeywords.date, args: { type: 'string' } }],\n time: [{ keyword: schemaKeywords.time, args: { type: 'string' } }],\n nativeDate: [{ keyword: schemaKeywords.date, args: { type: 'date' } }],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectAnd',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n firstName: [\n { keyword: schemaKeywords.deprecated },\n { keyword: schemaKeywords.default, args: 'test' },\n {\n keyword: schemaKeywords.min,\n args: 2,\n },\n {\n keyword: schemaKeywords.string,\n },\n ],\n age: [\n { keyword: schemaKeywords.example, args: '2' },\n { keyword: schemaKeywords.default, args: 2 },\n {\n keyword: schemaKeywords.min,\n args: 3,\n },\n {\n keyword: schemaKeywords.number,\n },\n ],\n address: [\n {\n keyword: schemaKeywords.and,\n args: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n street: [{ keyword: schemaKeywords.string }],\n },\n additionalProperties: [],\n },\n },\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n city: [{ keyword: schemaKeywords.string }],\n },\n additionalProperties: [],\n },\n },\n ],\n },\n { keyword: schemaKeywords.nullable },\n { keyword: schemaKeywords.describe, args: 'Your address' },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectEnum',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n version: [\n {\n keyword: schemaKeywords.schema,\n args: {\n format: 'string',\n type: 'string',\n },\n },\n {\n keyword: schemaKeywords.enum,\n args: {\n name: 'enum',\n typeName: 'Enum',\n asConst: false,\n items: [\n { name: 'A', value: 'A', format: schemaKeywords.string },\n { name: 'B', value: 'B', format: schemaKeywords.string },\n { name: 'C', value: 'C', format: schemaKeywords.string },\n { name: 2, value: 2, format: schemaKeywords.number },\n ],\n },\n },\n {\n keyword: schemaKeywords.min,\n args: 4,\n },\n { keyword: schemaKeywords.describe, args: 'Your address' },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectObjectEnum',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n prop1: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n prop2: [\n {\n keyword: schemaKeywords.schema,\n args: { format: 'string', type: 'string' },\n },\n {\n keyword: schemaKeywords.enum,\n args: {\n name: 'enum',\n typeName: 'Enum',\n asConst: false,\n items: [\n { name: 'A', value: 'A', format: schemaKeywords.string },\n { name: 'B', value: 'B', format: schemaKeywords.string },\n ],\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectArrayObject',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n ids: [\n {\n keyword: schemaKeywords.array,\n args: {\n items: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n enum: [\n {\n keyword: schemaKeywords.schema,\n args: {\n format: 'string',\n type: 'string',\n },\n },\n {\n keyword: schemaKeywords.enum,\n args: {\n name: 'enum',\n typeName: 'Enum',\n asConst: false,\n items: [\n { name: 'A', value: 'A', format: schemaKeywords.string },\n { name: 'B', value: 'B', format: schemaKeywords.string },\n { name: 'C', value: 'C', format: schemaKeywords.string },\n { name: 2, value: 2, format: schemaKeywords.number },\n ],\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n ],\n min: 3,\n max: 10,\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n },\n {\n name: 'objectEmpty',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [],\n },\n },\n },\n {\n name: 'default',\n schema: {\n keyword: schemaKeywords.default,\n },\n },\n {\n name: 'default',\n schema: {\n keyword: schemaKeywords.default,\n args: 'default',\n },\n },\n {\n name: 'blob',\n schema: {\n keyword: schemaKeywords.blob,\n },\n },\n {\n name: 'nullableAdditionalProperties',\n schema: {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [\n {\n keyword: schemaKeywords.string,\n },\n {\n args: {\n format: undefined,\n type: schemaKeywords.string,\n },\n keyword: schemaKeywords.schema,\n },\n {\n keyword: schemaKeywords.nullable,\n },\n ],\n },\n },\n },\n]\n\nconst full: Array<{ name: string; schema: Schema[] }> = [\n {\n name: 'Upload',\n schema: [\n {\n keyword: schemaKeywords.blob,\n },\n ],\n },\n {\n name: 'PageSizeNumber',\n schema: [\n {\n keyword: schemaKeywords.number,\n },\n {\n keyword: schemaKeywords.default,\n args: 10,\n },\n ],\n },\n {\n name: 'PageSizeInteger',\n schema: [\n {\n keyword: schemaKeywords.integer,\n },\n {\n keyword: schemaKeywords.default,\n args: 10,\n },\n ],\n },\n {\n name: 'Object',\n schema: [\n { keyword: schemaKeywords.nullable },\n { keyword: schemaKeywords.describe, args: 'Your address' },\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n firstName: [\n { keyword: schemaKeywords.deprecated },\n { keyword: schemaKeywords.default, args: 'test' },\n {\n keyword: schemaKeywords.min,\n args: 2,\n },\n {\n keyword: schemaKeywords.string,\n },\n ],\n age: [\n { keyword: schemaKeywords.example, args: '2' },\n { keyword: schemaKeywords.default, args: 2 },\n {\n keyword: schemaKeywords.min,\n args: 2,\n },\n {\n keyword: schemaKeywords.number,\n },\n ],\n address: [\n {\n keyword: schemaKeywords.and,\n args: [\n { keyword: schemaKeywords.string },\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n street: [{ keyword: schemaKeywords.string }],\n city: [{ keyword: schemaKeywords.string }],\n },\n additionalProperties: [],\n },\n },\n ],\n },\n { keyword: schemaKeywords.nullable },\n { keyword: schemaKeywords.describe, args: 'Your address' },\n ],\n },\n additionalProperties: [],\n },\n },\n ],\n },\n {\n name: 'Order',\n schema: [\n {\n keyword: schemaKeywords.schema,\n args: {\n type: 'object',\n },\n },\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n status: [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: 'orderStatus',\n asConst: false,\n typeName: 'OrderStatus',\n items: [\n { name: 'Placed', value: 'placed', format: 'string' },\n { name: 'Approved', value: 'approved', format: 'string' },\n ],\n },\n },\n ],\n },\n additionalProperties: [],\n },\n },\n ],\n },\n {\n name: 'nullableAdditionalProperties',\n schema: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [\n {\n keyword: schemaKeywords.string,\n },\n {\n args: {\n format: undefined,\n type: schemaKeywords.string,\n },\n keyword: schemaKeywords.schema,\n },\n {\n keyword: schemaKeywords.number,\n },\n ],\n },\n },\n ],\n },\n {\n name: 'Record',\n schema: [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {},\n additionalProperties: [\n {\n keyword: schemaKeywords.integer,\n },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: 'integer',\n format: 'int32',\n },\n },\n {\n keyword: schemaKeywords.optional,\n },\n ],\n },\n },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: 'integer',\n format: 'int32',\n },\n },\n {\n keyword: schemaKeywords.optional,\n },\n ],\n },\n]\n\nexport const schemas = {\n basic,\n full,\n}\n"],"mappings":";;;AAEA,MAAMA,QAAiD;CACrD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,KACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,SACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,QACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,QACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,SACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,SACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,MAAM,QACP;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,MAAM,UACP;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,MAAM,UACP;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,QAAQ,MACT;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,OAAO,MACR;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM,EACJ,QAAQ,OACT;GACF;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,UACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ,EACN,SAAS,eAAe,WACzB;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM;GACP;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM;GACP;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM;GACP;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM;GACP;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN,SAAS,eAAe;GACxB,MAAM;IACJ,MAAM;IACN,OAAO;IACP,QAAQ,eAAe;IACxB;GACF;EACF;CACD;EACE,MAAM;EACN,QA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,YAAY,EAAE;IACd,sBAAsB;KACpB,EACE,SAAS,eAAe,QACzB;KACD;MACE,MAAM;OACJ,QAAQ;OACR,MAAM,eAAe;OACtB;MACD,SAAS,eAAe;MACzB;KACD,EACE,SAAS,eAAe,QACzB;KACF;IACF;GACF,CACF;EACF;CACD;EACE,MAAM;EACN,QAAQ;GACN;IACE,SAAS,eAAe;IACxB,MAAM;KACJ,YAAY,EAAE;KACd,sBAAsB;MACpB,EACE,SAAS,eAAe,SACzB;MACD;OACE,SAAS,eAAe;OACxB,MAAM;QACJ,MAAM;QACN,QAAQ;QACT;OACF;MACD,EACE,SAAS,eAAe,UACzB;MACF;KACF;IACF;GACD;IACE,SAAS,eAAe;IACxB,MAAM;KACJ,MAAM;KACN,QAAQ;KACT;IACF;GACD,EACE,SAAS,eAAe,UACzB;GACF;EACF;CACF;AAED,MAAa,UAAU;CACrB;CACA;CACD"}
|
package/dist/utils.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const require_getSchemas = require('./getSchemas-DdrlFGPi.cjs');
|
|
3
|
+
const require_getFooter = require('./getFooter-D-b_lr3d.cjs');
|
|
4
4
|
let __kubb_core_transformers = require("@kubb/core/transformers");
|
|
5
5
|
__kubb_core_transformers = require_chunk.__toESM(__kubb_core_transformers);
|
|
6
|
-
let __kubb_oas = require("@kubb/oas");
|
|
7
6
|
let __kubb_core_utils = require("@kubb/core/utils");
|
|
7
|
+
let __kubb_oas = require("@kubb/oas");
|
|
8
8
|
|
|
9
9
|
//#region src/utils/getComments.ts
|
|
10
10
|
function getComments(operation) {
|
package/dist/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { n as
|
|
1
|
+
import { n as getSchemaFactory, t as getSchemas } from "./getSchemas-XWPSn2uf.js";
|
|
2
|
+
import { n as getBanner, t as getFooter } from "./getFooter-C2vyr3vj.js";
|
|
3
3
|
import transformers, { camelCase, isValidVarName } from "@kubb/core/transformers";
|
|
4
|
-
import { isOptional, isParameterObject } from "@kubb/oas";
|
|
5
4
|
import { URLPath } from "@kubb/core/utils";
|
|
5
|
+
import { isOptional, isParameterObject } from "@kubb/oas";
|
|
6
6
|
|
|
7
7
|
//#region src/utils/getComments.ts
|
|
8
8
|
function getComments(operation) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-oas",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.1",
|
|
4
4
|
"description": "OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"@stoplight/yaml": "^4.3.0",
|
|
84
84
|
"p-limit": "^7.2.0",
|
|
85
85
|
"remeda": "^2.32.0",
|
|
86
|
-
"@kubb/core": "4.
|
|
87
|
-
"@kubb/oas": "4.
|
|
86
|
+
"@kubb/core": "4.11.1",
|
|
87
|
+
"@kubb/oas": "4.11.1"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@kubb/react-fabric": "0.5.4"
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { SchemaGenerator } from './SchemaGenerator.ts'
|
|
2
|
+
import type { Schema, SchemaKeywordMapper, SchemaMapper, SchemaTree } from './SchemaMapper.ts'
|
|
3
|
+
import { schemaKeywords } from './SchemaMapper.ts'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Handler context with parse method available via `this`
|
|
7
|
+
*/
|
|
8
|
+
export type HandlerContext<TOutput, TOptions> = {
|
|
9
|
+
parse: (tree: SchemaTree, options: TOptions) => TOutput | null | undefined
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Handler function type for custom keyword processing
|
|
14
|
+
* Handlers can access the parse function via `this.parse`
|
|
15
|
+
*/
|
|
16
|
+
export type KeywordHandler<TOutput, TOptions> = (this: HandlerContext<TOutput, TOptions>, tree: SchemaTree, options: TOptions) => TOutput | null | undefined
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for createParser
|
|
20
|
+
*/
|
|
21
|
+
export type CreateParserConfig<TOutput, TOptions> = {
|
|
22
|
+
/**
|
|
23
|
+
* The keyword mapper that maps schema keywords to output generators
|
|
24
|
+
*/
|
|
25
|
+
mapper: SchemaMapper<TOutput>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Custom handlers for specific schema keywords
|
|
29
|
+
* These provide the implementation for complex types that need special processing
|
|
30
|
+
*
|
|
31
|
+
* Use function syntax (not arrow functions) to enable use of `this` keyword:
|
|
32
|
+
* ```typescript
|
|
33
|
+
* handlers: {
|
|
34
|
+
* enum(tree, options, parse) {
|
|
35
|
+
* // Implementation
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* Common keywords that typically need handlers:
|
|
41
|
+
* - union: Combine multiple schemas into a union
|
|
42
|
+
* - and: Combine multiple schemas into an intersection
|
|
43
|
+
* - array: Handle array types with items
|
|
44
|
+
* - object: Handle object types with properties
|
|
45
|
+
* - enum: Handle enum types
|
|
46
|
+
* - tuple: Handle tuple types
|
|
47
|
+
* - const: Handle literal/const types
|
|
48
|
+
* - ref: Handle references to other schemas
|
|
49
|
+
* - string/number/integer: Handle primitives with constraints (min/max)
|
|
50
|
+
* - matches: Handle regex patterns
|
|
51
|
+
* - default/describe/optional/nullable: Handle modifiers
|
|
52
|
+
*/
|
|
53
|
+
handlers: Partial<{
|
|
54
|
+
[K in keyof SchemaKeywordMapper]: KeywordHandler<TOutput, TOptions>
|
|
55
|
+
}>
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Creates a parser function that converts schema trees to output using the provided mapper and handlers
|
|
60
|
+
*
|
|
61
|
+
* This function provides a framework for building parsers by:
|
|
62
|
+
* 1. Checking for custom handlers for each keyword
|
|
63
|
+
* 2. Falling back to the mapper for simple keywords
|
|
64
|
+
* 3. Providing utilities for common operations (finding siblings, etc.)
|
|
65
|
+
*
|
|
66
|
+
* The generated parser is recursive and can handle nested schemas.
|
|
67
|
+
*
|
|
68
|
+
* @template TOutput - The output type (e.g., string for Zod/Faker, ts.TypeNode for TypeScript)
|
|
69
|
+
* @template TOptions - The parser options type
|
|
70
|
+
* @param config - Configuration object containing mapper and handlers
|
|
71
|
+
* @returns A parse function that converts SchemaTree to TOutput
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* // Create a simple string-based parser
|
|
76
|
+
* const parse = createParser({
|
|
77
|
+
* mapper: zodKeywordMapper,
|
|
78
|
+
* handlers: {
|
|
79
|
+
* union(tree, options) {
|
|
80
|
+
* const items = tree.current.args
|
|
81
|
+
* .map(it => this.parse({ ...tree, current: it }, options))
|
|
82
|
+
* .filter(Boolean)
|
|
83
|
+
* return `z.union([${items.join(', ')}])`
|
|
84
|
+
* },
|
|
85
|
+
* string(tree, options) {
|
|
86
|
+
* const minSchema = findSchemaKeyword(tree.siblings, 'min')
|
|
87
|
+
* const maxSchema = findSchemaKeyword(tree.siblings, 'max')
|
|
88
|
+
* return zodKeywordMapper.string(false, minSchema?.args, maxSchema?.args)
|
|
89
|
+
* }
|
|
90
|
+
* }
|
|
91
|
+
* })
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export function createParser<TOutput, TOptions extends Record<string, any>>(
|
|
95
|
+
config: CreateParserConfig<TOutput, TOptions>,
|
|
96
|
+
): (tree: SchemaTree, options: TOptions) => TOutput | null | undefined {
|
|
97
|
+
const { mapper, handlers } = config
|
|
98
|
+
|
|
99
|
+
function parse(tree: SchemaTree, options: TOptions): TOutput | null | undefined {
|
|
100
|
+
const { current } = tree
|
|
101
|
+
|
|
102
|
+
// Check if there's a custom handler for this keyword
|
|
103
|
+
const handler = handlers[current.keyword as keyof SchemaKeywordMapper]
|
|
104
|
+
if (handler) {
|
|
105
|
+
// Create context object with parse method accessible via `this`
|
|
106
|
+
const context: HandlerContext<TOutput, TOptions> = { parse }
|
|
107
|
+
return handler.call(context, tree, options)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Fall back to simple mapper lookup
|
|
111
|
+
const value = mapper[current.keyword as keyof typeof mapper]
|
|
112
|
+
|
|
113
|
+
if (!value) {
|
|
114
|
+
return undefined
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// For simple keywords without args, call the mapper directly
|
|
118
|
+
if (current.keyword in mapper) {
|
|
119
|
+
return value()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return undefined
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return parse
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Helper to find a schema keyword in siblings
|
|
130
|
+
* Useful in handlers when you need to find related schemas (e.g., min/max for string)
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* const minSchema = findSchemaKeyword(tree.siblings, 'min')
|
|
135
|
+
* const maxSchema = findSchemaKeyword(tree.siblings, 'max')
|
|
136
|
+
* return zodKeywordMapper.string(false, minSchema?.args, maxSchema?.args)
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export function findSchemaKeyword<K extends keyof SchemaKeywordMapper>(siblings: Schema[], keyword: K): SchemaKeywordMapper[K] | undefined {
|
|
140
|
+
return SchemaGenerator.find(siblings, schemaKeywords[keyword]) as SchemaKeywordMapper[K] | undefined
|
|
141
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { createGenerator as _createGenerator } from './generators/createGenerato
|
|
|
3
3
|
import { createReactGenerator as _createReactGenerator } from './generators/createReactGenerator.ts'
|
|
4
4
|
import type { Generator as _Generator } from './generators/types.ts'
|
|
5
5
|
|
|
6
|
+
export type { CreateParserConfig, KeywordHandler } from './createParser.ts'
|
|
7
|
+
export { createParser, findSchemaKeyword } from './createParser.ts'
|
|
6
8
|
export type { OperationMethodResult } from './OperationGenerator.ts'
|
|
7
9
|
export { OperationGenerator } from './OperationGenerator.ts'
|
|
8
10
|
export { pluginOas, pluginOasName } from './plugin.ts'
|
package/src/mocks/schemas.ts
CHANGED
|
@@ -305,7 +305,26 @@ const basic: Array<{ name: string; schema: Schema }> = [
|
|
|
305
305
|
name: 'and',
|
|
306
306
|
schema: {
|
|
307
307
|
keyword: schemaKeywords.and,
|
|
308
|
-
args: [
|
|
308
|
+
args: [
|
|
309
|
+
{
|
|
310
|
+
keyword: schemaKeywords.object,
|
|
311
|
+
args: {
|
|
312
|
+
properties: {
|
|
313
|
+
street: [{ keyword: schemaKeywords.string }],
|
|
314
|
+
},
|
|
315
|
+
additionalProperties: [],
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
keyword: schemaKeywords.object,
|
|
320
|
+
args: {
|
|
321
|
+
properties: {
|
|
322
|
+
city: [{ keyword: schemaKeywords.string }],
|
|
323
|
+
},
|
|
324
|
+
additionalProperties: [],
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
],
|
|
309
328
|
},
|
|
310
329
|
},
|
|
311
330
|
{
|
|
@@ -401,7 +420,26 @@ const basic: Array<{ name: string; schema: Schema }> = [
|
|
|
401
420
|
address: [
|
|
402
421
|
{
|
|
403
422
|
keyword: schemaKeywords.and,
|
|
404
|
-
args: [
|
|
423
|
+
args: [
|
|
424
|
+
{
|
|
425
|
+
keyword: schemaKeywords.object,
|
|
426
|
+
args: {
|
|
427
|
+
properties: {
|
|
428
|
+
street: [{ keyword: schemaKeywords.string }],
|
|
429
|
+
},
|
|
430
|
+
additionalProperties: [],
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
keyword: schemaKeywords.object,
|
|
435
|
+
args: {
|
|
436
|
+
properties: {
|
|
437
|
+
city: [{ keyword: schemaKeywords.string }],
|
|
438
|
+
},
|
|
439
|
+
additionalProperties: [],
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
],
|
|
405
443
|
},
|
|
406
444
|
{ keyword: schemaKeywords.nullable },
|
|
407
445
|
{ keyword: schemaKeywords.describe, args: 'Your address' },
|
|
@@ -664,7 +702,19 @@ const full: Array<{ name: string; schema: Schema[] }> = [
|
|
|
664
702
|
address: [
|
|
665
703
|
{
|
|
666
704
|
keyword: schemaKeywords.and,
|
|
667
|
-
args: [
|
|
705
|
+
args: [
|
|
706
|
+
{ keyword: schemaKeywords.string },
|
|
707
|
+
{
|
|
708
|
+
keyword: schemaKeywords.object,
|
|
709
|
+
args: {
|
|
710
|
+
properties: {
|
|
711
|
+
street: [{ keyword: schemaKeywords.string }],
|
|
712
|
+
city: [{ keyword: schemaKeywords.string }],
|
|
713
|
+
},
|
|
714
|
+
additionalProperties: [],
|
|
715
|
+
},
|
|
716
|
+
},
|
|
717
|
+
],
|
|
668
718
|
},
|
|
669
719
|
{ keyword: schemaKeywords.nullable },
|
|
670
720
|
{ keyword: schemaKeywords.describe, args: 'Your address' },
|