fork of hey-api/openapi-ts because I need some additional things

fix: Zod plugin handles value constraints and defaults

Lubos af76a770 a134d19d

+653 -539
+5
.changeset/chilly-hats-cover.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix: Zod plugin handles value constraints and defaults
+3
eslint.config.js
··· 1 1 import eslint from '@eslint/js'; 2 2 import configPrettier from 'eslint-config-prettier'; 3 3 import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort'; 4 + import pluginSortDestructureKeys from 'eslint-plugin-sort-destructure-keys'; 4 5 import pluginSortKeysFix from 'eslint-plugin-sort-keys-fix'; 5 6 import pluginTypeScriptSortKeys from 'eslint-plugin-typescript-sort-keys'; 6 7 // import pluginVue from 'eslint-plugin-vue' ··· 19 20 }, 20 21 plugins: { 21 22 'simple-import-sort': pluginSimpleImportSort, 23 + 'sort-destructure-keys': pluginSortDestructureKeys, 22 24 'sort-keys-fix': pluginSortKeysFix, 23 25 'typescript-sort-keys': pluginTypeScriptSortKeys, 24 26 }, ··· 38 40 'object-shorthand': 'error', 39 41 'simple-import-sort/exports': 'error', 40 42 'simple-import-sort/imports': 'error', 43 + 'sort-destructure-keys/sort-destructure-keys': 'warn', 41 44 'sort-imports': 'off', 42 45 'sort-keys-fix/sort-keys-fix': 'warn', 43 46 'typescript-sort-keys/interface': 'warn',
+1 -1
examples/openapi-ts-tanstack-angular-query-experimental/src/app/pet-store/pet-store.component.ts
··· 90 90 return; 91 91 } 92 92 93 - const { name, category } = form.value as { 93 + const { category, name } = form.value as { 94 94 category: string; 95 95 name: string; 96 96 };
+2 -2
examples/openapi-ts-tanstack-svelte-query/src/routes/sverdle/+page.server.ts
··· 30 30 * Modify game state in reaction to a guessed word. This logic always runs on 31 31 * the server, so that people can't cheat by peeking at the JavaScript 32 32 */ 33 - enter: async ({ request, cookies }) => { 33 + enter: async ({ cookies, request }) => { 34 34 const game = new Game(cookies.get('sverdle')); 35 35 36 36 const data = await request.formData(); ··· 51 51 * Modify game state in reaction to a keypress. If client-side JavaScript 52 52 * is available, this will happen in the browser instead of here 53 53 */ 54 - update: async ({ request, cookies }) => { 54 + update: async ({ cookies, request }) => { 55 55 const game = new Game(cookies.get('sverdle')); 56 56 57 57 const data = await request.formData();
+1
package.json
··· 49 49 "eslint": "9.6.0", 50 50 "eslint-config-prettier": "9.1.0", 51 51 "eslint-plugin-simple-import-sort": "12.1.1", 52 + "eslint-plugin-sort-destructure-keys": "2.0.0", 52 53 "eslint-plugin-sort-keys-fix": "1.1.2", 53 54 "eslint-plugin-typescript-sort-keys": "3.2.0", 54 55 "eslint-plugin-vue": "9.23.0",
+1
packages/openapi-ts/src/compiler/index.ts
··· 71 71 typeReferenceNode: types.createTypeReferenceNode, 72 72 typeTupleNode: typedef.createTypeTupleNode, 73 73 typeUnionNode: typedef.createTypeUnionNode, 74 + valueToExpression: types.toExpression, 74 75 };
+2 -2
packages/openapi-ts/src/compiler/module.ts
··· 31 31 export type ImportExportItem = ImportExportItemObject | string; 32 32 33 33 export const createCallExpression = ({ 34 - parameters = [], 35 34 functionName, 35 + parameters = [], 36 36 types, 37 37 }: { 38 38 functionName: ··· 108 108 * @returns ts.VariableStatement 109 109 */ 110 110 export const createConstVariable = ({ 111 - comment, 112 111 assertion, 112 + comment, 113 113 destructure, 114 114 exportConst, 115 115 expression,
+1 -1
packages/openapi-ts/src/compiler/transform.ts
··· 84 84 }; 85 85 86 86 export const createIfStatement = ({ 87 + elseStatement, 87 88 expression, 88 89 thenStatement, 89 - elseStatement, 90 90 }: { 91 91 elseStatement?: ts.Statement; 92 92 expression: ts.Expression;
+1 -1
packages/openapi-ts/src/index.ts
··· 314 314 configFile = '', 315 315 debug = false, 316 316 dryRun = false, 317 - exportCore = true, 318 317 experimentalParser = false, 318 + exportCore = true, 319 319 name, 320 320 request, 321 321 useOptions = true,
+1 -1
packages/openapi-ts/src/ir/__tests__/mediaType.test.ts
··· 63 63 64 64 it.each(scenarios)( 65 65 'detects $mediaType as file-like? $fileLike', 66 - async ({ mediaType, fileLike }) => { 66 + async ({ fileLike, mediaType }) => { 67 67 expect(isMediaTypeFileLike({ mediaType })).toEqual(fileLike); 68 68 }, 69 69 );
+15 -1
packages/openapi-ts/src/ir/ir.d.ts
··· 113 113 export interface IRSchemaObject 114 114 extends Pick< 115 115 JsonSchemaDraft2020_12, 116 - '$ref' | 'const' | 'deprecated' | 'description' | 'required' | 'title' 116 + | '$ref' 117 + | 'const' 118 + | 'default' 119 + | 'deprecated' 120 + | 'description' 121 + | 'exclusiveMaximum' 122 + | 'exclusiveMinimum' 123 + | 'maximum' 124 + | 'maxItems' 125 + | 'maxLength' 126 + | 'minimum' 127 + | 'minItems' 128 + | 'minLength' 129 + | 'required' 130 + | 'title' 117 131 > { 118 132 /** 119 133 * If the schema is intended to be used as an object property, it can be
+3 -3
packages/openapi-ts/src/legacy/handlebars/handlebars.cjs
··· 1 1 const Handlebars = require('handlebars'); 2 2 const { 3 + existsSync, 4 + mkdirSync, 3 5 readFileSync, 4 6 readdirSync, 7 + rmdirSync, 5 8 statSync, 6 - existsSync, 7 - mkdirSync, 8 9 writeFileSync, 9 - rmdirSync, 10 10 } = require('node:fs'); 11 11 const path = require('node:path'); 12 12
+36
packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts
··· 44 44 irSchema: IRSchemaObject; 45 45 schema: SchemaObject; 46 46 }) => { 47 + if (schema.default !== undefined) { 48 + irSchema.default = schema.default; 49 + } 50 + 51 + if (schema.exclusiveMaximum) { 52 + if (schema.maximum !== undefined) { 53 + irSchema.exclusiveMaximum = schema.maximum; 54 + } 55 + } else if (schema.maximum !== undefined) { 56 + irSchema.maximum = schema.maximum; 57 + } 58 + 59 + if (schema.exclusiveMinimum) { 60 + if (schema.minimum !== undefined) { 61 + irSchema.exclusiveMinimum = schema.minimum; 62 + } 63 + } else if (schema.minimum !== undefined) { 64 + irSchema.minimum = schema.minimum; 65 + } 66 + 47 67 if (schema.format) { 48 68 irSchema.format = schema.format; 69 + } 70 + 71 + if (schema.maxItems !== undefined) { 72 + irSchema.maxItems = schema.maxItems; 73 + } 74 + 75 + if (schema.maxLength !== undefined) { 76 + irSchema.maxLength = schema.maxLength; 77 + } 78 + 79 + if (schema.minItems !== undefined) { 80 + irSchema.minItems = schema.minItems; 81 + } 82 + 83 + if (schema.minLength !== undefined) { 84 + irSchema.minLength = schema.minLength; 49 85 } 50 86 51 87 if (schema.readOnly) {
+36
packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts
··· 74 74 } 75 75 } 76 76 77 + if (schema.default !== undefined) { 78 + irSchema.default = schema.default; 79 + } 80 + 81 + if (schema.exclusiveMaximum) { 82 + irSchema.exclusiveMaximum = schema.exclusiveMaximum; 83 + } 84 + 85 + if (schema.exclusiveMinimum) { 86 + irSchema.exclusiveMinimum = schema.exclusiveMinimum; 87 + } 88 + 77 89 if (schema.format) { 78 90 irSchema.format = schema.format; 91 + } 92 + 93 + if (schema.maximum !== undefined) { 94 + irSchema.maximum = schema.maximum; 95 + } 96 + 97 + if (schema.maxItems !== undefined) { 98 + irSchema.maxItems = schema.maxItems; 99 + } 100 + 101 + if (schema.maxLength !== undefined) { 102 + irSchema.maxLength = schema.maxLength; 103 + } 104 + 105 + if (schema.minimum !== undefined) { 106 + irSchema.minimum = schema.minimum; 107 + } 108 + 109 + if (schema.minItems !== undefined) { 110 + irSchema.minItems = schema.minItems; 111 + } 112 + 113 + if (schema.minLength !== undefined) { 114 + irSchema.minLength = schema.minLength; 79 115 } 80 116 81 117 if (schema.readOnly) {
+1 -1
packages/openapi-ts/src/openApi/common/parser/__tests__/getPattern.spec.ts
··· 16 16 { expected: '\\\\/', pattern: '\\/' }, 17 17 { expected: '\\\\/\\\\/', pattern: '\\/\\/' }, 18 18 { expected: "\\'", pattern: "'" }, 19 - ])('getPattern($pattern) -> $expected', ({ pattern, expected }) => { 19 + ])('getPattern($pattern) -> $expected', ({ expected, pattern }) => { 20 20 expect(getPattern(pattern)).toEqual(expected); 21 21 }); 22 22 });
+1 -1
packages/openapi-ts/src/openApi/common/parser/__tests__/operation.spec.ts
··· 12 12 { expected: '4XX', input: '4XX' }, 13 13 { expected: null, input: 'abc' }, 14 14 { expected: null, input: '-100' }, 15 - ])('parseResponseStatusCode($input) -> $expected', ({ input, expected }) => { 15 + ])('parseResponseStatusCode($input) -> $expected', ({ expected, input }) => { 16 16 expect(parseResponseStatusCode(input)).toBe(expected); 17 17 }); 18 18 });
+3 -3
packages/openapi-ts/src/openApi/common/parser/__tests__/sanitize.spec.ts
··· 15 15 { expected: 'unknownArray', input: 'unknown[]' }, 16 16 ])( 17 17 'sanitizeOperationParameterName($input) -> $expected', 18 - ({ input, expected }) => { 18 + ({ expected, input }) => { 19 19 expect(sanitizeOperationParameterName(input)).toEqual(expected); 20 20 }, 21 21 ); ··· 30 30 { expected: 'a-b-c--d--e', input: 'a/b{c}/d/$e' }, 31 31 ])( 32 32 'sanitizeNamespaceIdentifier($input) -> $expected', 33 - ({ input, expected }) => { 33 + ({ expected, input }) => { 34 34 expect(sanitizeNamespaceIdentifier(input)).toEqual(expected); 35 35 }, 36 36 ); ··· 45 45 { expected: '_400', input: '400' }, 46 46 ])( 47 47 'ensureValidTypeScriptJavaScriptIdentifier($input) -> $expected', 48 - ({ input, expected }) => { 48 + ({ expected, input }) => { 49 49 expect(ensureValidTypeScriptJavaScriptIdentifier(input)).toEqual( 50 50 expected, 51 51 );
+1 -1
packages/openapi-ts/src/openApi/common/parser/__tests__/service.spec.ts
··· 7 7 { expected: '1.0', input: '1.0' }, 8 8 { expected: '1.2', input: 'v1.2' }, 9 9 { expected: '2.4', input: 'V2.4' }, 10 - ])('should get $expected when version is $input', ({ input, expected }) => { 10 + ])('should get $expected when version is $input', ({ expected, input }) => { 11 11 expect(getServiceVersion(input)).toEqual(expected); 12 12 }); 13 13 });
+1 -1
packages/openapi-ts/src/openApi/common/parser/__tests__/sort.spec.ts
··· 30 30 }, 31 31 ])( 32 32 'should sort $input by required to produce $expected', 33 - ({ input, expected }) => { 33 + ({ expected, input }) => { 34 34 expect(toSortedByRequired(input)).toEqual(expected); 35 35 }, 36 36 );
+1 -1
packages/openapi-ts/src/openApi/common/parser/__tests__/stripNamespace.spec.ts
··· 17 17 { expected: 'Item', input: '#/components/securitySchemes/Item' }, 18 18 { expected: 'Item', input: '#/components/links/Item' }, 19 19 { expected: 'Item', input: '#/components/callbacks/Item' }, 20 - ])('stripNamespace($input) -> $expected', ({ input, expected }) => { 20 + ])('stripNamespace($input) -> $expected', ({ expected, input }) => { 21 21 expect(stripNamespace(input)).toEqual(expected); 22 22 }); 23 23 });
+1 -1
packages/openapi-ts/src/openApi/common/parser/__tests__/type.spec.ts
··· 43 43 { expected: 'unknown[]', type: 'array' }, 44 44 { expected: 'void', type: 'void' }, 45 45 { expected: undefined, type: '' }, 46 - ])('should map type $type to $expected', ({ type, expected }) => { 46 + ])('should map type $type to $expected', ({ expected, type }) => { 47 47 expect(getMappedType(type)).toEqual(expected); 48 48 }); 49 49 });
+1 -1
packages/openapi-ts/src/openApi/shared/utils/operation.ts
··· 9 9 */ 10 10 export const operationToId = ({ 11 11 context, 12 - method, 13 12 id, 13 + method, 14 14 path, 15 15 }: { 16 16 context: IRContext;
+1 -1
packages/openapi-ts/src/openApi/v2/parser/operation.ts
··· 18 18 method, 19 19 op, 20 20 openApi, 21 - types, 22 21 pathParams, 22 + types, 23 23 url, 24 24 }: { 25 25 method: Lowercase<Operation['method']>;
+1 -1
packages/openapi-ts/src/plugins/@hey-api/services/plugin-legacy.ts
··· 487 487 488 488 export const serviceFunctionIdentifier = ({ 489 489 config, 490 + handleIllegal, 490 491 id, 491 492 operation, 492 - handleIllegal, 493 493 }: { 494 494 config: Config; 495 495 handleIllegal?: boolean;
+2 -2
packages/openapi-ts/src/plugins/@hey-api/services/plugin.ts
··· 194 194 195 195 const services = new Map<string, Array<ts.MethodDeclaration>>(); 196 196 197 - context.subscribe('operation', ({ operation, method, path }) => { 197 + context.subscribe('operation', ({ method, operation, path }) => { 198 198 const identifierData = context.file({ id: 'types' })!.identifier({ 199 199 $ref: operationIrRef({ id: operation.id, type: 'data' }), 200 200 namespace: 'type', ··· 314 314 const file = context.file({ id: servicesId })!; 315 315 const typesModule = file.relativePathToFile({ context, id: 'types' }); 316 316 317 - context.subscribe('operation', ({ operation, method, path }) => { 317 + context.subscribe('operation', ({ method, operation, path }) => { 318 318 const identifierData = context.file({ id: 'types' })!.identifier({ 319 319 $ref: operationIrRef({ id: operation.id, type: 'data' }), 320 320 namespace: 'type',
+1 -1
packages/openapi-ts/src/plugins/@hey-api/types/plugin-legacy.ts
··· 56 56 }; 57 57 58 58 const generateEnum = ({ 59 - leadingComment, 60 59 comments, 60 + leadingComment, 61 61 meta, 62 62 obj, 63 63 onNode,
+2 -2
packages/openapi-ts/src/plugins/@tanstack/query-core/plugin-legacy.ts
··· 70 70 const toQueryKeyName = ({ 71 71 config, 72 72 id, 73 - operation, 74 73 isInfinite, 74 + operation, 75 75 }: { 76 76 config: Config; 77 77 id: string; ··· 645 645 }; 646 646 647 647 const createQueryKeyLiteral = ({ 648 - isInfinite, 649 648 id, 649 + isInfinite, 650 650 }: { 651 651 id: string; 652 652 isInfinite?: boolean;
+2 -2
packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts
··· 74 74 75 75 const queryKeyFunctionIdentifier = ({ 76 76 context, 77 - operation, 78 77 isInfinite, 78 + operation, 79 79 }: { 80 80 context: IRContext; 81 81 isInfinite?: boolean; ··· 510 510 }; 511 511 512 512 const createQueryKeyLiteral = ({ 513 - isInfinite, 514 513 id, 514 + isInfinite, 515 515 }: { 516 516 id: string; 517 517 isInfinite?: boolean;
+1 -2
packages/openapi-ts/src/plugins/zod/config.ts
··· 1 1 import type { DefineConfig, PluginConfig } from '../types'; 2 2 import { handler } from './plugin'; 3 - import { handlerLegacy } from './plugin-legacy'; 4 3 import type { Config } from './types'; 5 4 6 5 export const defaultConfig: PluginConfig<Config> = { 7 6 _handler: handler, 8 - _handlerLegacy: handlerLegacy, 7 + _handlerLegacy: () => {}, 9 8 name: 'zod', 10 9 output: 'zod', 11 10 };
-122
packages/openapi-ts/src/plugins/zod/plugin-legacy.ts
··· 1 - import { compiler } from '../../compiler'; 2 - import type { TypeScriptFile } from '../../generate/files'; 3 - import type { Model } from '../../types/client'; 4 - import type { PluginLegacyHandler } from '../types'; 5 - import type { Config } from './types'; 6 - 7 - const processArray = ({ 8 - file, 9 - model, 10 - }: { 11 - file: TypeScriptFile; 12 - model: Model; 13 - }) => { 14 - const identifier = file.identifier({ 15 - $ref: model.meta?.$ref || '', 16 - create: true, 17 - namespace: 'value', 18 - }); 19 - 20 - if (!identifier.created) { 21 - return; 22 - } 23 - 24 - const zArrayExpression = compiler.callExpression({ 25 - functionName: compiler.propertyAccessExpression({ 26 - expression: 'z', 27 - name: 'array', 28 - }), 29 - parameters: [ 30 - compiler.callExpression({ 31 - functionName: compiler.propertyAccessExpression({ 32 - expression: 'z', 33 - name: model.base, 34 - }), 35 - }), 36 - ], 37 - }); 38 - 39 - if (model.base === 'number') { 40 - let expression = zArrayExpression; 41 - 42 - if (model.minItems && model.maxItems && model.minItems === model.maxItems) { 43 - expression = compiler.callExpression({ 44 - functionName: compiler.propertyAccessExpression({ 45 - expression, 46 - name: 'length', 47 - }), 48 - parameters: [compiler.ots.number(model.minItems)], 49 - }); 50 - } else { 51 - if (model.minItems) { 52 - expression = compiler.callExpression({ 53 - functionName: compiler.propertyAccessExpression({ 54 - expression, 55 - name: 'min', 56 - }), 57 - parameters: [compiler.ots.number(model.minItems)], 58 - }); 59 - } 60 - 61 - if (model.maxItems) { 62 - expression = compiler.callExpression({ 63 - functionName: compiler.propertyAccessExpression({ 64 - expression, 65 - name: 'max', 66 - }), 67 - parameters: [compiler.ots.number(model.maxItems)], 68 - }); 69 - } 70 - } 71 - 72 - const statement = compiler.constVariable({ 73 - exportConst: true, 74 - expression, 75 - name: identifier.name || '', 76 - }); 77 - file.add(statement); 78 - return; 79 - } 80 - 81 - // console.warn('array!', model.base, model.name) 82 - const statement = compiler.constVariable({ 83 - exportConst: true, 84 - expression: compiler.callExpression({ 85 - functionName: compiler.propertyAccessExpression({ 86 - expression: 'z', 87 - name: 'object', 88 - }), 89 - parameters: [ 90 - compiler.objectExpression({ 91 - multiLine: true, 92 - obj: [], 93 - }), 94 - ], 95 - }), 96 - name: identifier.name || '', 97 - }); 98 - file.add(statement); 99 - }; 100 - 101 - export const handlerLegacy: PluginLegacyHandler<Config> = ({ 102 - client, 103 - files, 104 - plugin, 105 - }) => { 106 - const file = files[plugin.name]; 107 - 108 - file.import({ 109 - module: 'zod', 110 - name: 'z', 111 - }); 112 - 113 - for (const model of client.models) { 114 - switch (model.export) { 115 - case 'array': 116 - return processArray({ 117 - file, 118 - model, 119 - }); 120 - } 121 - } 122 - };
+181 -60
packages/openapi-ts/src/plugins/zod/plugin.ts
··· 18 18 const digitsRegExp = /^\d+$/; 19 19 20 20 // frequently used identifiers 21 + const defaultIdentifier = compiler.identifier({ text: 'default' }); 21 22 const optionalIdentifier = compiler.identifier({ text: 'optional' }); 23 + const readonlyIdentifier = compiler.identifier({ text: 'readonly' }); 22 24 const zIdentifier = compiler.identifier({ text: 'z' }); 23 25 24 26 const arrayTypeToZodSchema = ({ ··· 29 31 context: IRContext; 30 32 namespace: Array<ts.Statement>; 31 33 schema: SchemaWithType<'array'>; 32 - }) => { 34 + }): ts.CallExpression => { 35 + const functionName = compiler.propertyAccessExpression({ 36 + expression: zIdentifier, 37 + name: compiler.identifier({ text: schema.type }), 38 + }); 39 + 40 + let arrayExpression: ts.CallExpression | undefined; 41 + 33 42 if (!schema.items) { 34 - const expression = compiler.callExpression({ 35 - functionName: compiler.propertyAccessExpression({ 36 - expression: zIdentifier, 37 - name: compiler.identifier({ text: schema.type }), 38 - }), 43 + arrayExpression = compiler.callExpression({ 44 + functionName, 39 45 parameters: [ 40 46 unknownTypeToZodSchema({ 41 47 context, ··· 46 52 }), 47 53 ], 48 54 }); 49 - return expression; 50 - } 55 + } else { 56 + schema = deduplicateSchema({ schema }); 57 + 58 + // at least one item is guaranteed 59 + const itemExpressions = schema.items!.map((item) => 60 + schemaToZodSchema({ 61 + context, 62 + namespace, 63 + schema: item, 64 + }), 65 + ); 66 + 67 + if (itemExpressions.length === 1) { 68 + arrayExpression = compiler.callExpression({ 69 + functionName, 70 + parameters: itemExpressions, 71 + }); 72 + } else { 73 + if (schema.logicalOperator === 'and') { 74 + // TODO: parser - handle intersection 75 + // return compiler.typeArrayNode( 76 + // compiler.typeIntersectionNode({ types: itemExpressions }), 77 + // ); 78 + } 51 79 52 - schema = deduplicateSchema({ schema }); 80 + // TODO: parser - handle union 81 + // return compiler.typeArrayNode(compiler.typeUnionNode({ types: itemExpressions })); 53 82 54 - // at least one item is guaranteed 55 - const itemExpressions = schema.items!.map((item) => 56 - schemaToZodSchema({ 57 - context, 58 - namespace, 59 - schema: item, 60 - }), 61 - ); 83 + arrayExpression = compiler.callExpression({ 84 + functionName, 85 + parameters: [ 86 + unknownTypeToZodSchema({ 87 + context, 88 + namespace, 89 + schema: { 90 + type: 'unknown', 91 + }, 92 + }), 93 + ], 94 + }); 95 + } 96 + } 62 97 63 - if (itemExpressions.length === 1) { 64 - const expression = compiler.callExpression({ 98 + if (schema.minItems === schema.maxItems && schema.minItems !== undefined) { 99 + arrayExpression = compiler.callExpression({ 65 100 functionName: compiler.propertyAccessExpression({ 66 - expression: zIdentifier, 67 - name: compiler.identifier({ text: schema.type }), 101 + expression: arrayExpression, 102 + name: compiler.identifier({ text: 'length' }), 68 103 }), 69 - parameters: itemExpressions, 104 + parameters: [compiler.valueToExpression({ value: schema.minItems })], 70 105 }); 71 - return expression; 72 - } 106 + } else { 107 + if (schema.minItems !== undefined) { 108 + arrayExpression = compiler.callExpression({ 109 + functionName: compiler.propertyAccessExpression({ 110 + expression: arrayExpression, 111 + name: compiler.identifier({ text: 'min' }), 112 + }), 113 + parameters: [compiler.valueToExpression({ value: schema.minItems })], 114 + }); 115 + } 73 116 74 - if (schema.logicalOperator === 'and') { 75 - // TODO: parser - handle intersection 76 - // return compiler.typeArrayNode( 77 - // compiler.typeIntersectionNode({ types: itemExpressions }), 78 - // ); 117 + if (schema.maxItems !== undefined) { 118 + arrayExpression = compiler.callExpression({ 119 + functionName: compiler.propertyAccessExpression({ 120 + expression: arrayExpression, 121 + name: compiler.identifier({ text: 'max' }), 122 + }), 123 + parameters: [compiler.valueToExpression({ value: schema.maxItems })], 124 + }); 125 + } 79 126 } 80 127 81 - // TODO: parser - handle union 82 - // return compiler.typeArrayNode(compiler.typeUnionNode({ types: itemExpressions })); 83 - 84 - const expression = compiler.callExpression({ 85 - functionName: compiler.propertyAccessExpression({ 86 - expression: zIdentifier, 87 - name: compiler.identifier({ text: schema.type }), 88 - }), 89 - parameters: [ 90 - unknownTypeToZodSchema({ 91 - context, 92 - namespace, 93 - schema: { 94 - type: 'unknown', 95 - }, 96 - }), 97 - ], 98 - }); 99 - return expression; 128 + return arrayExpression; 100 129 }; 101 130 102 131 const booleanTypeToZodSchema = ({ ··· 130 159 context: IRContext; 131 160 namespace: Array<ts.Statement>; 132 161 schema: SchemaWithType<'enum'>; 133 - }): ts.Expression => { 162 + }): ts.CallExpression => { 134 163 const enumMembers: Array<ts.LiteralExpression> = []; 135 164 136 165 for (const item of schema.items ?? []) { ··· 209 238 namespace: Array<ts.Statement>; 210 239 schema: SchemaWithType<'number'>; 211 240 }) => { 212 - // TODO: parser - handle min/max length 241 + let numberExpression = compiler.callExpression({ 242 + functionName: compiler.propertyAccessExpression({ 243 + expression: zIdentifier, 244 + name: compiler.identifier({ text: schema.type }), 245 + }), 246 + }); 213 247 214 248 if (schema.const !== undefined) { 215 249 // TODO: parser - add constant ··· 218 252 // }); 219 253 } 220 254 221 - const expression = compiler.callExpression({ 222 - functionName: compiler.propertyAccessExpression({ 223 - expression: zIdentifier, 224 - name: compiler.identifier({ text: schema.type }), 225 - }), 226 - }); 227 - return expression; 255 + if (schema.exclusiveMinimum !== undefined) { 256 + numberExpression = compiler.callExpression({ 257 + functionName: compiler.propertyAccessExpression({ 258 + expression: numberExpression, 259 + name: compiler.identifier({ text: 'gt' }), 260 + }), 261 + parameters: [ 262 + compiler.valueToExpression({ value: schema.exclusiveMinimum }), 263 + ], 264 + }); 265 + } else if (schema.minimum !== undefined) { 266 + numberExpression = compiler.callExpression({ 267 + functionName: compiler.propertyAccessExpression({ 268 + expression: numberExpression, 269 + name: compiler.identifier({ text: 'gte' }), 270 + }), 271 + parameters: [compiler.valueToExpression({ value: schema.minimum })], 272 + }); 273 + } 274 + 275 + if (schema.exclusiveMaximum !== undefined) { 276 + numberExpression = compiler.callExpression({ 277 + functionName: compiler.propertyAccessExpression({ 278 + expression: numberExpression, 279 + name: compiler.identifier({ text: 'lt' }), 280 + }), 281 + parameters: [ 282 + compiler.valueToExpression({ value: schema.exclusiveMaximum }), 283 + ], 284 + }); 285 + } else if (schema.maximum !== undefined) { 286 + numberExpression = compiler.callExpression({ 287 + functionName: compiler.propertyAccessExpression({ 288 + expression: numberExpression, 289 + name: compiler.identifier({ text: 'lte' }), 290 + }), 291 + parameters: [compiler.valueToExpression({ value: schema.maximum })], 292 + }); 293 + } 294 + 295 + return numberExpression; 228 296 }; 229 297 230 298 const objectTypeToZodSchema = ({ ··· 258 326 propertyExpression = compiler.callExpression({ 259 327 functionName: compiler.propertyAccessExpression({ 260 328 expression: propertyExpression, 261 - name: compiler.identifier({ text: 'readonly' }), 329 + name: readonlyIdentifier, 262 330 }), 263 331 }); 264 332 } ··· 270 338 name: optionalIdentifier, 271 339 }), 272 340 }); 341 + } 342 + 343 + if (property.default !== undefined) { 344 + const callParameter = compiler.valueToExpression({ 345 + value: property.default, 346 + }); 347 + if (callParameter) { 348 + propertyExpression = compiler.callExpression({ 349 + functionName: compiler.propertyAccessExpression({ 350 + expression: propertyExpression, 351 + name: defaultIdentifier, 352 + }), 353 + parameters: [callParameter], 354 + }); 355 + } 273 356 } 274 357 275 358 digitsRegExp.lastIndex = 0; ··· 407 490 } 408 491 } 409 492 493 + if (schema.minLength === schema.maxLength && schema.minLength !== undefined) { 494 + stringExpression = compiler.callExpression({ 495 + functionName: compiler.propertyAccessExpression({ 496 + expression: stringExpression, 497 + name: compiler.identifier({ text: 'length' }), 498 + }), 499 + parameters: [compiler.valueToExpression({ value: schema.minLength })], 500 + }); 501 + } else { 502 + if (schema.minLength !== undefined) { 503 + stringExpression = compiler.callExpression({ 504 + functionName: compiler.propertyAccessExpression({ 505 + expression: stringExpression, 506 + name: compiler.identifier({ text: 'min' }), 507 + }), 508 + parameters: [compiler.valueToExpression({ value: schema.minLength })], 509 + }); 510 + } 511 + 512 + if (schema.maxLength !== undefined) { 513 + stringExpression = compiler.callExpression({ 514 + functionName: compiler.propertyAccessExpression({ 515 + expression: stringExpression, 516 + name: compiler.identifier({ text: 'max' }), 517 + }), 518 + parameters: [compiler.valueToExpression({ value: schema.maxLength })], 519 + }); 520 + } 521 + } 522 + 410 523 return stringExpression; 411 524 }; 412 525 ··· 579 692 namespace: 'value', 580 693 }); 581 694 if (identifier.name) { 582 - expression = compiler.identifier({ text: identifier.name || '' }); 695 + expression = compiler.identifier({ text: `z${identifier.name || ''}` }); 583 696 } else { 584 697 const ref = context.resolveIrRef<IRSchemaObject>(schema.$ref); 585 698 expression = schemaToZodSchema({ ··· 646 759 const statement = compiler.constVariable({ 647 760 exportConst: true, 648 761 expression, 649 - name: identifier.name || '', 762 + name: `z${identifier.name || ''}`, 650 763 }); 651 764 file.add(statement); 652 765 } ··· 664 777 module: 'zod', 665 778 name: 'z', 666 779 }); 780 + 781 + // context.subscribe('operation', ({ operation }) => { 782 + // schemaToZodSchema({ 783 + // $ref, 784 + // context, 785 + // schema, 786 + // }); 787 + // }); 667 788 668 789 context.subscribe('schema', ({ $ref, schema }) => { 669 790 schemaToZodSchema({
+6
packages/openapi-ts/src/plugins/zod/types.d.ts
··· 1 + // import type { IROperationObject, IRSchemaObject } from '../../ir/ir'; 1 2 import type { PluginName } from '../types'; 2 3 3 4 export interface Config extends PluginName<'zod'> { 5 + /** 6 + * Customise the Zod schema name. By default, `z{{name}}` is used, 7 + * where `name` is a definition name or an operation name. 8 + */ 9 + // nameBuilder?: (model: IROperationObject | IRSchemaObject) => string; 4 10 /** 5 11 * Name of the generated file. 6 12 * @default 'zod'
+2 -2
packages/openapi-ts/src/utils/__tests__/escape.spec.ts
··· 23 23 describe('escapeName', () => { 24 24 it.each(toCheck)( 25 25 'should escape $unescaped to $escaped', 26 - ({ unescaped, escaped }) => { 26 + ({ escaped, unescaped }) => { 27 27 expect(escapeName(unescaped)).toBe(escaped); 28 28 }, 29 29 ); ··· 32 32 describe('unescapeName', () => { 33 33 it.each(toCheck)( 34 34 'should unescape $escaped to $unescaped', 35 - ({ unescaped, escaped }) => { 35 + ({ escaped, unescaped }) => { 36 36 expect(unescapeName(escaped)).toBe(unescaped); 37 37 }, 38 38 );
+1 -1
packages/openapi-ts/src/utils/__tests__/parse.spec.ts
··· 289 289 }, 290 290 ])( 291 291 'getOperationName($url, $method, { operationId: $useOperationId }, $operationId) -> $expected', 292 - ({ url, method, options, operationId, expected }) => { 292 + ({ expected, method, operationId, options, url }) => { 293 293 setConfig(options); 294 294 expect( 295 295 operationNameFn({
+1 -1
packages/openapi-ts/src/utils/__tests__/postprocess.spec.ts
··· 27 27 expected: 'NonAsciiÆøåÆøÅöôêÊ字符串', 28 28 input: 'non-ascii-æøåÆØÅöôêÊ字符串', 29 29 }, 30 - ])('getServiceName($input) -> $expected', ({ input, expected }) => { 30 + ])('getServiceName($input) -> $expected', ({ expected, input }) => { 31 31 expect(getServiceName(input)).toEqual(expected); 32 32 }); 33 33 });
+1 -1
packages/openapi-ts/src/utils/__tests__/type.spec.ts
··· 28 28 { expected: 'fooBar', input: 'FOO-BAR' }, 29 29 { expected: 'fooBar', input: 'foo[bar]' }, 30 30 { expected: 'fooBarArray', input: 'foo.bar[]' }, 31 - ])('$input -> $expected', ({ input, expected }) => { 31 + ])('$input -> $expected', ({ expected, input }) => { 32 32 (isLegacyClient as MockedFunction<any>).mockImplementationOnce( 33 33 () => true, 34 34 );
+2 -2
packages/openapi-ts/src/utils/__tests__/unique.spec.ts
··· 11 11 { arr: ['y', 'z', 'a'], index: 2, result: true, value: 'a' }, 12 12 ])( 13 13 'unique($value, $index, $arr) -> $result', 14 - ({ value, index, arr, result }) => { 14 + ({ arr, index, result, value }) => { 15 15 expect(unique(value, index, arr)).toEqual(result); 16 16 }, 17 17 ); ··· 21 21 { expected: [1, 2, 3, 4, 5, 6], input: [1, 2, 3, 4, 4, 5, 6, 3] }, 22 22 ])( 23 23 'should filter: $input to the unique array: $expected', 24 - ({ input, expected }) => { 24 + ({ expected, input }) => { 25 25 expect(input.filter(unique)).toEqual(expected); 26 26 }, 27 27 );
+143 -143
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/zod/default/zod.gen.ts
··· 2 2 3 3 import { z } from 'zod'; 4 4 5 - export const _400 = z.string(); 5 + export const z_400 = z.string(); 6 6 7 - export const camelCaseCommentWithBreaks = z.number(); 7 + export const zcamelCaseCommentWithBreaks = z.number(); 8 8 9 - export const CommentWithBreaks = z.number(); 9 + export const zCommentWithBreaks = z.number(); 10 10 11 - export const CommentWithBackticks = z.number(); 11 + export const zCommentWithBackticks = z.number(); 12 12 13 - export const CommentWithBackticksAndQuotes = z.number(); 13 + export const zCommentWithBackticksAndQuotes = z.number(); 14 14 15 - export const CommentWithSlashes = z.number(); 15 + export const zCommentWithSlashes = z.number(); 16 16 17 - export const CommentWithExpressionPlaceholders = z.number(); 17 + export const zCommentWithExpressionPlaceholders = z.number(); 18 18 19 - export const CommentWithQuotes = z.number(); 19 + export const zCommentWithQuotes = z.number(); 20 20 21 - export const CommentWithReservedCharacters = z.number(); 21 + export const zCommentWithReservedCharacters = z.number(); 22 22 23 - export const SimpleInteger = z.number(); 23 + export const zSimpleInteger = z.number(); 24 24 25 - export const SimpleBoolean = z.boolean(); 25 + export const zSimpleBoolean = z.boolean(); 26 26 27 - export const SimpleString = z.string(); 27 + export const zSimpleString = z.string(); 28 28 29 - export const NonAsciiStringæøåÆØÅöôêÊ字符串 = z.string(); 29 + export const zNonAsciiStringæøåÆØÅöôêÊ字符串 = z.string(); 30 30 31 - export const SimpleFile = z.string(); 31 + export const zSimpleFile = z.string(); 32 32 33 - export const SimpleReference = z.object({ 33 + export const zSimpleReference = z.object({ 34 34 prop: z.string().optional() 35 35 }); 36 36 37 - export const SimpleStringWithPattern = z.unknown(); 37 + export const zSimpleStringWithPattern = z.unknown(); 38 38 39 - export const EnumWithStrings = z.enum([ 39 + export const zEnumWithStrings = z.enum([ 40 40 'Success', 41 41 'Warning', 42 42 'Error', ··· 45 45 'Non-ascii: øæåôöØÆÅÔÖ字符串' 46 46 ]); 47 47 48 - export const EnumWithReplacedCharacters = z.enum([ 48 + export const zEnumWithReplacedCharacters = z.enum([ 49 49 "'Single Quote'", 50 50 '"Double Quotes"', 51 51 'øæåôöØÆÅÔÖ字符串', 52 52 '' 53 53 ]); 54 54 55 - export const EnumWithNumbers = z.unknown(); 55 + export const zEnumWithNumbers = z.unknown(); 56 56 57 - export const EnumFromDescription = z.number(); 57 + export const zEnumFromDescription = z.number(); 58 58 59 - export const EnumWithExtensions = z.unknown(); 59 + export const zEnumWithExtensions = z.unknown(); 60 60 61 - export const EnumWithXEnumNames = z.unknown(); 61 + export const zEnumWithXEnumNames = z.unknown(); 62 62 63 - export const ArrayWithNumbers = z.array(z.number()); 63 + export const zArrayWithNumbers = z.array(z.number()); 64 64 65 - export const ArrayWithBooleans = z.array(z.boolean()); 65 + export const zArrayWithBooleans = z.array(z.boolean()); 66 66 67 - export const ArrayWithStrings = z.array(z.string()); 67 + export const zArrayWithStrings = z.array(z.string()); 68 68 69 - export const ArrayWithReferences = z.array(z.object({ 69 + export const zArrayWithReferences = z.array(z.object({ 70 70 prop: z.string().optional() 71 71 })); 72 72 73 - export const ArrayWithArray = z.array(z.array(z.object({ 73 + export const zArrayWithArray = z.array(z.array(z.object({ 74 74 prop: z.string().optional() 75 75 }))); 76 76 77 - export const ArrayWithProperties = z.array(z.object({ 78 - '16x16': camelCaseCommentWithBreaks.optional(), 77 + export const zArrayWithProperties = z.array(z.object({ 78 + '16x16': zcamelCaseCommentWithBreaks.optional(), 79 79 bar: z.string().optional() 80 80 })); 81 81 82 - export const ArrayWithAnyOfProperties = z.array(z.unknown()); 82 + export const zArrayWithAnyOfProperties = z.array(z.unknown()); 83 83 84 - export const AnyOfAnyAndNull = z.object({ 84 + export const zAnyOfAnyAndNull = z.object({ 85 85 data: z.unknown().optional() 86 86 }); 87 87 88 - export const AnyOfArrays = z.object({ 88 + export const zAnyOfArrays = z.object({ 89 89 results: z.array(z.unknown()).optional() 90 90 }); 91 91 92 - export const DictionaryWithString = z.object({}); 92 + export const zDictionaryWithString = z.object({}); 93 93 94 - export const DictionaryWithPropertiesAndAdditionalProperties = z.object({ 94 + export const zDictionaryWithPropertiesAndAdditionalProperties = z.object({ 95 95 foo: z.number().optional(), 96 96 bar: z.boolean().optional() 97 97 }); 98 98 99 - export const DictionaryWithReference = z.object({}); 99 + export const zDictionaryWithReference = z.object({}); 100 100 101 - export const DictionaryWithArray = z.object({}); 101 + export const zDictionaryWithArray = z.object({}); 102 102 103 - export const DictionaryWithDictionary = z.object({}); 103 + export const zDictionaryWithDictionary = z.object({}); 104 104 105 - export const DictionaryWithProperties = z.object({}); 105 + export const zDictionaryWithProperties = z.object({}); 106 106 107 - export const ModelWithInteger = z.object({ 107 + export const zModelWithInteger = z.object({ 108 108 prop: z.number().optional() 109 109 }); 110 110 111 - export const ModelWithBoolean = z.object({ 111 + export const zModelWithBoolean = z.object({ 112 112 prop: z.boolean().optional() 113 113 }); 114 114 115 - export const ModelWithString = z.object({ 115 + export const zModelWithString = z.object({ 116 116 prop: z.string().optional() 117 117 }); 118 118 119 - export const ModelWithStringError = z.object({ 119 + export const zModelWithStringError = z.object({ 120 120 prop: z.string().optional() 121 121 }); 122 122 123 - export const Model_From_Zendesk = z.string(); 123 + export const zModel_From_Zendesk = z.string(); 124 124 125 - export const ModelWithNullableString = z.object({ 125 + export const zModelWithNullableString = z.object({ 126 126 nullableProp1: z.unknown().optional(), 127 127 nullableRequiredProp1: z.unknown(), 128 128 nullableProp2: z.unknown().optional(), ··· 135 135 ]).optional() 136 136 }); 137 137 138 - export const ModelWithEnum = z.object({ 138 + export const zModelWithEnum = z.object({ 139 139 'foo_bar-enum': z.enum([ 140 140 'Success', 141 141 'Warning', ··· 153 153 bool: z.unknown().optional() 154 154 }); 155 155 156 - export const ModelWithEnumWithHyphen = z.object({ 156 + export const zModelWithEnumWithHyphen = z.object({ 157 157 'foo-bar-baz-qux': z.enum([ 158 158 '3.0' 159 159 ]).optional() 160 160 }); 161 161 162 - export const ModelWithEnumFromDescription = z.object({ 162 + export const zModelWithEnumFromDescription = z.object({ 163 163 test: z.number().optional() 164 164 }); 165 165 166 - export const ModelWithNestedEnums = z.object({ 166 + export const zModelWithNestedEnums = z.object({ 167 167 dictionaryWithEnum: z.object({}).optional(), 168 168 dictionaryWithEnumFromDescription: z.object({}).optional(), 169 169 arrayWithEnum: z.array(z.enum([ ··· 180 180 ]).optional() 181 181 }); 182 182 183 - export const ModelWithReference = z.object({ 183 + export const zModelWithReference = z.object({ 184 184 prop: z.object({ 185 185 required: z.string(), 186 186 requiredAndReadOnly: z.string().readonly(), ··· 188 188 string: z.string().optional(), 189 189 number: z.number().optional(), 190 190 boolean: z.boolean().optional(), 191 - reference: ModelWithString.optional(), 191 + reference: zModelWithString.optional(), 192 192 'property with space': z.string().optional(), 193 193 default: z.string().optional(), 194 194 try: z.string().optional(), ··· 197 197 }).optional() 198 198 }); 199 199 200 - export const ModelWithArrayReadOnlyAndWriteOnly = z.object({ 200 + export const zModelWithArrayReadOnlyAndWriteOnly = z.object({ 201 201 prop: z.array(z.object({ 202 202 foo: z.string(), 203 203 bar: z.string().readonly(), ··· 207 207 propWithNumber: z.array(z.number()).optional() 208 208 }); 209 209 210 - export const ModelWithArray = z.object({ 211 - prop: z.array(ModelWithString).optional(), 210 + export const zModelWithArray = z.object({ 211 + prop: z.array(zModelWithString).optional(), 212 212 propWithFile: z.array(z.string()).optional(), 213 213 propWithNumber: z.array(z.number()).optional() 214 214 }); 215 215 216 - export const ModelWithDictionary = z.object({ 216 + export const zModelWithDictionary = z.object({ 217 217 prop: z.object({}).optional() 218 218 }); 219 219 220 - export const DeprecatedModel = z.object({ 220 + export const zDeprecatedModel = z.object({ 221 221 prop: z.string().optional() 222 222 }); 223 223 224 - export const CompositionWithOneOf = z.object({ 224 + export const zCompositionWithOneOf = z.object({ 225 225 propA: z.unknown().optional() 226 226 }); 227 227 228 - export const CompositionWithOneOfAnonymous = z.object({ 228 + export const zCompositionWithOneOfAnonymous = z.object({ 229 229 propA: z.unknown().optional() 230 230 }); 231 231 232 - export const ModelCircle = z.object({ 232 + export const zModelCircle = z.object({ 233 233 kind: z.string(), 234 234 radius: z.number().optional() 235 235 }); 236 236 237 - export const ModelSquare = z.object({ 237 + export const zModelSquare = z.object({ 238 238 kind: z.string(), 239 239 sideLength: z.number().optional() 240 240 }); 241 241 242 - export const CompositionWithOneOfDiscriminator = z.unknown(); 242 + export const zCompositionWithOneOfDiscriminator = z.unknown(); 243 243 244 - export const CompositionWithAnyOf = z.object({ 244 + export const zCompositionWithAnyOf = z.object({ 245 245 propA: z.unknown().optional() 246 246 }); 247 247 248 - export const CompositionWithAnyOfAnonymous = z.object({ 248 + export const zCompositionWithAnyOfAnonymous = z.object({ 249 249 propA: z.unknown().optional() 250 250 }); 251 251 252 - export const CompositionWithNestedAnyAndTypeNull = z.object({ 252 + export const zCompositionWithNestedAnyAndTypeNull = z.object({ 253 253 propA: z.unknown().optional() 254 254 }); 255 255 256 - export const _3e_num_1Период = z.enum([ 256 + export const z_3e_num_1Период = z.enum([ 257 257 'Bird', 258 258 'Dog' 259 259 ]); 260 260 261 - export const ConstValue = z.enum([ 261 + export const zConstValue = z.enum([ 262 262 'ConstValue' 263 263 ]); 264 264 265 - export const CompositionWithNestedAnyOfAndNull = z.object({ 265 + export const zCompositionWithNestedAnyOfAndNull = z.object({ 266 266 propA: z.unknown().optional() 267 267 }); 268 268 269 - export const CompositionWithOneOfAndNullable = z.object({ 269 + export const zCompositionWithOneOfAndNullable = z.object({ 270 270 propA: z.unknown().optional() 271 271 }); 272 272 273 - export const CompositionWithOneOfAndSimpleDictionary = z.object({ 273 + export const zCompositionWithOneOfAndSimpleDictionary = z.object({ 274 274 propA: z.unknown().optional() 275 275 }); 276 276 277 - export const CompositionWithOneOfAndSimpleArrayDictionary = z.object({ 277 + export const zCompositionWithOneOfAndSimpleArrayDictionary = z.object({ 278 278 propA: z.unknown().optional() 279 279 }); 280 280 281 - export const CompositionWithOneOfAndComplexArrayDictionary = z.object({ 281 + export const zCompositionWithOneOfAndComplexArrayDictionary = z.object({ 282 282 propA: z.unknown().optional() 283 283 }); 284 284 285 - export const CompositionWithAllOfAndNullable = z.object({ 285 + export const zCompositionWithAllOfAndNullable = z.object({ 286 286 propA: z.unknown().optional() 287 287 }); 288 288 289 - export const CompositionWithAnyOfAndNullable = z.object({ 289 + export const zCompositionWithAnyOfAndNullable = z.object({ 290 290 propA: z.unknown().optional() 291 291 }); 292 292 293 - export const CompositionBaseModel = z.object({ 293 + export const zCompositionBaseModel = z.object({ 294 294 firstName: z.string().optional(), 295 295 lastname: z.string().optional() 296 296 }); 297 297 298 - export const CompositionExtendedModel = z.unknown(); 298 + export const zCompositionExtendedModel = z.unknown(); 299 299 300 - export const ModelWithProperties = z.object({ 300 + export const zModelWithProperties = z.object({ 301 301 required: z.string(), 302 302 requiredAndReadOnly: z.string().readonly(), 303 303 requiredAndNullable: z.unknown(), 304 304 string: z.string().optional(), 305 305 number: z.number().optional(), 306 306 boolean: z.boolean().optional(), 307 - reference: ModelWithString.optional(), 307 + reference: zModelWithString.optional(), 308 308 'property with space': z.string().optional(), 309 309 default: z.string().optional(), 310 310 try: z.string().optional(), ··· 312 312 '@namespace.integer': z.number().readonly().optional() 313 313 }); 314 314 315 - export const ModelWithNestedProperties = z.object({ 315 + export const zModelWithNestedProperties = z.object({ 316 316 first: z.unknown().readonly() 317 317 }); 318 318 319 - export const ModelWithDuplicateProperties = z.object({ 320 - prop: ModelWithString.optional() 319 + export const zModelWithDuplicateProperties = z.object({ 320 + prop: zModelWithString.optional() 321 321 }); 322 322 323 - export const ModelWithOrderedProperties = z.object({ 323 + export const zModelWithOrderedProperties = z.object({ 324 324 zebra: z.string().optional(), 325 325 apple: z.string().optional(), 326 326 hawaii: z.string().optional() 327 327 }); 328 328 329 - export const ModelWithDuplicateImports = z.object({ 330 - propA: ModelWithString.optional(), 331 - propB: ModelWithString.optional(), 332 - propC: ModelWithString.optional() 329 + export const zModelWithDuplicateImports = z.object({ 330 + propA: zModelWithString.optional(), 331 + propB: zModelWithString.optional(), 332 + propC: zModelWithString.optional() 333 333 }); 334 334 335 - export const ModelThatExtends = z.unknown(); 335 + export const zModelThatExtends = z.unknown(); 336 336 337 - export const ModelThatExtendsExtends = z.unknown(); 337 + export const zModelThatExtendsExtends = z.unknown(); 338 338 339 - export const ModelWithPattern = z.object({ 340 - key: z.string(), 341 - name: z.string(), 339 + export const zModelWithPattern = z.object({ 340 + key: z.string().max(64), 341 + name: z.string().max(255), 342 342 enabled: z.boolean().readonly().optional(), 343 343 modified: z.string().datetime().readonly().optional(), 344 344 id: z.string().optional(), ··· 348 348 patternWithBacktick: z.string().optional() 349 349 }); 350 350 351 - export const File = z.object({ 352 - id: z.string().readonly().optional(), 351 + export const zFile = z.object({ 352 + id: z.string().min(1).readonly().optional(), 353 353 updated_at: z.string().datetime().readonly().optional(), 354 354 created_at: z.string().datetime().readonly().optional(), 355 - mime: z.string(), 355 + mime: z.string().min(1).max(24), 356 356 file: z.string().url().readonly().optional() 357 357 }); 358 358 359 - export const _default = z.object({ 359 + export const z_default = z.object({ 360 360 name: z.string().optional() 361 361 }); 362 362 363 - export const Pageable = z.object({ 364 - page: z.number().optional(), 365 - size: z.number().optional(), 363 + export const zPageable = z.object({ 364 + page: z.number().gte(0).optional().default(0), 365 + size: z.number().gte(1).optional(), 366 366 sort: z.array(z.string()).optional() 367 367 }); 368 368 369 - export const FreeFormObjectWithoutAdditionalProperties = z.object({}); 369 + export const zFreeFormObjectWithoutAdditionalProperties = z.object({}); 370 370 371 - export const FreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 371 + export const zFreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 372 372 373 - export const FreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 373 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 374 374 375 - export const ModelWithConst = z.object({ 375 + export const zModelWithConst = z.object({ 376 376 String: z.enum([ 377 377 'String' 378 378 ]).optional(), ··· 383 383 ]).optional() 384 384 }); 385 385 386 - export const ModelWithAdditionalPropertiesEqTrue = z.object({ 386 + export const zModelWithAdditionalPropertiesEqTrue = z.object({ 387 387 prop: z.string().optional() 388 388 }); 389 389 390 - export const NestedAnyOfArraysNullable = z.object({ 390 + export const zNestedAnyOfArraysNullable = z.object({ 391 391 nullableArray: z.unknown().optional() 392 392 }); 393 393 394 - export const CompositionWithOneOfAndProperties = z.unknown(); 394 + export const zCompositionWithOneOfAndProperties = z.unknown(); 395 395 396 - export const NullableObject = z.unknown(); 396 + export const zNullableObject = z.unknown(); 397 397 398 - export const CharactersInDescription = z.string(); 398 + export const zCharactersInDescription = z.string(); 399 399 400 - export const ModelWithNullableObject = z.object({ 401 - data: NullableObject.optional() 400 + export const zModelWithNullableObject = z.object({ 401 + data: zNullableObject.optional() 402 402 }); 403 403 404 - export const ModelWithOneOfEnum = z.unknown(); 404 + export const zModelWithOneOfEnum = z.unknown(); 405 405 406 - export const ModelWithNestedArrayEnumsDataFoo = z.enum([ 406 + export const zModelWithNestedArrayEnumsDataFoo = z.enum([ 407 407 'foo', 408 408 'bar' 409 409 ]); 410 410 411 - export const ModelWithNestedArrayEnumsDataBar = z.enum([ 411 + export const zModelWithNestedArrayEnumsDataBar = z.enum([ 412 412 'baz', 413 413 'qux' 414 414 ]); 415 415 416 - export const ModelWithNestedArrayEnumsData = z.object({ 417 - foo: z.array(ModelWithNestedArrayEnumsDataFoo).optional(), 418 - bar: z.array(ModelWithNestedArrayEnumsDataBar).optional() 416 + export const zModelWithNestedArrayEnumsData = z.object({ 417 + foo: z.array(zModelWithNestedArrayEnumsDataFoo).optional(), 418 + bar: z.array(zModelWithNestedArrayEnumsDataBar).optional() 419 419 }); 420 420 421 - export const ModelWithNestedArrayEnums = z.object({ 421 + export const zModelWithNestedArrayEnums = z.object({ 422 422 array_strings: z.array(z.string()).optional(), 423 - data: ModelWithNestedArrayEnumsData.optional() 423 + data: zModelWithNestedArrayEnumsData.optional() 424 424 }); 425 425 426 - export const ModelWithNestedCompositionEnums = z.object({ 427 - foo: ModelWithNestedArrayEnumsDataFoo.optional() 426 + export const zModelWithNestedCompositionEnums = z.object({ 427 + foo: zModelWithNestedArrayEnumsDataFoo.optional() 428 428 }); 429 429 430 - export const ModelWithReadOnlyAndWriteOnly = z.object({ 430 + export const zModelWithReadOnlyAndWriteOnly = z.object({ 431 431 foo: z.string(), 432 432 bar: z.string().readonly(), 433 433 baz: z.string() 434 434 }); 435 435 436 - export const ModelWithConstantSizeArray = z.unknown(); 436 + export const zModelWithConstantSizeArray = z.unknown(); 437 437 438 - export const ModelWithAnyOfConstantSizeArray = z.unknown(); 438 + export const zModelWithAnyOfConstantSizeArray = z.unknown(); 439 439 440 - export const ModelWithPrefixItemsConstantSizeArray = z.array(z.unknown()); 440 + export const zModelWithPrefixItemsConstantSizeArray = z.array(z.unknown()); 441 441 442 - export const ModelWithAnyOfConstantSizeArrayNullable = z.unknown(); 442 + export const zModelWithAnyOfConstantSizeArrayNullable = z.unknown(); 443 443 444 - export const ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.unknown(); 444 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.unknown(); 445 445 446 - export const ModelWithAnyOfConstantSizeArrayAndIntersect = z.unknown(); 446 + export const zModelWithAnyOfConstantSizeArrayAndIntersect = z.unknown(); 447 447 448 - export const ModelWithNumericEnumUnion = z.object({ 448 + export const zModelWithNumericEnumUnion = z.object({ 449 449 value: z.unknown().optional() 450 450 }); 451 451 452 - export const ModelWithBackticksInDescription = z.object({ 452 + export const zModelWithBackticksInDescription = z.object({ 453 453 template: z.string().optional() 454 454 }); 455 455 456 - export const ModelWithOneOfAndProperties = z.unknown(); 456 + export const zModelWithOneOfAndProperties = z.unknown(); 457 457 458 - export const ParameterSimpleParameterUnused = z.string(); 458 + export const zParameterSimpleParameterUnused = z.string(); 459 459 460 - export const PostServiceWithEmptyTagResponse = z.string(); 460 + export const zPostServiceWithEmptyTagResponse = z.string(); 461 461 462 - export const PostServiceWithEmptyTagResponse2 = z.string(); 462 + export const zPostServiceWithEmptyTagResponse2 = z.string(); 463 463 464 - export const DeleteFooData = z.string(); 464 + export const zDeleteFooData = z.string(); 465 465 466 - export const DeleteFooData2 = z.string(); 466 + export const zDeleteFooData2 = z.string(); 467 467 468 - export const _import = z.string(); 468 + export const z_import = z.string(); 469 469 470 - export const SchemaWithFormRestrictedKeys = z.object({ 470 + export const zSchemaWithFormRestrictedKeys = z.object({ 471 471 description: z.string().optional(), 472 472 'x-enum-descriptions': z.string().optional(), 473 473 'x-enum-varnames': z.string().optional(), ··· 489 489 })).optional() 490 490 }); 491 491 492 - export const io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = z.object({ 492 + export const zio_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = z.object({ 493 493 preconditions: z.object({ 494 494 resourceVersion: z.string().optional(), 495 495 uid: z.string().optional() 496 496 }).optional() 497 497 }); 498 498 499 - export const io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = z.object({ 499 + export const zio_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = z.object({ 500 500 resourceVersion: z.string().optional(), 501 501 uid: z.string().optional() 502 502 }); 503 503 504 - export const AdditionalPropertiesUnknownIssue = z.object({}); 504 + export const zAdditionalPropertiesUnknownIssue = z.object({}); 505 505 506 - export const AdditionalPropertiesUnknownIssue2 = z.object({}); 506 + export const zAdditionalPropertiesUnknownIssue2 = z.object({}); 507 507 508 - export const AdditionalPropertiesUnknownIssue3 = z.unknown(); 508 + export const zAdditionalPropertiesUnknownIssue3 = z.unknown(); 509 509 510 - export const AdditionalPropertiesIntegerIssue = z.object({ 510 + export const zAdditionalPropertiesIntegerIssue = z.object({ 511 511 value: z.number() 512 512 }); 513 513 514 - export const OneOfAllOfIssue = z.unknown(); 514 + export const zOneOfAllOfIssue = z.unknown(); 515 515 516 - export const Generic_Schema_Duplicate_Issue_1_System_Boolean_ = z.object({ 516 + export const zGeneric_Schema_Duplicate_Issue_1_System_Boolean_ = z.object({ 517 517 item: z.boolean().optional(), 518 518 error: z.unknown().optional(), 519 519 hasError: z.boolean().readonly().optional(), 520 520 data: z.object({}).optional() 521 521 }); 522 522 523 - export const Generic_Schema_Duplicate_Issue_1_System_String_ = z.object({ 523 + export const zGeneric_Schema_Duplicate_Issue_1_System_String_ = z.object({ 524 524 item: z.unknown().optional(), 525 525 error: z.unknown().optional(), 526 526 hasError: z.boolean().readonly().optional()
+143 -143
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/zod/default/zod.gen.ts
··· 2 2 3 3 import { z } from 'zod'; 4 4 5 - export const _400 = z.string(); 5 + export const z_400 = z.string(); 6 6 7 - export const camelCaseCommentWithBreaks = z.number(); 7 + export const zcamelCaseCommentWithBreaks = z.number(); 8 8 9 - export const CommentWithBreaks = z.number(); 9 + export const zCommentWithBreaks = z.number(); 10 10 11 - export const CommentWithBackticks = z.number(); 11 + export const zCommentWithBackticks = z.number(); 12 12 13 - export const CommentWithBackticksAndQuotes = z.number(); 13 + export const zCommentWithBackticksAndQuotes = z.number(); 14 14 15 - export const CommentWithSlashes = z.number(); 15 + export const zCommentWithSlashes = z.number(); 16 16 17 - export const CommentWithExpressionPlaceholders = z.number(); 17 + export const zCommentWithExpressionPlaceholders = z.number(); 18 18 19 - export const CommentWithQuotes = z.number(); 19 + export const zCommentWithQuotes = z.number(); 20 20 21 - export const CommentWithReservedCharacters = z.number(); 21 + export const zCommentWithReservedCharacters = z.number(); 22 22 23 - export const SimpleInteger = z.number(); 23 + export const zSimpleInteger = z.number(); 24 24 25 - export const SimpleBoolean = z.boolean(); 25 + export const zSimpleBoolean = z.boolean(); 26 26 27 - export const SimpleString = z.string(); 27 + export const zSimpleString = z.string(); 28 28 29 - export const NonAsciiStringæøåÆØÅöôêÊ字符串 = z.string(); 29 + export const zNonAsciiStringæøåÆØÅöôêÊ字符串 = z.string(); 30 30 31 - export const SimpleFile = z.string(); 31 + export const zSimpleFile = z.string(); 32 32 33 - export const SimpleReference = z.object({ 33 + export const zSimpleReference = z.object({ 34 34 prop: z.string().optional() 35 35 }); 36 36 37 - export const SimpleStringWithPattern = z.unknown(); 37 + export const zSimpleStringWithPattern = z.unknown(); 38 38 39 - export const EnumWithStrings = z.enum([ 39 + export const zEnumWithStrings = z.enum([ 40 40 'Success', 41 41 'Warning', 42 42 'Error', ··· 45 45 'Non-ascii: øæåôöØÆÅÔÖ字符串' 46 46 ]); 47 47 48 - export const EnumWithReplacedCharacters = z.enum([ 48 + export const zEnumWithReplacedCharacters = z.enum([ 49 49 "'Single Quote'", 50 50 '"Double Quotes"', 51 51 'øæåôöØÆÅÔÖ字符串', 52 52 '' 53 53 ]); 54 54 55 - export const EnumWithNumbers = z.unknown(); 55 + export const zEnumWithNumbers = z.unknown(); 56 56 57 - export const EnumFromDescription = z.number(); 57 + export const zEnumFromDescription = z.number(); 58 58 59 - export const EnumWithExtensions = z.unknown(); 59 + export const zEnumWithExtensions = z.unknown(); 60 60 61 - export const EnumWithXEnumNames = z.unknown(); 61 + export const zEnumWithXEnumNames = z.unknown(); 62 62 63 - export const ArrayWithNumbers = z.array(z.number()); 63 + export const zArrayWithNumbers = z.array(z.number()); 64 64 65 - export const ArrayWithBooleans = z.array(z.boolean()); 65 + export const zArrayWithBooleans = z.array(z.boolean()); 66 66 67 - export const ArrayWithStrings = z.array(z.string()); 67 + export const zArrayWithStrings = z.array(z.string()); 68 68 69 - export const ArrayWithReferences = z.array(z.object({ 69 + export const zArrayWithReferences = z.array(z.object({ 70 70 prop: z.string().optional() 71 71 })); 72 72 73 - export const ArrayWithArray = z.array(z.array(z.object({ 73 + export const zArrayWithArray = z.array(z.array(z.object({ 74 74 prop: z.string().optional() 75 75 }))); 76 76 77 - export const ArrayWithProperties = z.array(z.object({ 78 - '16x16': camelCaseCommentWithBreaks.optional(), 77 + export const zArrayWithProperties = z.array(z.object({ 78 + '16x16': zcamelCaseCommentWithBreaks.optional(), 79 79 bar: z.string().optional() 80 80 })); 81 81 82 - export const ArrayWithAnyOfProperties = z.array(z.unknown()); 82 + export const zArrayWithAnyOfProperties = z.array(z.unknown()); 83 83 84 - export const AnyOfAnyAndNull = z.object({ 84 + export const zAnyOfAnyAndNull = z.object({ 85 85 data: z.unknown().optional() 86 86 }); 87 87 88 - export const AnyOfArrays = z.object({ 88 + export const zAnyOfArrays = z.object({ 89 89 results: z.array(z.unknown()).optional() 90 90 }); 91 91 92 - export const DictionaryWithString = z.object({}); 92 + export const zDictionaryWithString = z.object({}); 93 93 94 - export const DictionaryWithPropertiesAndAdditionalProperties = z.object({ 94 + export const zDictionaryWithPropertiesAndAdditionalProperties = z.object({ 95 95 foo: z.number().optional(), 96 96 bar: z.boolean().optional() 97 97 }); 98 98 99 - export const DictionaryWithReference = z.object({}); 99 + export const zDictionaryWithReference = z.object({}); 100 100 101 - export const DictionaryWithArray = z.object({}); 101 + export const zDictionaryWithArray = z.object({}); 102 102 103 - export const DictionaryWithDictionary = z.object({}); 103 + export const zDictionaryWithDictionary = z.object({}); 104 104 105 - export const DictionaryWithProperties = z.object({}); 105 + export const zDictionaryWithProperties = z.object({}); 106 106 107 - export const ModelWithInteger = z.object({ 107 + export const zModelWithInteger = z.object({ 108 108 prop: z.number().optional() 109 109 }); 110 110 111 - export const ModelWithBoolean = z.object({ 111 + export const zModelWithBoolean = z.object({ 112 112 prop: z.boolean().optional() 113 113 }); 114 114 115 - export const ModelWithString = z.object({ 115 + export const zModelWithString = z.object({ 116 116 prop: z.string().optional() 117 117 }); 118 118 119 - export const ModelWithStringError = z.object({ 119 + export const zModelWithStringError = z.object({ 120 120 prop: z.string().optional() 121 121 }); 122 122 123 - export const Model_From_Zendesk = z.string(); 123 + export const zModel_From_Zendesk = z.string(); 124 124 125 - export const ModelWithNullableString = z.object({ 125 + export const zModelWithNullableString = z.object({ 126 126 nullableProp1: z.unknown().optional(), 127 127 nullableRequiredProp1: z.unknown(), 128 128 nullableProp2: z.unknown().optional(), ··· 135 135 ]).optional() 136 136 }); 137 137 138 - export const ModelWithEnum = z.object({ 138 + export const zModelWithEnum = z.object({ 139 139 'foo_bar-enum': z.enum([ 140 140 'Success', 141 141 'Warning', ··· 153 153 bool: z.unknown().optional() 154 154 }); 155 155 156 - export const ModelWithEnumWithHyphen = z.object({ 156 + export const zModelWithEnumWithHyphen = z.object({ 157 157 'foo-bar-baz-qux': z.enum([ 158 158 '3.0' 159 159 ]).optional() 160 160 }); 161 161 162 - export const ModelWithEnumFromDescription = z.object({ 162 + export const zModelWithEnumFromDescription = z.object({ 163 163 test: z.number().optional() 164 164 }); 165 165 166 - export const ModelWithNestedEnums = z.object({ 166 + export const zModelWithNestedEnums = z.object({ 167 167 dictionaryWithEnum: z.object({}).optional(), 168 168 dictionaryWithEnumFromDescription: z.object({}).optional(), 169 169 arrayWithEnum: z.array(z.enum([ ··· 180 180 ]).optional() 181 181 }); 182 182 183 - export const ModelWithReference = z.object({ 183 + export const zModelWithReference = z.object({ 184 184 prop: z.object({ 185 185 required: z.string(), 186 186 requiredAndReadOnly: z.string().readonly(), ··· 188 188 string: z.string().optional(), 189 189 number: z.number().optional(), 190 190 boolean: z.boolean().optional(), 191 - reference: ModelWithString.optional(), 191 + reference: zModelWithString.optional(), 192 192 'property with space': z.string().optional(), 193 193 default: z.string().optional(), 194 194 try: z.string().optional(), ··· 197 197 }).optional() 198 198 }); 199 199 200 - export const ModelWithArrayReadOnlyAndWriteOnly = z.object({ 200 + export const zModelWithArrayReadOnlyAndWriteOnly = z.object({ 201 201 prop: z.array(z.object({ 202 202 foo: z.string(), 203 203 bar: z.string().readonly(), ··· 207 207 propWithNumber: z.array(z.number()).optional() 208 208 }); 209 209 210 - export const ModelWithArray = z.object({ 211 - prop: z.array(ModelWithString).optional(), 210 + export const zModelWithArray = z.object({ 211 + prop: z.array(zModelWithString).optional(), 212 212 propWithFile: z.array(z.string()).optional(), 213 213 propWithNumber: z.array(z.number()).optional() 214 214 }); 215 215 216 - export const ModelWithDictionary = z.object({ 216 + export const zModelWithDictionary = z.object({ 217 217 prop: z.object({}).optional() 218 218 }); 219 219 220 - export const DeprecatedModel = z.object({ 220 + export const zDeprecatedModel = z.object({ 221 221 prop: z.string().optional() 222 222 }); 223 223 224 - export const CompositionWithOneOf = z.object({ 224 + export const zCompositionWithOneOf = z.object({ 225 225 propA: z.unknown().optional() 226 226 }); 227 227 228 - export const CompositionWithOneOfAnonymous = z.object({ 228 + export const zCompositionWithOneOfAnonymous = z.object({ 229 229 propA: z.unknown().optional() 230 230 }); 231 231 232 - export const ModelCircle = z.object({ 232 + export const zModelCircle = z.object({ 233 233 kind: z.string(), 234 234 radius: z.number().optional() 235 235 }); 236 236 237 - export const ModelSquare = z.object({ 237 + export const zModelSquare = z.object({ 238 238 kind: z.string(), 239 239 sideLength: z.number().optional() 240 240 }); 241 241 242 - export const CompositionWithOneOfDiscriminator = z.unknown(); 242 + export const zCompositionWithOneOfDiscriminator = z.unknown(); 243 243 244 - export const CompositionWithAnyOf = z.object({ 244 + export const zCompositionWithAnyOf = z.object({ 245 245 propA: z.unknown().optional() 246 246 }); 247 247 248 - export const CompositionWithAnyOfAnonymous = z.object({ 248 + export const zCompositionWithAnyOfAnonymous = z.object({ 249 249 propA: z.unknown().optional() 250 250 }); 251 251 252 - export const CompositionWithNestedAnyAndTypeNull = z.object({ 252 + export const zCompositionWithNestedAnyAndTypeNull = z.object({ 253 253 propA: z.unknown().optional() 254 254 }); 255 255 256 - export const _3e_num_1Период = z.enum([ 256 + export const z_3e_num_1Период = z.enum([ 257 257 'Bird', 258 258 'Dog' 259 259 ]); 260 260 261 - export const ConstValue = z.string(); 261 + export const zConstValue = z.string(); 262 262 263 - export const CompositionWithNestedAnyOfAndNull = z.object({ 263 + export const zCompositionWithNestedAnyOfAndNull = z.object({ 264 264 propA: z.unknown().optional() 265 265 }); 266 266 267 - export const CompositionWithOneOfAndNullable = z.object({ 267 + export const zCompositionWithOneOfAndNullable = z.object({ 268 268 propA: z.unknown().optional() 269 269 }); 270 270 271 - export const CompositionWithOneOfAndSimpleDictionary = z.object({ 271 + export const zCompositionWithOneOfAndSimpleDictionary = z.object({ 272 272 propA: z.unknown().optional() 273 273 }); 274 274 275 - export const CompositionWithOneOfAndSimpleArrayDictionary = z.object({ 275 + export const zCompositionWithOneOfAndSimpleArrayDictionary = z.object({ 276 276 propA: z.unknown().optional() 277 277 }); 278 278 279 - export const CompositionWithOneOfAndComplexArrayDictionary = z.object({ 279 + export const zCompositionWithOneOfAndComplexArrayDictionary = z.object({ 280 280 propA: z.unknown().optional() 281 281 }); 282 282 283 - export const CompositionWithAllOfAndNullable = z.object({ 283 + export const zCompositionWithAllOfAndNullable = z.object({ 284 284 propA: z.unknown().optional() 285 285 }); 286 286 287 - export const CompositionWithAnyOfAndNullable = z.object({ 287 + export const zCompositionWithAnyOfAndNullable = z.object({ 288 288 propA: z.unknown().optional() 289 289 }); 290 290 291 - export const CompositionBaseModel = z.object({ 291 + export const zCompositionBaseModel = z.object({ 292 292 firstName: z.string().optional(), 293 293 lastname: z.string().optional() 294 294 }); 295 295 296 - export const CompositionExtendedModel = z.unknown(); 296 + export const zCompositionExtendedModel = z.unknown(); 297 297 298 - export const ModelWithProperties = z.object({ 298 + export const zModelWithProperties = z.object({ 299 299 required: z.string(), 300 300 requiredAndReadOnly: z.string().readonly(), 301 301 requiredAndNullable: z.unknown(), 302 302 string: z.string().optional(), 303 303 number: z.number().optional(), 304 304 boolean: z.boolean().optional(), 305 - reference: ModelWithString.optional(), 305 + reference: zModelWithString.optional(), 306 306 'property with space': z.string().optional(), 307 307 default: z.string().optional(), 308 308 try: z.string().optional(), ··· 310 310 '@namespace.integer': z.number().readonly().optional() 311 311 }); 312 312 313 - export const ModelWithNestedProperties = z.object({ 313 + export const zModelWithNestedProperties = z.object({ 314 314 first: z.unknown().readonly() 315 315 }); 316 316 317 - export const ModelWithDuplicateProperties = z.object({ 318 - prop: ModelWithString.optional() 317 + export const zModelWithDuplicateProperties = z.object({ 318 + prop: zModelWithString.optional() 319 319 }); 320 320 321 - export const ModelWithOrderedProperties = z.object({ 321 + export const zModelWithOrderedProperties = z.object({ 322 322 zebra: z.string().optional(), 323 323 apple: z.string().optional(), 324 324 hawaii: z.string().optional() 325 325 }); 326 326 327 - export const ModelWithDuplicateImports = z.object({ 328 - propA: ModelWithString.optional(), 329 - propB: ModelWithString.optional(), 330 - propC: ModelWithString.optional() 327 + export const zModelWithDuplicateImports = z.object({ 328 + propA: zModelWithString.optional(), 329 + propB: zModelWithString.optional(), 330 + propC: zModelWithString.optional() 331 331 }); 332 332 333 - export const ModelThatExtends = z.unknown(); 333 + export const zModelThatExtends = z.unknown(); 334 334 335 - export const ModelThatExtendsExtends = z.unknown(); 335 + export const zModelThatExtendsExtends = z.unknown(); 336 336 337 - export const ModelWithPattern = z.object({ 338 - key: z.string(), 339 - name: z.string(), 337 + export const zModelWithPattern = z.object({ 338 + key: z.string().max(64), 339 + name: z.string().max(255), 340 340 enabled: z.boolean().readonly().optional(), 341 341 modified: z.string().datetime().readonly().optional(), 342 342 id: z.string().optional(), ··· 346 346 patternWithBacktick: z.string().optional() 347 347 }); 348 348 349 - export const File = z.object({ 350 - id: z.string().readonly().optional(), 349 + export const zFile = z.object({ 350 + id: z.string().min(1).readonly().optional(), 351 351 updated_at: z.string().datetime().readonly().optional(), 352 352 created_at: z.string().datetime().readonly().optional(), 353 - mime: z.string(), 353 + mime: z.string().min(1).max(24), 354 354 file: z.string().url().readonly().optional() 355 355 }); 356 356 357 - export const _default = z.object({ 357 + export const z_default = z.object({ 358 358 name: z.string().optional() 359 359 }); 360 360 361 - export const Pageable = z.object({ 362 - page: z.number().optional(), 363 - size: z.number().optional(), 361 + export const zPageable = z.object({ 362 + page: z.number().gte(0).optional().default(0), 363 + size: z.number().gte(1).optional(), 364 364 sort: z.array(z.string()).optional() 365 365 }); 366 366 367 - export const FreeFormObjectWithoutAdditionalProperties = z.object({}); 367 + export const zFreeFormObjectWithoutAdditionalProperties = z.object({}); 368 368 369 - export const FreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 369 + export const zFreeFormObjectWithAdditionalPropertiesEqTrue = z.object({}); 370 370 371 - export const FreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 371 + export const zFreeFormObjectWithAdditionalPropertiesEqEmptyObject = z.object({}); 372 372 373 - export const ModelWithConst = z.object({ 373 + export const zModelWithConst = z.object({ 374 374 String: z.string().optional(), 375 375 number: z.number().optional(), 376 376 null: z.null().optional(), 377 377 withType: z.string().optional() 378 378 }); 379 379 380 - export const ModelWithAdditionalPropertiesEqTrue = z.object({ 380 + export const zModelWithAdditionalPropertiesEqTrue = z.object({ 381 381 prop: z.string().optional() 382 382 }); 383 383 384 - export const NestedAnyOfArraysNullable = z.object({ 384 + export const zNestedAnyOfArraysNullable = z.object({ 385 385 nullableArray: z.unknown().optional() 386 386 }); 387 387 388 - export const CompositionWithOneOfAndProperties = z.unknown(); 388 + export const zCompositionWithOneOfAndProperties = z.unknown(); 389 389 390 - export const NullableObject = z.unknown(); 390 + export const zNullableObject = z.unknown(); 391 391 392 - export const CharactersInDescription = z.string(); 392 + export const zCharactersInDescription = z.string(); 393 393 394 - export const ModelWithNullableObject = z.object({ 395 - data: NullableObject.optional() 394 + export const zModelWithNullableObject = z.object({ 395 + data: zNullableObject.optional() 396 396 }); 397 397 398 - export const ModelWithOneOfEnum = z.unknown(); 398 + export const zModelWithOneOfEnum = z.unknown(); 399 399 400 - export const ModelWithNestedArrayEnumsDataFoo = z.enum([ 400 + export const zModelWithNestedArrayEnumsDataFoo = z.enum([ 401 401 'foo', 402 402 'bar' 403 403 ]); 404 404 405 - export const ModelWithNestedArrayEnumsDataBar = z.enum([ 405 + export const zModelWithNestedArrayEnumsDataBar = z.enum([ 406 406 'baz', 407 407 'qux' 408 408 ]); 409 409 410 - export const ModelWithNestedArrayEnumsData = z.object({ 411 - foo: z.array(ModelWithNestedArrayEnumsDataFoo).optional(), 412 - bar: z.array(ModelWithNestedArrayEnumsDataBar).optional() 410 + export const zModelWithNestedArrayEnumsData = z.object({ 411 + foo: z.array(zModelWithNestedArrayEnumsDataFoo).optional(), 412 + bar: z.array(zModelWithNestedArrayEnumsDataBar).optional() 413 413 }); 414 414 415 - export const ModelWithNestedArrayEnums = z.object({ 415 + export const zModelWithNestedArrayEnums = z.object({ 416 416 array_strings: z.array(z.string()).optional(), 417 - data: ModelWithNestedArrayEnumsData.optional() 417 + data: zModelWithNestedArrayEnumsData.optional() 418 418 }); 419 419 420 - export const ModelWithNestedCompositionEnums = z.object({ 421 - foo: ModelWithNestedArrayEnumsDataFoo.optional() 420 + export const zModelWithNestedCompositionEnums = z.object({ 421 + foo: zModelWithNestedArrayEnumsDataFoo.optional() 422 422 }); 423 423 424 - export const ModelWithReadOnlyAndWriteOnly = z.object({ 424 + export const zModelWithReadOnlyAndWriteOnly = z.object({ 425 425 foo: z.string(), 426 426 bar: z.string().readonly(), 427 427 baz: z.string() 428 428 }); 429 429 430 - export const ModelWithConstantSizeArray = z.unknown(); 430 + export const zModelWithConstantSizeArray = z.unknown(); 431 431 432 - export const ModelWithAnyOfConstantSizeArray = z.unknown(); 432 + export const zModelWithAnyOfConstantSizeArray = z.unknown(); 433 433 434 - export const ModelWithPrefixItemsConstantSizeArray = z.unknown(); 434 + export const zModelWithPrefixItemsConstantSizeArray = z.unknown(); 435 435 436 - export const ModelWithAnyOfConstantSizeArrayNullable = z.unknown(); 436 + export const zModelWithAnyOfConstantSizeArrayNullable = z.unknown(); 437 437 438 - export const ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.unknown(); 438 + export const zModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = z.unknown(); 439 439 440 - export const ModelWithAnyOfConstantSizeArrayAndIntersect = z.unknown(); 440 + export const zModelWithAnyOfConstantSizeArrayAndIntersect = z.unknown(); 441 441 442 - export const ModelWithNumericEnumUnion = z.object({ 442 + export const zModelWithNumericEnumUnion = z.object({ 443 443 value: z.unknown().optional() 444 444 }); 445 445 446 - export const ModelWithBackticksInDescription = z.object({ 446 + export const zModelWithBackticksInDescription = z.object({ 447 447 template: z.string().optional() 448 448 }); 449 449 450 - export const ModelWithOneOfAndProperties = z.unknown(); 450 + export const zModelWithOneOfAndProperties = z.unknown(); 451 451 452 - export const ParameterSimpleParameterUnused = z.string(); 452 + export const zParameterSimpleParameterUnused = z.string(); 453 453 454 - export const PostServiceWithEmptyTagResponse = z.string(); 454 + export const zPostServiceWithEmptyTagResponse = z.string(); 455 455 456 - export const PostServiceWithEmptyTagResponse2 = z.string(); 456 + export const zPostServiceWithEmptyTagResponse2 = z.string(); 457 457 458 - export const DeleteFooData = z.string(); 458 + export const zDeleteFooData = z.string(); 459 459 460 - export const DeleteFooData2 = z.string(); 460 + export const zDeleteFooData2 = z.string(); 461 461 462 - export const _import = z.string(); 462 + export const z_import = z.string(); 463 463 464 - export const SchemaWithFormRestrictedKeys = z.object({ 464 + export const zSchemaWithFormRestrictedKeys = z.object({ 465 465 description: z.string().optional(), 466 466 'x-enum-descriptions': z.string().optional(), 467 467 'x-enum-varnames': z.string().optional(), ··· 483 483 })).optional() 484 484 }); 485 485 486 - export const io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = z.object({ 486 + export const zio_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = z.object({ 487 487 preconditions: z.object({ 488 488 resourceVersion: z.string().optional(), 489 489 uid: z.string().optional() 490 490 }).optional() 491 491 }); 492 492 493 - export const io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = z.object({ 493 + export const zio_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = z.object({ 494 494 resourceVersion: z.string().optional(), 495 495 uid: z.string().optional() 496 496 }); 497 497 498 - export const AdditionalPropertiesUnknownIssue = z.object({}); 498 + export const zAdditionalPropertiesUnknownIssue = z.object({}); 499 499 500 - export const AdditionalPropertiesUnknownIssue2 = z.object({}); 500 + export const zAdditionalPropertiesUnknownIssue2 = z.object({}); 501 501 502 - export const AdditionalPropertiesUnknownIssue3 = z.unknown(); 502 + export const zAdditionalPropertiesUnknownIssue3 = z.unknown(); 503 503 504 - export const AdditionalPropertiesIntegerIssue = z.object({ 504 + export const zAdditionalPropertiesIntegerIssue = z.object({ 505 505 value: z.number() 506 506 }); 507 507 508 - export const OneOfAllOfIssue = z.unknown(); 508 + export const zOneOfAllOfIssue = z.unknown(); 509 509 510 - export const Generic_Schema_Duplicate_Issue_1_System_Boolean_ = z.object({ 510 + export const zGeneric_Schema_Duplicate_Issue_1_System_Boolean_ = z.object({ 511 511 item: z.boolean().optional(), 512 512 error: z.unknown().optional(), 513 513 hasError: z.boolean().readonly().optional(), 514 514 data: z.object({}).optional() 515 515 }); 516 516 517 - export const Generic_Schema_Duplicate_Issue_1_System_String_ = z.object({ 517 + export const zGeneric_Schema_Duplicate_Issue_1_System_String_ = z.object({ 518 518 item: z.unknown().optional(), 519 519 error: z.unknown().optional(), 520 520 hasError: z.boolean().readonly().optional()
+3 -3
packages/openapi-ts/test/index.spec.ts
··· 40 40 description: 'generate fetch client', 41 41 name: 'v2', 42 42 }, 43 - ])('$description', async ({ name, config }) => { 43 + ])('$description', async ({ config, name }) => { 44 44 const output = toOutputPath(name); 45 45 await createClient({ 46 46 ...config, ··· 468 468 469 469 it.each(clientScenarios.concat(allScenarios))( 470 470 '$description', 471 - async ({ name, config }) => { 471 + async ({ config, name }) => { 472 472 const output = toOutputPath(name); 473 473 await createClient({ 474 474 ...config, ··· 484 484 485 485 it.each(clientScenarios)( 486 486 'transforms $description', 487 - async ({ name, config }) => { 487 + async ({ config, name }) => { 488 488 const output = toOutputPath(name + '_transform'); 489 489 490 490 await createClient({
+42 -28
pnpm-lock.yaml
··· 35 35 eslint-plugin-simple-import-sort: 36 36 specifier: 12.1.1 37 37 version: 12.1.1(eslint@9.6.0) 38 + eslint-plugin-sort-destructure-keys: 39 + specifier: 2.0.0 40 + version: 2.0.0(eslint@9.6.0) 38 41 eslint-plugin-sort-keys-fix: 39 42 specifier: 1.1.2 40 43 version: 1.1.2 ··· 5286 5289 peerDependencies: 5287 5290 eslint: '>=5.0.0' 5288 5291 5292 + eslint-plugin-sort-destructure-keys@2.0.0: 5293 + resolution: {integrity: sha512-4w1UQCa3o/YdfWaLr9jY8LfGowwjwjmwClyFLxIsToiyIdZMq3x9Ti44nDn34DtTPP7PWg96tUONKVmATKhYGQ==} 5294 + engines: {node: '>=12'} 5295 + peerDependencies: 5296 + eslint: 5 - 9 5297 + 5289 5298 eslint-plugin-sort-keys-fix@1.1.2: 5290 5299 resolution: {integrity: sha512-DNPHFGCA0/hZIsfODbeLZqaGY/+q3vgtshF85r+YWDNCQ2apd9PNs/zL6ttKm0nD1IFwvxyg3YOTI7FHl4unrw==} 5291 5300 engines: {node: '>=0.10.0'} ··· 9146 9155 dependencies: 9147 9156 '@ampproject/remapping': 2.3.0 9148 9157 '@angular-devkit/architect': 0.1802.12(chokidar@3.6.0) 9149 - '@angular-devkit/build-webpack': 0.1802.12(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.0)))(webpack@5.94.0(esbuild@0.23.0)) 9158 + '@angular-devkit/build-webpack': 0.1802.12(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.1)))(webpack@5.94.0(esbuild@0.23.0)) 9150 9159 '@angular-devkit/core': 18.2.12(chokidar@3.6.0) 9151 9160 '@angular/build': 18.2.12(@angular/compiler-cli@18.2.12(@angular/compiler@18.2.12(@angular/core@18.2.12(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3))(@types/node@22.8.5)(chokidar@3.6.0)(less@4.2.0)(postcss@8.4.41)(tailwindcss@3.4.9(ts-node@10.9.2(@types/node@22.8.5)(typescript@5.5.3)))(terser@5.31.6)(typescript@5.5.3) 9152 9161 '@angular/compiler-cli': 18.2.12(@angular/compiler@18.2.12(@angular/core@18.2.12(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3) ··· 9203 9212 typescript: 5.5.3 9204 9213 vite: 5.4.6(@types/node@22.8.5)(less@4.2.0)(sass@1.77.6)(terser@5.31.6) 9205 9214 watchpack: 2.4.1 9206 - webpack: 5.94.0(esbuild@0.23.1) 9207 - webpack-dev-middleware: 7.4.2(webpack@5.94.0(esbuild@0.23.0)) 9208 - webpack-dev-server: 5.0.4(webpack@5.94.0(esbuild@0.23.0)) 9215 + webpack: 5.94.0(esbuild@0.23.0) 9216 + webpack-dev-middleware: 7.4.2(webpack@5.94.0(esbuild@0.23.1)) 9217 + webpack-dev-server: 5.0.4(webpack@5.94.0(esbuild@0.23.1)) 9209 9218 webpack-merge: 6.0.1 9210 9219 webpack-subresource-integrity: 5.1.0(webpack@5.94.0(esbuild@0.23.0)) 9211 9220 optionalDependencies: ··· 9230 9239 - utf-8-validate 9231 9240 - webpack-cli 9232 9241 9233 - '@angular-devkit/build-webpack@0.1802.12(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.0)))(webpack@5.94.0(esbuild@0.23.0))': 9242 + '@angular-devkit/build-webpack@0.1802.12(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.1)))(webpack@5.94.0(esbuild@0.23.0))': 9234 9243 dependencies: 9235 9244 '@angular-devkit/architect': 0.1802.12(chokidar@3.6.0) 9236 9245 rxjs: 7.8.1 9237 - webpack: 5.94.0(esbuild@0.23.1) 9238 - webpack-dev-server: 5.0.4(webpack@5.94.0(esbuild@0.23.0)) 9246 + webpack: 5.94.0(esbuild@0.23.0) 9247 + webpack-dev-server: 5.0.4(webpack@5.94.0(esbuild@0.23.1)) 9239 9248 transitivePeerDependencies: 9240 9249 - chokidar 9241 9250 ··· 11226 11235 dependencies: 11227 11236 '@angular/compiler-cli': 18.2.12(@angular/compiler@18.2.12(@angular/core@18.2.12(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3) 11228 11237 typescript: 5.5.3 11229 - webpack: 5.94.0(esbuild@0.23.1) 11238 + webpack: 5.94.0(esbuild@0.23.0) 11230 11239 11231 11240 '@nodelib/fs.scandir@2.1.5': 11232 11241 dependencies: ··· 13472 13481 '@babel/core': 7.25.2 13473 13482 find-cache-dir: 4.0.0 13474 13483 schema-utils: 4.2.0 13475 - webpack: 5.94.0(esbuild@0.23.1) 13484 + webpack: 5.94.0(esbuild@0.23.0) 13476 13485 13477 13486 babel-plugin-polyfill-corejs2@0.4.11(@babel/core@7.25.2): 13478 13487 dependencies: ··· 13935 13944 normalize-path: 3.0.0 13936 13945 schema-utils: 4.2.0 13937 13946 serialize-javascript: 6.0.2 13938 - webpack: 5.94.0(esbuild@0.23.1) 13947 + webpack: 5.94.0(esbuild@0.23.0) 13939 13948 13940 13949 core-js-compat@3.39.0: 13941 13950 dependencies: ··· 13992 14001 postcss-value-parser: 4.2.0 13993 14002 semver: 7.6.3 13994 14003 optionalDependencies: 13995 - webpack: 5.94.0(esbuild@0.23.1) 14004 + webpack: 5.94.0(esbuild@0.23.0) 13996 14005 13997 14006 css-select@5.1.0: 13998 14007 dependencies: ··· 14399 14408 dependencies: 14400 14409 eslint: 9.6.0 14401 14410 14411 + eslint-plugin-sort-destructure-keys@2.0.0(eslint@9.6.0): 14412 + dependencies: 14413 + eslint: 9.6.0 14414 + natural-compare-lite: 1.4.0 14415 + 14402 14416 eslint-plugin-sort-keys-fix@1.1.2: 14403 14417 dependencies: 14404 14418 espree: 6.2.1 ··· 15572 15586 dependencies: 15573 15587 less: 4.2.0 15574 15588 optionalDependencies: 15575 - webpack: 5.94.0(esbuild@0.23.1) 15589 + webpack: 5.94.0(esbuild@0.23.0) 15576 15590 15577 15591 less@4.2.0: 15578 15592 dependencies: ··· 15597 15611 dependencies: 15598 15612 webpack-sources: 3.2.3 15599 15613 optionalDependencies: 15600 - webpack: 5.94.0(esbuild@0.23.1) 15614 + webpack: 5.94.0(esbuild@0.23.0) 15601 15615 15602 15616 light-my-request@6.3.0: 15603 15617 dependencies: ··· 15878 15892 dependencies: 15879 15893 schema-utils: 4.2.0 15880 15894 tapable: 2.2.1 15881 - webpack: 5.94.0(esbuild@0.23.1) 15895 + webpack: 5.94.0(esbuild@0.23.0) 15882 15896 15883 15897 minimalistic-assert@1.0.1: {} 15884 15898 ··· 16517 16531 postcss: 8.4.41 16518 16532 semver: 7.6.3 16519 16533 optionalDependencies: 16520 - webpack: 5.94.0(esbuild@0.23.1) 16534 + webpack: 5.94.0(esbuild@0.23.0) 16521 16535 transitivePeerDependencies: 16522 16536 - typescript 16523 16537 ··· 16991 17005 neo-async: 2.6.2 16992 17006 optionalDependencies: 16993 17007 sass: 1.77.6 16994 - webpack: 5.94.0(esbuild@0.23.1) 17008 + webpack: 5.94.0(esbuild@0.23.0) 16995 17009 16996 17010 sass@1.77.6: 16997 17011 dependencies: ··· 17263 17277 dependencies: 17264 17278 iconv-lite: 0.6.3 17265 17279 source-map-js: 1.2.1 17266 - webpack: 5.94.0(esbuild@0.23.1) 17280 + webpack: 5.94.0(esbuild@0.23.0) 17267 17281 17268 17282 source-map-support@0.5.21: 17269 17283 dependencies: ··· 17632 17646 17633 17647 term-size@2.2.1: {} 17634 17648 17635 - terser-webpack-plugin@5.3.10(esbuild@0.23.1)(webpack@5.94.0(esbuild@0.23.0)): 17649 + terser-webpack-plugin@5.3.10(esbuild@0.23.0)(webpack@5.94.0(esbuild@0.23.1)): 17636 17650 dependencies: 17637 17651 '@jridgewell/trace-mapping': 0.3.25 17638 17652 jest-worker: 27.5.1 17639 17653 schema-utils: 3.3.0 17640 17654 serialize-javascript: 6.0.2 17641 17655 terser: 5.31.6 17642 - webpack: 5.94.0(esbuild@0.23.1) 17656 + webpack: 5.94.0(esbuild@0.23.0) 17643 17657 optionalDependencies: 17644 - esbuild: 0.23.1 17658 + esbuild: 0.23.0 17645 17659 17646 17660 terser@5.31.6: 17647 17661 dependencies: ··· 18441 18455 18442 18456 webidl-conversions@7.0.0: {} 18443 18457 18444 - webpack-dev-middleware@7.4.2(webpack@5.94.0(esbuild@0.23.0)): 18458 + webpack-dev-middleware@7.4.2(webpack@5.94.0(esbuild@0.23.1)): 18445 18459 dependencies: 18446 18460 colorette: 2.0.20 18447 18461 memfs: 4.14.0 ··· 18450 18464 range-parser: 1.2.1 18451 18465 schema-utils: 4.2.0 18452 18466 optionalDependencies: 18453 - webpack: 5.94.0(esbuild@0.23.1) 18467 + webpack: 5.94.0(esbuild@0.23.0) 18454 18468 18455 - webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.0)): 18469 + webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.1)): 18456 18470 dependencies: 18457 18471 '@types/bonjour': 3.5.13 18458 18472 '@types/connect-history-api-fallback': 1.5.4 ··· 18482 18496 serve-index: 1.9.1 18483 18497 sockjs: 0.3.24 18484 18498 spdy: 4.0.2 18485 - webpack-dev-middleware: 7.4.2(webpack@5.94.0(esbuild@0.23.0)) 18499 + webpack-dev-middleware: 7.4.2(webpack@5.94.0(esbuild@0.23.1)) 18486 18500 ws: 8.17.1 18487 18501 optionalDependencies: 18488 - webpack: 5.94.0(esbuild@0.23.1) 18502 + webpack: 5.94.0(esbuild@0.23.0) 18489 18503 transitivePeerDependencies: 18490 18504 - bufferutil 18491 18505 - debug ··· 18503 18517 webpack-subresource-integrity@5.1.0(webpack@5.94.0(esbuild@0.23.0)): 18504 18518 dependencies: 18505 18519 typed-assert: 1.0.9 18506 - webpack: 5.94.0(esbuild@0.23.1) 18520 + webpack: 5.94.0(esbuild@0.23.0) 18507 18521 18508 - webpack@5.94.0(esbuild@0.23.1): 18522 + webpack@5.94.0(esbuild@0.23.0): 18509 18523 dependencies: 18510 18524 '@types/estree': 1.0.5 18511 18525 '@webassemblyjs/ast': 1.12.1 ··· 18527 18541 neo-async: 2.6.2 18528 18542 schema-utils: 3.3.0 18529 18543 tapable: 2.2.1 18530 - terser-webpack-plugin: 5.3.10(esbuild@0.23.1)(webpack@5.94.0(esbuild@0.23.0)) 18544 + terser-webpack-plugin: 5.3.10(esbuild@0.23.0)(webpack@5.94.0(esbuild@0.23.1)) 18531 18545 watchpack: 2.4.1 18532 18546 webpack-sources: 3.2.3 18533 18547 transitivePeerDependencies: