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

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #2081 from hey-api/fix/parser-3-1-0-exclusive-limits

fix(parser): handle exclusiveMinimum and exclusiveMaximum in OpenAPI 3.1.x when they're 0

authored by

Lubos and committed by
GitHub
464ff4ae 86844c63

+20 -36
+1 -25
.changeset/hip-crabs-help.md
··· 8 8 9 9 Input filters now avoid generating invalid output without requiring you to specify every missing schema as in the previous releases. As part of this release, we changed the way filters are configured and removed the support for regular expressions. Let us know if regular expressions are still useful for you and want to bring them back! 10 10 11 - ::: code-group 12 - 13 - ```js [include] 11 + ```js 14 12 export default { 15 13 input: { 16 14 // match only the schema named `foo` and `GET` operation for the `/api/v1/foo` path ··· 29 27 plugins: ['@hey-api/client-fetch'], 30 28 }; 31 29 ``` 32 - 33 - ```js [exclude] 34 - export default { 35 - input: { 36 - // match everything except for the schema named `foo` and `GET` operation for the `/api/v1/foo` path 37 - exclude: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code --] 38 - filters: { 39 - operations: { 40 - exclude: ['GET /api/v1/foo'], // [!code ++] 41 - }, 42 - schemas: { 43 - exclude: ['foo'], // [!code ++] 44 - }, 45 - }, 46 - path: 'https://get.heyapi.dev/hey-api/backend', 47 - }, 48 - output: 'src/client', 49 - plugins: ['@hey-api/client-fetch'], 50 - }; 51 - ``` 52 - 53 - :::
+5
.changeset/moody-socks-develop.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix(parser): handle exclusiveMinimum and exclusiveMaximum in OpenAPI 3.1.x when they're 0
+1 -1
packages/openapi-ts-tests/test/__snapshots__/3.0.x/validators/valibot.gen.ts
··· 15 15 baz: v.optional(v.array(v.lazy(() => { 16 16 return vFoo; 17 17 }))), 18 - qux: v.optional(v.number(), 0) 18 + qux: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0)), 0) 19 19 }), 20 20 v.null() 21 21 ]), null);
+1 -1
packages/openapi-ts-tests/test/__snapshots__/3.0.x/validators/zod.gen.ts
··· 15 15 baz: z.array(z.lazy(() => { 16 16 return zFoo; 17 17 })).optional(), 18 - qux: z.number().optional().default(0) 18 + qux: z.number().int().gt(0).optional().default(0) 19 19 }), 20 20 z.null() 21 21 ]).default(null);
+1 -1
packages/openapi-ts-tests/test/__snapshots__/3.1.x/validators/valibot.gen.ts
··· 15 15 baz: v.optional(v.array(v.lazy(() => { 16 16 return vFoo; 17 17 }))), 18 - qux: v.optional(v.number(), 0) 18 + qux: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0)), 0) 19 19 }), 20 20 v.null() 21 21 ]), null);
+1 -1
packages/openapi-ts-tests/test/__snapshots__/3.1.x/validators/zod.gen.ts
··· 15 15 baz: z.array(z.lazy(() => { 16 16 return zFoo; 17 17 })).optional(), 18 - qux: z.number().optional().default(0) 18 + qux: z.number().int().gt(0).optional().default(0) 19 19 }), 20 20 z.null() 21 21 ]).default(null);
+3 -3
packages/openapi-ts-tests/test/openapi-ts.config.ts
··· 22 22 // }, 23 23 // }, 24 24 filters: { 25 - deprecated: false, 25 + // deprecated: false, 26 26 // operations: { 27 27 // include: ['POST /foo'], 28 28 // }, 29 - orphans: false, 29 + // orphans: false, 30 30 // preserveOrder: true, 31 31 // tags: { 32 32 // exclude: ['bar'], ··· 41 41 // openapi: '3.1.0', 42 42 // paths: {}, 43 43 // }, 44 - path: path.resolve(__dirname, 'spec', '3.1.x', 'full.json'), 44 + path: path.resolve(__dirname, 'spec', '3.1.x', 'validators.json'), 45 45 // path: 'http://localhost:4000/', 46 46 // path: 'https://get.heyapi.dev/', 47 47 // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0',
+3 -1
packages/openapi-ts-tests/test/spec/3.0.x/validators.json
··· 25 25 }, 26 26 "qux": { 27 27 "default": 0, 28 - "type": "number" 28 + "exclusiveMinimum": true, 29 + "minimum": 0, 30 + "type": "integer" 29 31 } 30 32 }, 31 33 "type": "object"
+2 -1
packages/openapi-ts-tests/test/spec/3.1.x/validators.json
··· 24 24 }, 25 25 "qux": { 26 26 "default": 0, 27 - "type": "number" 27 + "exclusiveMinimum": 0, 28 + "type": "integer" 28 29 } 29 30 }, 30 31 "type": ["object", "null"]
+2 -2
packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts
··· 88 88 irSchema.default = schema.default; 89 89 } 90 90 91 - if (schema.exclusiveMaximum) { 91 + if (schema.exclusiveMaximum !== undefined) { 92 92 irSchema.exclusiveMaximum = schema.exclusiveMaximum; 93 93 } 94 94 95 - if (schema.exclusiveMinimum) { 95 + if (schema.exclusiveMinimum !== undefined) { 96 96 irSchema.exclusiveMinimum = schema.exclusiveMinimum; 97 97 } 98 98