From 1141c4c4dedd6c60e3a03422ed62bebc61db4f97 Mon Sep 17 00:00:00 2001 From: Dinh Le Date: Sun, 6 Sep 2026 14:51:23 +0700 Subject: [PATCH 1/2] refactor(downgrader): simplify converters, tests, and fixtures - Replace the UnknownRecord alias with the inline Record type - Rename HTTP_METHODS to HTTP_METHODS_UP_TO_V31, since 3.2 adds `query` - Drop comments that restate the code; module headers point at the README - Move convertSchema below its field table, removing an eslint-disable - Share dig and expectValidAs across the tests; cast only malformed input - Type fixture exports as OpenAPIObject instead of `satisfies`, so tests use them without casts --- packages/downgrader/src/shared.test.ts | 56 +++--- packages/downgrader/src/shared.ts | 35 +--- packages/downgrader/src/v3.1-to-v3.0.test.ts | 55 ++---- packages/downgrader/src/v3.1-to-v3.0.ts | 105 ++++------- packages/downgrader/src/v3.2-to-v3.1.test.ts | 63 +++---- packages/downgrader/src/v3.2-to-v3.1.ts | 91 ++------- packages/downgrader/tests/corpus.test.ts | 177 ++++++++---------- packages/downgrader/tests/e2e.test.ts | 41 +--- packages/downgrader/tests/helpers.ts | 19 ++ packages/types/tests/README.md | 2 +- .../types/tests/examples/3-2-query-example.ts | 4 +- .../types/tests/examples/3-2-tags-example.ts | 4 +- .../tests/examples/api-with-examples-3-0.ts | 4 +- .../tests/examples/callback-example-3-0.ts | 4 +- .../types/tests/examples/link-example-3-0.ts | 4 +- .../tests/examples/non-oauth-scopes-3-1.ts | 4 +- packages/types/tests/examples/petstore-3-0.ts | 4 +- .../tests/examples/petstore-expanded-3-0.ts | 4 +- .../types/tests/examples/tictactoe-3-1.ts | 4 +- packages/types/tests/examples/uspto-3-0.ts | 4 +- .../tests/examples/webhook-example-3-1.ts | 4 +- .../callback-object-examples.ts | 4 +- .../tests/schema-tests-3.1/comp-pathitems.ts | 4 +- .../components-object-example.ts | 4 +- .../example-object-examples.ts | 4 +- .../header-object-examples.ts | 4 +- .../schema-tests-3.1/info-object-example.ts | 4 +- .../tests/schema-tests-3.1/info-summary.ts | 4 +- .../schema-tests-3.1/json-schema-dialect.ts | 4 +- .../schema-tests-3.1/license-identifier.ts | 4 +- .../schema-tests-3.1/link-object-examples.ts | 4 +- .../schema-tests-3.1/media-type-examples.ts | 4 +- packages/types/tests/schema-tests-3.1/mega.ts | 4 +- .../tests/schema-tests-3.1/minimal-comp.ts | 4 +- .../tests/schema-tests-3.1/minimal-hooks.ts | 4 +- .../tests/schema-tests-3.1/minimal-paths.ts | 4 +- .../schema-tests-3.1/non-oauth-scopes.ts | 4 +- .../operation-object-example.ts | 4 +- .../parameter-object-examples.ts | 4 +- .../parameter-object-query-allow-reserved.ts | 4 +- .../path-item-object-example.ts | 4 +- .../path-item-servers-parameters.ts | 4 +- .../schema-tests-3.1/path-no-response.ts | 4 +- .../path-var-empty-pathitem.ts | 4 +- .../schema-tests-3.1/paths-object-example.ts | 4 +- .../schema-tests-3.1/request-body-examples.ts | 4 +- .../response-object-examples.ts | 4 +- ...chema-object-deprecated-example-keyword.ts | 4 +- .../types/tests/schema-tests-3.1/schema.ts | 4 +- .../security-scheme-object-examples.ts | 4 +- .../types/tests/schema-tests-3.1/servers.ts | 4 +- .../specification-extensions.ts | 4 +- .../tests/schema-tests-3.1/style-defaults.ts | 4 +- .../schema-tests-3.1/tag-object-example.ts | 4 +- .../schema-tests-3.1/valid-schema-types.ts | 4 +- .../tests/schema-tests-3.1/webhook-example.ts | 4 +- .../callback-object-examples.ts | 4 +- .../tests/schema-tests-3.2/comp-pathitems.ts | 4 +- .../components-object-example.ts | 4 +- .../example-object-examples.ts | 4 +- .../header-object-examples.ts | 4 +- .../schema-tests-3.2/info-object-example.ts | 4 +- .../tests/schema-tests-3.2/info-summary.ts | 4 +- .../schema-tests-3.2/json-schema-dialect.ts | 4 +- .../schema-tests-3.2/license-identifier.ts | 4 +- .../schema-tests-3.2/link-object-examples.ts | 4 +- .../schema-tests-3.2/media-type-examples.ts | 4 +- packages/types/tests/schema-tests-3.2/mega.ts | 4 +- .../tests/schema-tests-3.2/minimal-comp.ts | 4 +- .../tests/schema-tests-3.2/minimal-hooks.ts | 4 +- .../tests/schema-tests-3.2/minimal-paths.ts | 4 +- .../schema-tests-3.2/non-oauth-scopes.ts | 4 +- .../operation-object-example.ts | 4 +- ...meter-object-cookie-form-allow-reserved.ts | 4 +- .../parameter-object-examples.ts | 4 +- .../parameter-object-path-allow-reserved.ts | 4 +- .../parameter-object-query-allow-reserved.ts | 4 +- .../path-item-object-example.ts | 4 +- .../path-item-servers-parameters.ts | 4 +- .../schema-tests-3.2/path-no-response.ts | 4 +- .../path-var-empty-pathitem.ts | 4 +- .../schema-tests-3.2/paths-object-example.ts | 4 +- .../schema-tests-3.2/request-body-examples.ts | 4 +- .../response-object-examples.ts | 4 +- ...chema-object-deprecated-example-keyword.ts | 4 +- .../types/tests/schema-tests-3.2/schema.ts | 4 +- .../security-scheme-object-examples.ts | 4 +- .../types/tests/schema-tests-3.2/servers.ts | 4 +- .../specification-extensions.ts | 4 +- .../tests/schema-tests-3.2/style-defaults.ts | 4 +- .../schema-tests-3.2/tag-object-example.ts | 4 +- .../schema-tests-3.2/valid-schema-types.ts | 4 +- .../tests/schema-tests-3.2/webhook-example.ts | 4 +- 93 files changed, 403 insertions(+), 573 deletions(-) create mode 100644 packages/downgrader/tests/helpers.ts diff --git a/packages/downgrader/src/shared.test.ts b/packages/downgrader/src/shared.test.ts index 21c41c1..1a0a7f1 100644 --- a/packages/downgrader/src/shared.test.ts +++ b/packages/downgrader/src/shared.test.ts @@ -1,10 +1,10 @@ -import type { UnknownRecord } from './shared' +import { dig } from '../tests/helpers' import { convertRecord, deepClone, DROP, getRef, - HTTP_METHODS, + HTTP_METHODS_UP_TO_V31, isRecord, mapArray, mapRecord, @@ -16,10 +16,6 @@ function identity(value: T): T { return value } -function asRecord(value: unknown): UnknownRecord { - return value as UnknownRecord -} - /** A converter that recurses into `self`, so a self-referencing node re-enters convertRecord. */ function convertNode(value: unknown): unknown { return convertRecord(value, { @@ -95,17 +91,17 @@ describe('deepClone', () => { it('copies a hostile __proto__ own key as a plain own data property without prototype pollution', () => { const input: unknown = JSON.parse('{"__proto__": {"polluted": true}}') - const clone = asRecord(deepClone(input)) + const clone = deepClone(input) expect(Object.getOwnPropertyNames(clone)).toContain('__proto__') expect(Object.getOwnPropertyDescriptor(clone, '__proto__')?.value).toEqual({ polluted: true, }) expect(Object.getPrototypeOf(clone)).toBe(Object.prototype) - expect(asRecord({}).polluted).toBeUndefined() + expect('polluted' in {}).toBe(false) }) it('preserves key order', () => { - const input: UnknownRecord = {} + const input: Record = {} input.zebra = 1 input.apple = 2 input.mango = 3 @@ -113,13 +109,13 @@ describe('deepClone', () => { }) it('preserves object cycles instead of recursing forever', () => { - const child: UnknownRecord = {} - const node: UnknownRecord = { child, name: 'root' } + const child: Record = {} + const node: Record = { child, name: 'root' } child.parent = node const clone = deepClone(node) expect(clone).not.toBe(node) expect(clone.name).toBe('root') - expect(asRecord(clone.child).parent).toBe(clone) + expect(dig(clone, 'child', 'parent')).toBe(clone) }) it('preserves array cycles', () => { @@ -143,12 +139,10 @@ describe('deepClone', () => { describe('convertRecord', () => { it('routes listed fields through their converters and deep-clones the rest', () => { const extra = { deep: true } - const result = asRecord( - convertRecord( - { a: 1, b: 2, extra }, - { a: item => [item], b: () => 'converted' }, - ), - ) + const result = convertRecord( + { a: 1, b: 2, extra }, + { a: item => [item], b: () => 'converted' }, + ) as Record expect(result).toEqual({ a: [1], b: 'converted', extra: { deep: true } }) expect(result.extra).not.toBe(extra) }) @@ -176,11 +170,11 @@ describe('convertRecord', () => { }) it('preserves key order', () => { - const input: UnknownRecord = {} + const input: Record = {} input.zebra = 1 input.apple = 2 input.mango = 3 - const result = asRecord(convertRecord(input, { apple: identity })) + const result = convertRecord(input, { apple: identity }) as Record expect(Object.keys(result)).toEqual(['zebra', 'apple', 'mango']) }) @@ -199,7 +193,7 @@ describe('convertRecord', () => { const input: unknown = JSON.parse( '{"constructor": 1, "toString": 2, "__proto__": {"polluted": true}}', ) - const result = asRecord(convertRecord(input, {})) + const result = convertRecord(input, {}) expect(Object.getOwnPropertyDescriptor(result, 'constructor')?.value).toBe( 1, ) @@ -208,15 +202,15 @@ describe('convertRecord', () => { { polluted: true }, ) expect(Object.getPrototypeOf(result)).toBe(Object.prototype) - expect(asRecord({}).polluted).toBeUndefined() + expect('polluted' in {}).toBe(false) }) it('falls back to a cycle-preserving clone when re-entered for the same object', () => { - const node: UnknownRecord = { name: 'root' } + const node: Record = { name: 'root' } node.self = node - const result = asRecord(convertNode(node)) + const result = convertNode(node) as Record expect(result.name).toBe('converted') - const inner = asRecord(result.self) + const inner = result.self as Record expect(inner).not.toBe(node) expect(inner.name).toBe('root') expect(inner.self).toBe(inner) @@ -250,7 +244,7 @@ describe('convertRecord', () => { describe('operationFields', () => { it('routes every HTTP method of a path item to the converter', () => { const fields = operationFields(identity) - expect(Object.keys(fields)).toEqual([...HTTP_METHODS]) + expect(Object.keys(fields)).toEqual([...HTTP_METHODS_UP_TO_V31]) expect(Object.values(fields).every(entry => entry === identity)).toBe( true, ) @@ -279,10 +273,10 @@ describe('mapRecord', () => { }) it('preserves key order', () => { - const input: UnknownRecord = {} + const input: Record = {} input.zebra = 1 input.apple = 2 - const result = asRecord(mapRecord(input, identity)) + const result = mapRecord(input, identity) as Record expect(Object.keys(result)).toEqual(['zebra', 'apple']) }) @@ -351,7 +345,7 @@ describe('getRef', () => { describe('setKey', () => { it('defines an enumerable, writable, configurable own property', () => { - const target: UnknownRecord = {} + const target: Record = {} setKey(target, 'name', 'value') expect(Object.getOwnPropertyDescriptor(target, 'name')).toEqual({ configurable: true, @@ -362,12 +356,12 @@ describe('setKey', () => { }) it('sets a __proto__ key as a plain own property without prototype pollution', () => { - const target: UnknownRecord = {} + const target: Record = {} setKey(target, '__proto__', { polluted: true }) const descriptor = Object.getOwnPropertyDescriptor(target, '__proto__') expect(descriptor?.value).toEqual({ polluted: true }) expect(descriptor?.enumerable).toBe(true) expect(Object.getPrototypeOf(target)).toBe(Object.prototype) - expect(asRecord({}).polluted).toBeUndefined() + expect('polluted' in {}).toBe(false) }) }) diff --git a/packages/downgrader/src/shared.ts b/packages/downgrader/src/shared.ts index 2ee00e4..8e335ef 100644 --- a/packages/downgrader/src/shared.ts +++ b/packages/downgrader/src/shared.ts @@ -4,8 +4,6 @@ * through unchanged. */ -export type UnknownRecord = Record - /** * Returned by a converter to remove its entry from the surrounding object or * array: the single signal for constructs the target version cannot express. @@ -16,7 +14,7 @@ export const DROP = Symbol('drop') * Converts one field of a record. The whole source record is passed along * for decisions that depend on sibling fields. */ -export type FieldConverter = (item: unknown, source: UnknownRecord) => unknown +export type FieldConverter = (item: unknown, source: Record) => unknown /** * What happens to each known field of a record: a converter, or `DROP` to @@ -25,7 +23,8 @@ export type FieldConverter = (item: unknown, source: UnknownRecord) => unknown */ export type FieldTable = Readonly> -export const HTTP_METHODS = [ +/** The Path Item operation fields of OpenAPI 3.0 and 3.1; 3.2 adds `query`. */ +export const HTTP_METHODS_UP_TO_V31 = [ 'delete', 'get', 'head', @@ -36,9 +35,8 @@ export const HTTP_METHODS = [ 'trace', ] as const -/** Field-table entries routing every Operation Object of a Path Item to `convert`. */ export function operationFields(convert: FieldConverter): FieldTable { - return Object.fromEntries(HTTP_METHODS.map(method => [method, convert])) + return Object.fromEntries(HTTP_METHODS_UP_TO_V31.map(method => [method, convert])) } /** @@ -46,7 +44,7 @@ export function operationFields(convert: FieldConverter): FieldTable { * into). Arrays, class instances, and primitives are handled by reference or * by dedicated array helpers. */ -export function isRecord(value: unknown): value is UnknownRecord { +export function isRecord(value: unknown): value is Record { if (typeof value !== 'object' || value === null) { return false } @@ -58,7 +56,7 @@ export function isRecord(value: unknown): value is UnknownRecord { * Sets a key on the output record with define-property semantics, so hostile * key names like `__proto__` become plain own properties. */ -export function setKey(target: UnknownRecord, key: string, value: unknown): void { +export function setKey(target: Record, key: string, value: unknown): void { Object.defineProperty(target, key, { configurable: true, enumerable: true, @@ -83,7 +81,7 @@ function cloneValue(value: unknown, seen: WeakMap): unknown { } return out } - const out: UnknownRecord = {} + const out: Record = {} seen.set(value, out) for (const [key, item] of Object.entries(value)) { setKey(out, key, cloneValue(item, seen)) @@ -118,13 +116,13 @@ const converting = new WeakSet() * higher up the call stack: a cyclic reference, which would otherwise recurse * forever. */ -export function convertRecord(value: unknown, fields: FieldTable, finish?: (out: UnknownRecord, source: UnknownRecord) => unknown): unknown { +export function convertRecord(value: unknown, fields: FieldTable, finish?: (out: Record, source: Record) => unknown): unknown { if (!isRecord(value) || converting.has(value)) { return deepClone(value) } converting.add(value) try { - const out: UnknownRecord = {} + const out: Record = {} for (const [key, item] of Object.entries(value)) { const convert = Object.hasOwn(fields, key) ? fields[key] : undefined if (convert === DROP) { @@ -143,16 +141,11 @@ export function convertRecord(value: unknown, fields: FieldTable, finish?: (out: } } -/** - * Applies `convert` to every value of a plain object, preserving key order - * and leaving out entries it turns into `DROP`. Non-object input is - * deep-cloned unchanged. - */ export function mapRecord(value: unknown, convert: (item: unknown, key: string) => unknown): unknown { if (!isRecord(value)) { return deepClone(value) } - const out: UnknownRecord = {} + const out: Record = {} for (const [key, item] of Object.entries(value)) { const converted = convert(item, key) if (converted !== DROP) { @@ -162,10 +155,6 @@ export function mapRecord(value: unknown, convert: (item: unknown, key: string) return out } -/** - * Applies `convert` to every element of an array, leaving out elements it - * turns into `DROP`. Non-array input is deep-cloned unchanged. - */ export function mapArray(value: unknown, convert: (item: unknown) => unknown): unknown { if (!Array.isArray(value)) { return deepClone(value) @@ -173,10 +162,6 @@ export function mapArray(value: unknown, convert: (item: unknown) => unknown): u return value.map(item => convert(item)).filter(item => item !== DROP) } -/** - * Returns the `$ref` string of a Reference-Object-shaped value, or - * `undefined` when the value is not one. - */ export function getRef(value: unknown): string | undefined { if (isRecord(value) && typeof value.$ref === 'string') { return value.$ref diff --git a/packages/downgrader/src/v3.1-to-v3.0.test.ts b/packages/downgrader/src/v3.1-to-v3.0.test.ts index 48e3293..1fa3860 100644 --- a/packages/downgrader/src/v3.1-to-v3.0.test.ts +++ b/packages/downgrader/src/v3.1-to-v3.0.test.ts @@ -1,33 +1,16 @@ import type { OpenAPIV3_1 } from '@openapi-spec/types' -import type { UnknownRecord } from './shared' +import { dig } from '../tests/helpers' import { downgradeSchemaV31ToV30, downgradeSpecV31ToV30 } from './v3.1-to-v3.0' -function asSpec(value: unknown): OpenAPIV3_1.OpenAPIObject { - return value as OpenAPIV3_1.OpenAPIObject -} - -function asSchema(value: unknown): OpenAPIV3_1.SchemaObject { - return value as OpenAPIV3_1.SchemaObject -} - -function dig(value: unknown, ...path: string[]): unknown { - let current: unknown = value - for (const key of path) { - // SAFETY: tests walk converter output whose shape the surrounding assertions pin down. - current = (current as UnknownRecord)[key] - } - return current -} - const info = { title: 't', version: '1' } /** The smallest valid 3.1 document and its 3.0 counterpart. */ const base = { info, openapi: '3.1.0', paths: {} } const converted = { info, openapi: '3.0.4', paths: {} } -function convertSpec(fields: UnknownRecord) { - return downgradeSpecV31ToV30(asSpec({ ...base, ...fields })) +function convertSpec(fields: Record) { + return downgradeSpecV31ToV30({ ...base, ...fields } as any) } function convertPathItem(pathItem: unknown): unknown { @@ -44,7 +27,7 @@ function convertComponent(kind: string, value: unknown): unknown { } function convertSchema(schema: unknown): unknown { - return downgradeSchemaV31ToV30(asSchema(schema)) + return downgradeSchemaV31ToV30(schema as any) } describe('downgradeSpecV31ToV30', () => { @@ -56,7 +39,7 @@ describe('downgradeSpecV31ToV30', () => { }) it('adds openapi 3.0.4 and an empty paths object when they are missing', () => { - expect(downgradeSpecV31ToV30(asSpec({ info }))).toEqual(converted) + expect(downgradeSpecV31ToV30({ info } as any)).toEqual(converted) }) it('removes jsonSchemaDialect and webhooks without leaving traces', () => { @@ -77,11 +60,11 @@ describe('downgradeSpecV31ToV30', () => { }) it('clones non-object input unchanged', () => { - expect(downgradeSpecV31ToV30(asSpec(null))).toBeNull() - expect(downgradeSpecV31ToV30(asSpec(42))).toBe(42) - expect(downgradeSpecV31ToV30(asSpec('spec'))).toBe('spec') + expect(downgradeSpecV31ToV30(null as any)).toBeNull() + expect(downgradeSpecV31ToV30(42 as any)).toBe(42) + expect(downgradeSpecV31ToV30('spec' as any)).toBe('spec') const list = [1, { a: 1 }] - const result = downgradeSpecV31ToV30(asSpec(list)) + const result = downgradeSpecV31ToV30(list as any) expect(result).toEqual(list) expect(result).not.toBe(list) }) @@ -603,7 +586,7 @@ describe('downgradeSpecV31ToV30', () => { describe('robustness', () => { it('never mutates the input document', () => { - const input = asSpec({ + const input: OpenAPIV3_1.OpenAPIObject = { components: { pathItems: { Reusable: { get: { summary: 's' } } }, schemas: { S: { $ref: '#/c/s', type: ['string', 'null'] } }, @@ -630,15 +613,15 @@ describe('downgradeSpecV31ToV30', () => { }, security: [{ mtls: [] }], webhooks: { newPet: { post: { summary: 's' } } }, - }) + } const before = structuredClone(input) downgradeSpecV31ToV30(input) expect(input).toEqual(before) }) it('converts a path item that cycles through its callbacks without throwing', () => { - const callback: UnknownRecord = {} - const pathItem: UnknownRecord = { + const callback: Record = {} + const pathItem: Record = { get: { callbacks: { cb: callback }, responses: {} }, } callback.expr = pathItem @@ -1202,7 +1185,7 @@ describe('downgradeSchemaV31ToV30', () => { describe('robustness', () => { it('never mutates the input schema', () => { - const input = asSchema({ + const input: OpenAPIV3_1.SchemaObject = { $ref: '#/c/s', allOf: [{ type: 'string' }], const: null, @@ -1212,23 +1195,23 @@ describe('downgradeSchemaV31ToV30', () => { prefixItems: [{ type: 'string' }], properties: { a: { type: ['string', 'null'] } }, type: ['object', 'null'], - }) + } const before = structuredClone(input) downgradeSchemaV31ToV30(input) expect(input).toEqual(before) }) it('converts deeply nested schemas without throwing', () => { - let deep = asSchema({ type: 'string' }) + let deep: OpenAPIV3_1.SchemaObject = { type: 'string' } for (let index = 0; index < 1000; index += 1) { - deep = asSchema({ items: deep, type: 'array' }) + deep = { items: deep, type: 'array' } } expect(() => downgradeSchemaV31ToV30(deep)).not.toThrow() }) it('converts a schema whose subtree cycles back to itself without throwing', () => { - const properties: UnknownRecord = {} - const node: UnknownRecord = { properties, type: 'object' } + const properties: Record = {} + const node: Record = { properties, type: 'object' } properties.self = node expect(convertSchema(node)).toHaveProperty( ['properties', 'self', 'type'], diff --git a/packages/downgrader/src/v3.1-to-v3.0.ts b/packages/downgrader/src/v3.1-to-v3.0.ts index eff5c60..7385bbe 100644 --- a/packages/downgrader/src/v3.1-to-v3.0.ts +++ b/packages/downgrader/src/v3.1-to-v3.0.ts @@ -8,23 +8,7 @@ * converted, and existing specification extensions (`x-` keys) as well as * unknown keys are always preserved. Constructs 3.0 cannot express are * converted where an equivalent exists and removed otherwise — the converter - * never invents `x-` keys of its own: - * - * - Removed: `webhooks`, `components.pathItems`, `jsonSchemaDialect`, - * `info.summary`, and `license.identifier`. - * - Schema keywords are rewritten where 3.0 has an equivalent (`type` arrays - * with `"null"` become `nullable`, `const` becomes a single-value `enum`, - * numeric exclusive bounds become bound + boolean, the first entry of - * `examples` becomes `example`, `contentEncoding: "base64"` and - * `contentMediaType: "application/octet-stream"` become `format: "byte"` - * and `format: "binary"`), and dropped where dropping merely loosens - * validation (`if`/`then`/`else`, `prefixItems`, `patternProperties`, - * `unevaluated*`, `$defs`, `$dynamic*`, ...). - * - Boolean schemas become `{}` / `{ not: {} }`, and a schema `$ref` with - * sibling keywords is wrapped in `allOf` (3.0 references must stand alone). - * - `mutualTLS` security schemes (and the security requirements referencing - * them) are removed, and non-OAuth security requirements lose their role - * names, as 3.0 supports neither. + * never invents `x-` keys of its own. The README lists every mapping. * * @see {@link https://spec.openapis.org/oas/v3.1.2.html} * @see {@link https://spec.openapis.org/oas/v3.0.4.html} @@ -32,7 +16,7 @@ import type { OpenAPIV3_0, OpenAPIV3_1 } from '@openapi-spec/types' -import type { FieldConverter, FieldTable, UnknownRecord } from './shared' +import type { FieldConverter, FieldTable } from './shared' import { convertRecord, deepClone, @@ -54,19 +38,17 @@ function convertRefOr(value: unknown, convert: (item: unknown) => unknown): unkn return ref === undefined ? convert(value) : { $ref: ref } } -/** Field converter for a map of reference-or-object entries. */ function refMap(convert: (item: unknown) => unknown): FieldConverter { return item => mapRecord(item, entry => convertRefOr(entry, convert)) } -/** Field converter for a list of reference-or-object entries. */ function refList(convert: (item: unknown) => unknown): FieldConverter { return item => mapArray(item, entry => convertRefOr(entry, convert)) } -function applyTypes(types: string[], schema: UnknownRecord, out: UnknownRecord): void { +function applyTypes(types: string[], schema: Record, out: Record): void { const nullable = types.includes('null') const rest = types.filter(item => item !== 'null') if (rest.length === 1) { @@ -112,7 +94,7 @@ function applyTypes(types: string[], schema: UnknownRecord, out: UnknownRecord): // Multiple non-null types: 3.0 only allows a single `type`, so the type // union moves into `anyOf` branches. const variants = rest.map((item) => { - const variant: UnknownRecord = { type: item } + const variant: Record = { type: item } if (item === 'array') { // 3.0 requires `items` whenever `type` is "array". variant.items = out.items === undefined ? {} : deepClone(out.items) @@ -135,7 +117,7 @@ function applyTypes(types: string[], schema: UnknownRecord, out: UnknownRecord): // union is dropped rather than clobbering the passed-through allOf. } -function convertType(schema: UnknownRecord, out: UnknownRecord): void { +function convertType(schema: Record, out: Record): void { const { type } = schema if (type === undefined) { return @@ -154,22 +136,20 @@ function convertType(schema: UnknownRecord, out: UnknownRecord): void { applyTypes(types, schema, out) return } - // Malformed: pass through. setKey(out, 'type', deepClone(type)) } -function convertConst(schema: UnknownRecord, out: UnknownRecord): void { +function convertConst(schema: Record, out: Record): void { if (!('const' in schema)) { return } - // `const` is a single-value `enum`. out.enum = [deepClone(schema.const)] if (schema.const === null) { out.nullable = true } } -function convertExamples(schema: UnknownRecord, out: UnknownRecord): void { +function convertExamples(schema: Record, out: Record): void { // 3.0 only has the singular `example`; the first entry wins, unless an // explicit `example` already exists. The rest have no 3.0 home. if ( @@ -181,7 +161,7 @@ function convertExamples(schema: UnknownRecord, out: UnknownRecord): void { } } -function convertExclusiveBounds(schema: UnknownRecord, out: UnknownRecord): void { +function convertExclusiveBounds(schema: Record, out: Record): void { const { exclusiveMaximum, exclusiveMinimum, maximum, minimum } = schema // 3.1's numeric exclusive bounds become 3.0's bound + boolean pairs. When // an inclusive bound is also present, the tighter constraint wins. @@ -201,7 +181,7 @@ function convertExclusiveBounds(schema: UnknownRecord, out: UnknownRecord): void } } -function convertContentKeywords(schema: UnknownRecord, out: UnknownRecord): void { +function convertContentKeywords(schema: Record, out: Record): void { // 3.1 replaced 3.0's `format: "byte"` / `format: "binary"` with the JSON // Schema content keywords; reconstruct the formats when unambiguous. if (out.format !== undefined) { @@ -243,7 +223,7 @@ function convertXml(value: unknown, schemaType: unknown): unknown { } /** Converts the keywords whose 3.0 form depends on several 3.1 keywords at once. */ -function finishSchema(out: UnknownRecord, schema: UnknownRecord): UnknownRecord { +function finishSchema(out: Record, schema: Record): Record { convertType(schema, out) convertConst(schema, out) convertExamples(schema, out) @@ -271,27 +251,10 @@ function finishSchema(out: UnknownRecord, schema: UnknownRecord): UnknownRecord return out } -function convertSchema(schema: unknown): unknown { - if (schema === true) { - return {} - } - if (schema === false) { - return { not: {} } - } - if ( - isRecord(schema) - && typeof schema.$ref === 'string' - && Object.keys(schema).length === 1 - ) { - return { $ref: schema.$ref } - } - // eslint-disable-next-line ts/no-use-before-define -- mutually recursive with the field table, as schemas are recursive structures - return convertRecord(schema, SCHEMA_FIELDS, finishSchema) +function convertSubschemas(item: unknown): unknown { + return mapArray(item, convertSchema) } -const convertSubschemas: FieldConverter = item => - mapArray(item, convertSchema) - /** * Every 3.1 Schema Object keyword 3.0 treats differently; the rest (including * unknown keywords and `x-` extensions) is copied as it is. Keywords with no @@ -309,8 +272,7 @@ const SCHEMA_FIELDS: FieldTable = { $dynamicAnchor: DROP, $dynamicRef: DROP, $id: DROP, - // A string $ref is re-attached by finishSchema; malformed values pass - // through unchanged. + // A string $ref is re-attached by finishSchema. $ref: item => (typeof item === 'string' ? DROP : deepClone(item)), $schema: DROP, $vocabulary: DROP, @@ -372,11 +334,28 @@ const SCHEMA_FIELDS: FieldTable = { xml: (item, schema) => convertXml(item, schema.type), } +function convertSchema(schema: unknown): unknown { + if (schema === true) { + return {} + } + if (schema === false) { + return { not: {} } + } + if ( + isRecord(schema) + && typeof schema.$ref === 'string' + && Object.keys(schema).length === 1 + ) { + return { $ref: schema.$ref } + } + return convertRecord(schema, SCHEMA_FIELDS, finishSchema) +} + /** * Converts an OpenAPI 3.1 Schema Object to its OpenAPI 3.0 form. A schema * consisting solely of `$ref` becomes a 3.0 Reference Object; a `$ref` with - * sibling keywords is wrapped in `allOf`. See the module documentation for - * the full keyword mapping. + * sibling keywords is wrapped in `allOf`. See the README for the full + * keyword mapping. */ export function downgradeSchemaV31ToV30(schema: OpenAPIV3_1.SchemaObject): OpenAPIV3_0.ReferenceObject | OpenAPIV3_0.SchemaObject { const converted: unknown = convertSchema(schema) @@ -387,9 +366,7 @@ export function downgradeSchemaV31ToV30(schema: OpenAPIV3_1.SchemaO const SECURITY_SCHEMES_REF_PREFIX = '#/components/securitySchemes/' interface SecuritySchemeIndex { - /** Names of `mutualTLS` schemes, which 3.0 cannot represent at all. */ mutualTls: Set - /** Scheme name to declared `type`, for every recognizable scheme. */ types: Map } @@ -397,7 +374,7 @@ interface SecuritySchemeIndex { * Resolves the declared `type` of a security scheme, following local * reference aliases with cycle protection. */ -function resolveSchemeType(name: string, schemes: UnknownRecord, seen: Set): string | undefined { +function resolveSchemeType(name: string, schemes: Record, seen: Set): string | undefined { if (seen.has(name) || !Object.hasOwn(schemes, name)) { return undefined } @@ -481,7 +458,6 @@ function convertSecurity(value: unknown, index: SecuritySchemeIndex): unknown { function convertInfo(value: unknown): unknown { return convertRecord(value, { - // No SPDX `identifier` and no `summary` in 3.0. license: item => convertRecord(item, { identifier: DROP }), summary: DROP, }) @@ -492,7 +468,6 @@ function convertParameterOrHeader(value: unknown): unknown { return convertRecord( value, { - content: item => mapRecord(item, convertMediaType), examples: refMap(deepClone), schema: convertSchema, @@ -520,8 +495,9 @@ function convertMediaType(value: unknown): unknown { }) } -const convertContent: FieldConverter = item => - mapRecord(item, convertMediaType) +function convertContent(item: unknown): unknown { + return mapRecord(item, convertMediaType) +} function convertRequestBody(value: unknown): unknown { return convertRecord(value, { content: convertContent }) @@ -535,17 +511,17 @@ function convertResponse(value: unknown): unknown { }) } -const convertResponses: FieldConverter = item => - mapRecord(item, (entry, key) => +function convertResponses(item: unknown): unknown { + return mapRecord(item, (entry, key) => key.startsWith('x-') ? deepClone(entry) : convertRefOr(entry, convertResponse)) +} function convertOperation(value: unknown, index: SecuritySchemeIndex): unknown { return convertRecord( value, { - callbacks: refMap(item => convertCallback(item, index)), parameters: refList(convertParameterOrHeader), requestBody: item => convertRefOr(item, convertRequestBody), @@ -565,7 +541,6 @@ function convertOperation(value: unknown, index: SecuritySchemeIndex): unknown { function convertCallback(value: unknown, index: SecuritySchemeIndex): unknown { return mapRecord(value, (item, key) => - key.startsWith('x-') ? deepClone(item) : convertPathItem(item, index)) } @@ -588,7 +563,6 @@ function convertComponents(value: unknown, index: SecuritySchemeIndex): unknown headers: refMap(convertParameterOrHeader), links: refMap(deepClone), parameters: refMap(convertParameterOrHeader), - // 3.0 has no reusable path items. pathItems: DROP, requestBodies: refMap(convertRequestBody), responses: refMap(convertResponse), @@ -606,7 +580,6 @@ function convertSpec(spec: unknown): unknown { { components: item => convertComponents(item, index), info: convertInfo, - // 3.0 has neither schema-dialect selection nor webhooks. jsonSchemaDialect: DROP, paths: item => convertPaths(item, index), security: item => convertSecurity(item, index), diff --git a/packages/downgrader/src/v3.2-to-v3.1.test.ts b/packages/downgrader/src/v3.2-to-v3.1.test.ts index 4f3d3e4..774c385 100644 --- a/packages/downgrader/src/v3.2-to-v3.1.test.ts +++ b/packages/downgrader/src/v3.2-to-v3.1.test.ts @@ -1,34 +1,17 @@ import type { OpenAPIV3_2 } from '@openapi-spec/types' -import type { UnknownRecord } from './shared' +import { dig } from '../tests/helpers' import { downgradeSchemaV32ToV31, downgradeSpecV32ToV31 } from './v3.2-to-v3.1' -function asSpec(value: unknown): OpenAPIV3_2.OpenAPIObject { - return value as OpenAPIV3_2.OpenAPIObject +function convertSpec(fields: Record) { + return downgradeSpecV32ToV31({ openapi: '3.2.0', ...fields } as any) } -function asSchema(value: unknown): OpenAPIV3_2.SchemaObject { - return value as OpenAPIV3_2.SchemaObject -} - -function dig(value: unknown, ...path: string[]): unknown { - let current: unknown = value - for (const key of path) { - // SAFETY: tests walk converter output whose shape the surrounding assertions pin down. - current = (current as UnknownRecord)[key] - } - return current -} - -function convertSpec(fields: UnknownRecord) { - return downgradeSpecV32ToV31(asSpec({ openapi: '3.2.0', ...fields })) -} - -function convertPathItem(pathItem: unknown, components: UnknownRecord = {}): unknown { +function convertPathItem(pathItem: unknown, components: Record = {}): unknown { return dig(convertSpec({ components, paths: { '/a': pathItem } }), 'paths', '/a') } -function convertComponent(kind: string, value: unknown, components: UnknownRecord = {}): unknown { +function convertComponent(kind: string, value: unknown, components: Record = {}): unknown { return dig( convertSpec({ components: { ...components, [kind]: { X: value } } }), 'components', @@ -38,7 +21,7 @@ function convertComponent(kind: string, value: unknown, components: UnknownRecor } /** Converts a request body content map, optionally beside `components` to resolve against. */ -function convertContent(content: unknown, components: UnknownRecord = {}): unknown { +function convertContent(content: unknown, components: Record = {}): unknown { return dig( convertPathItem( { post: { requestBody: { content }, responses: {} } }, @@ -65,7 +48,7 @@ describe('downgradeSpecV32ToV31', () => { }) it('adds openapi: 3.1.2 when the input has no openapi field', () => { - expect(downgradeSpecV32ToV31(asSpec({}))).toEqual({ openapi: '3.1.2' }) + expect(downgradeSpecV32ToV31({} as any)).toEqual({ openapi: '3.1.2' }) }) it('removes $self', () => { @@ -75,9 +58,9 @@ describe('downgradeSpecV32ToV31', () => { }) it('returns non-object input unchanged', () => { - expect(downgradeSpecV32ToV31(asSpec(null))).toBeNull() - expect(downgradeSpecV32ToV31(asSpec('junk'))).toBe('junk') - expect(downgradeSpecV32ToV31(asSpec([1, 2]))).toEqual([1, 2]) + expect(downgradeSpecV32ToV31(null as any)).toBeNull() + expect(downgradeSpecV32ToV31('junk' as any)).toBe('junk') + expect(downgradeSpecV32ToV31([1, 2] as any)).toEqual([1, 2]) }) it('preserves x- keys and unknown keys at the document, path item, and operation levels', () => { @@ -1190,7 +1173,7 @@ describe('downgradeSpecV32ToV31', () => { describe('robustness', () => { it('never mutates the input document', () => { - const spec = asSpec({ + const spec = { $self: 'https://example.com/api.json', components: { examples: { E: { dataValue: 1, serializedValue: 's' } }, @@ -1222,15 +1205,15 @@ describe('downgradeSpecV32ToV31', () => { servers: [{ name: 'root', url: 'https://example.com' }], tags: [{ kind: 'nav', name: 't', parent: 'p', summary: 's' }], webhooks: { hook: { query: { description: 'wq' } } }, - }) + } as any const before = structuredClone(spec) downgradeSpecV32ToV31(spec) expect(spec).toEqual(before) }) it('converts a path item that cycles through its callbacks without throwing', () => { - const callback: UnknownRecord = {} - const pathItem: UnknownRecord = { + const callback: Record = {} + const pathItem: Record = { get: { callbacks: { cb: callback }, responses: {} }, } callback.expr = pathItem @@ -1250,8 +1233,8 @@ describe('downgradeSchemaV32ToV31', () => { properties: { a: { xml: { nodeType: 'text' } } }, type: 'object', xml: { nodeType: 'attribute' }, - } - const result = downgradeSchemaV32ToV31(asSchema(source)) + } satisfies OpenAPIV3_2.SchemaObject + const result = downgradeSchemaV32ToV31(source) expect(result).toEqual(source) expect(result).not.toBe(source) expect(dig(result, 'discriminator')).not.toBe(source.discriminator) @@ -1268,7 +1251,7 @@ describe('downgradeSchemaV32ToV31', () => { allOf: [{ discriminator: { defaultMapping: 'Dog' } }, true], items: { xml: { nodeType: 'cdata' } }, } - const result = downgradeSchemaV32ToV31(asSchema(source)) + const result = downgradeSchemaV32ToV31(source as any) expect(result).toEqual(source) expect(dig(result, 'allOf')).not.toBe(source.allOf) expect(dig(result, 'allOf', '0')).not.toBe(source.allOf[0]) @@ -1282,16 +1265,16 @@ describe('downgradeSchemaV32ToV31', () => { 'type': 'number', 'x-note': 'kept', } - expect(downgradeSchemaV32ToV31(asSchema(source))).toEqual(source) + expect(downgradeSchemaV32ToV31(source as any)).toEqual(source) }) it('passes boolean and junk schema input through', () => { expect(downgradeSchemaV32ToV31(true)).toBe(true) expect(downgradeSchemaV32ToV31(false)).toBe(false) - expect(downgradeSchemaV32ToV31(asSchema('junk'))).toBe('junk') - expect(downgradeSchemaV32ToV31(asSchema(null))).toBeNull() + expect(downgradeSchemaV32ToV31('junk' as any)).toBe('junk') + expect(downgradeSchemaV32ToV31(null as any)).toBeNull() expect( - downgradeSchemaV32ToV31(asSchema({ allOf: 'junk', properties: 5 })), + downgradeSchemaV32ToV31({ allOf: 'junk', properties: 5 } as any), ).toEqual({ allOf: 'junk', properties: 5, @@ -1310,9 +1293,9 @@ describe('downgradeSchemaV32ToV31', () => { }) it('converts deeply nested schemas without throwing', () => { - let deep = asSchema({ type: 'string' }) + let deep: OpenAPIV3_2.SchemaObject = { type: 'string' } for (let index = 0; index < 1000; index += 1) { - deep = asSchema({ items: deep, type: 'array' }) + deep = { items: deep, type: 'array' } } expect(() => downgradeSchemaV32ToV31(deep)).not.toThrow() }) diff --git a/packages/downgrader/src/v3.2-to-v3.1.ts b/packages/downgrader/src/v3.2-to-v3.1.ts index ae7aa26..06bed7f 100644 --- a/packages/downgrader/src/v3.2-to-v3.1.ts +++ b/packages/downgrader/src/v3.2-to-v3.1.ts @@ -8,35 +8,7 @@ * converted, and existing specification extensions (`x-` keys) as well as * unknown keys are always preserved. Constructs 3.1 cannot express are * converted where an equivalent exists and removed otherwise — the converter - * never invents `x-` keys of its own: - * - * - Removed: `$self`, server `name`, tag `summary`/`parent`/`kind`, the - * `query` operation and `additionalOperations` of Path Items, - * `in: "querystring"` parameters (from parameter lists and - * `components.parameters`, following chains of reference aliases), - * `style: "cookie"` (the 3.1 default `form` applies), media type and - * encoding `prefixEncoding`/`itemEncoding` and nested `encoding`, OAuth - * `deviceAuthorization` flows, and security scheme `oauth2MetadataUrl` - * and `deprecated`. - * - Converted: reusable `components.mediaTypes` are inlined at their `$ref` - * use sites (3.1 content maps allow no references) and the map itself is - * removed; content entries whose reference cannot be inlined are removed, - * and a parameter or header losing its entire `content` that way is - * removed with it (3.1 requires exactly one entry there); media type - * `itemSchema` becomes `schema: { type: "array", items }` when no - * `schema` exists (the 3.2 sequential media type data model) and is - * removed otherwise; example `dataValue`/`serializedValue` fill a free - * `value` slot (in that order); response `summary` becomes the - * `description` when none exists (3.1 requires one, so `""` is - * synthesized as a last resort). - * - Schema Objects pass through unchanged: the 3.2 Schema Object keyword - * set is identical to 3.1's (3.2 defines its own dialect URI, but only - * the OAS base vocabulary gained fields), so the 3.2-only fields - * (discriminator `defaultMapping`, XML `nodeType`) are deliberately - * retained. The standard 3.1 document schema tolerates them, but the - * strict OAS base-vocabulary meta-schema closes the XML and - * Discriminator Objects to `x-` extras, and 3.1 tooling will not act on - * them; `nodeType` is recovered on the 3.1-to-3.0 hop. + * never invents `x-` keys of its own. The README lists every mapping. * * @see {@link https://spec.openapis.org/oas/v3.2.0.html} * @see {@link https://spec.openapis.org/oas/v3.1.2.html} @@ -44,7 +16,7 @@ import type { OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types' -import type { FieldConverter, UnknownRecord } from './shared' +import type { FieldConverter } from './shared' import { convertRecord, deepClone, @@ -61,23 +33,16 @@ const MEDIA_TYPES_REF_PREFIX = '#/components/mediaTypes/' const PARAMETERS_REF_PREFIX = '#/components/parameters/' interface Context { - /** The raw `components.mediaTypes` map, used to inline references. */ - mediaTypes: UnknownRecord | undefined - /** `$ref` strings of `components.headers` entries conversion removes. */ + mediaTypes: Record | undefined removedHeaderRefs: ReadonlySet - /** `$ref` strings of `components.parameters` entries conversion removes. */ removedParameterRefs: ReadonlySet } /** * Converts an OpenAPI 3.2 Schema Object to its OpenAPI 3.1 form: a deep - * clone. The 3.2 Schema Object keyword set is identical to 3.1's (3.2 - * defines its own dialect URI, but only the OAS base vocabulary gained - * fields), so the 3.2-only fields (discriminator `defaultMapping`, XML - * `nodeType`) are deliberately retained. The standard 3.1 document schema - * tolerates them; the strict OAS base-vocabulary meta-schema closes the - * XML and Discriminator Objects to `x-` extras, and 3.1 tooling will not - * act on them. + * clone, as the 3.2 Schema Object keyword set is identical to 3.1's. The + * 3.2-only `defaultMapping` and `nodeType` fields are deliberately retained; + * the README explains the trade-off. */ export function downgradeSchemaV32ToV31(schema: OpenAPIV3_2.SchemaObject): OpenAPIV3_1.SchemaObject { const converted: unknown = deepClone(schema) @@ -93,7 +58,6 @@ function convertRefOr(value: unknown, context: Context, convert: (item: unknown, return getRef(value) === undefined ? convert(value, context) : deepClone(value) } -/** Field converter for a map of reference-or-object entries. */ function refMap(context: Context, convert: (item: unknown, innerContext: Context) => unknown): FieldConverter { return item => mapRecord(item, entry => convertRefOr(entry, context, convert)) @@ -113,8 +77,6 @@ function convertLink(value: unknown): unknown { function convertSecurityScheme(value: unknown): unknown { return convertRecord(value, { - // `deprecated`, `oauth2MetadataUrl`, and the device authorization flow - // are new in 3.2. deprecated: DROP, flows: item => convertRecord(item, { deviceAuthorization: DROP }), oauth2MetadataUrl: DROP, @@ -126,9 +88,8 @@ function convertExample(value: unknown): unknown { value, { dataValue: DROP, serializedValue: DROP }, (out, example) => { - // 3.2's dataValue/serializedValue fill 3.1's `value` slot when it is - // free (and no externalValue competes); whatever cannot be promoted is - // removed. + // dataValue/serializedValue fill 3.1's `value` slot when it is free + // and no externalValue competes. if ('value' in example || 'externalValue' in example) { return out } @@ -143,12 +104,10 @@ function convertExample(value: unknown): unknown { ) } -/** Whether a parameter uses the 3.2-only `querystring` location. */ function isQuerystringParameter(value: unknown): boolean { return isRecord(value) && value.in === 'querystring' } -/** Whether the value references a component entry conversion removes. */ function isRemovedRef(value: unknown, removed: ReadonlySet): boolean { const ref = getRef(value) return ref !== undefined && removed.has(ref) @@ -165,11 +124,10 @@ function convertParameterOrHeader(value: unknown, context: Context): unknown { !('in' in parameter) || parameter.in === 'query' ? deepClone(item) : DROP, - content: item => convertContentMap(item, context), examples: refMap(context, convertExample), // "cookie" is not a 3.1 style; removing it lets the 3.1 default - // (`form`) take over. Other styles pass through. + // (`form`) take over. style: item => (item === 'cookie' ? DROP : deepClone(item)), }, (out, parameter) => { @@ -185,10 +143,6 @@ function convertParameterOrHeader(value: unknown, context: Context): unknown { ) } -/** - * Converts a parameter list entry, removing 3.2-only `querystring` - * parameters and references to removed component parameters. - */ function convertParameterEntry(value: unknown, context: Context): unknown { return isQuerystringParameter(value) || isRemovedRef(value, context.removedParameterRefs) @@ -196,10 +150,6 @@ function convertParameterEntry(value: unknown, context: Context): unknown { : convertRefOr(value, context, convertParameterOrHeader) } -function convertParameterList(value: unknown, context: Context): unknown { - return mapArray(value, item => convertParameterEntry(item, context)) -} - function convertHeaderMap(value: unknown, context: Context): unknown { return mapRecord(value, item => isRemovedRef(item, context.removedHeaderRefs) @@ -209,7 +159,6 @@ function convertHeaderMap(value: unknown, context: Context): unknown { function convertEncoding(value: unknown, context: Context): unknown { return convertRecord(value, { - // Nested and positional encoding are new in 3.2. encoding: DROP, headers: item => convertHeaderMap(item, context), itemEncoding: DROP, @@ -221,8 +170,6 @@ function convertMediaType(value: unknown, context: Context): unknown { return convertRecord( value, { - // `description`, positional encoding, and nested encoding are - // 3.2-only; `itemSchema` is recovered below. description: DROP, encoding: item => mapRecord(item, entry => convertEncoding(entry, context)), @@ -247,7 +194,7 @@ function convertMediaType(value: unknown, context: Context): unknown { * themselves), or to `DROP` when it cannot be inlined: an external, unknown, * or cyclic target. */ -function resolveMediaType(value: unknown, mediaTypes: UnknownRecord | undefined, seen: Set): unknown { +function resolveMediaType(value: unknown, mediaTypes: Record | undefined, seen: Set): unknown { const ref = getRef(value) if (ref === undefined) { return value @@ -296,8 +243,7 @@ function convertResponse(value: unknown, context: Context): unknown { }, (out, response) => { if (out.description === undefined) { - // Required in 3.1, optional in 3.2: the 3.2 summary stands in, and - // `""` is synthesized as a last resort. + // Required in 3.1, optional in 3.2. out.description = 'summary' in response ? deepClone(response.summary) : '' } @@ -315,9 +261,9 @@ function convertResponses(value: unknown, context: Context): unknown { function convertOperation(value: unknown, context: Context): unknown { return convertRecord(value, { - callbacks: refMap(context, convertCallback), - parameters: item => convertParameterList(item, context), + parameters: item => + mapArray(item, entry => convertParameterEntry(entry, context)), requestBody: item => convertRefOr(item, context, convertRequestBody), responses: item => convertResponses(item, context), servers: item => mapArray(item, convertServer), @@ -326,16 +272,15 @@ function convertOperation(value: unknown, context: Context): unknown { function convertCallback(value: unknown, context: Context): unknown { return mapRecord(value, (item, key) => - key.startsWith('x-') ? deepClone(item) : convertPathItem(item, context)) } function convertPathItem(value: unknown, context: Context): unknown { return convertRecord(value, { ...operationFields(item => convertOperation(item, context)), - // The QUERY method and arbitrary additional operations are 3.2-only. additionalOperations: DROP, - parameters: item => convertParameterList(item, context), + parameters: item => + mapArray(item, entry => convertParameterEntry(entry, context)), query: DROP, servers: item => mapArray(item, convertServer), }) @@ -364,8 +309,7 @@ function convertComponents(value: unknown, context: Context): unknown { }) } -/** Whether conversion would remove every entry of the value's `content`. */ -function losesEntireContent(value: unknown, mediaTypes: UnknownRecord | undefined): boolean { +function losesEntireContent(value: unknown, mediaTypes: Record | undefined): boolean { if (!(isRecord(value) && isRecord(value.content))) { return false } @@ -384,7 +328,7 @@ function losesEntireContent(value: unknown, mediaTypes: UnknownRecord | undefine * `content`), iterated to a fixpoint so chains of reference aliases are * removed with their targets. */ -function indexRemovedComponentRefs(map: unknown, prefix: string, mediaTypes: UnknownRecord | undefined, isDirectlyRemoved: (item: unknown) => boolean): Set { +function indexRemovedComponentRefs(map: unknown, prefix: string, mediaTypes: Record | undefined, isDirectlyRemoved: (item: unknown) => boolean): Set { const removed = new Set() if (!isRecord(map)) { return removed @@ -440,7 +384,6 @@ function convertSpec(spec: unknown): unknown { return convertRecord( spec, { - // 3.1 has no self-assigned document URI. $self: DROP, components: item => convertComponents(item, context), paths: item => convertPaths(item, context), diff --git a/packages/downgrader/tests/corpus.test.ts b/packages/downgrader/tests/corpus.test.ts index adaa101..2ca2091 100644 --- a/packages/downgrader/tests/corpus.test.ts +++ b/packages/downgrader/tests/corpus.test.ts @@ -1,5 +1,4 @@ import type { OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types' -import { Validator } from '@seriousme/openapi-schema-validator' import { doc as exampleQueryV32 } from '../../types/tests/examples/3-2-query-example' import { doc as exampleTagsV32 } from '../../types/tests/examples/3-2-tags-example' @@ -76,33 +75,7 @@ import { doc as tagObjectExampleV32 } from '../../types/tests/schema-tests-3.2/t import { doc as validSchemaTypesV32 } from '../../types/tests/schema-tests-3.2/valid-schema-types' import { doc as webhookExampleV32 } from '../../types/tests/schema-tests-3.2/webhook-example' import { downgradeSpecV31ToV30, downgradeSpecV32ToV31 } from '../src/index' - -function asSpec31(value: unknown): OpenAPIV3_1.OpenAPIObject { - return value as OpenAPIV3_1.OpenAPIObject -} - -function asSpec32(value: unknown): OpenAPIV3_2.OpenAPIObject { - return value as OpenAPIV3_2.OpenAPIObject -} - -function asValidatorInput(value: unknown): Record { - return value as Record -} - -async function validate(spec: object) { - const validator = new Validator() - const result = await validator.validate( - asValidatorInput(structuredClone(spec)), - ) - return { result, version: validator.version } -} - -async function expectValidAs(spec: object, expectedVersion: string): Promise { - const { result, version } = await validate(spec) - expect(result.errors ?? []).toEqual([]) - expect(result.valid).toBe(true) - expect(version).toBe(expectedVersion) -} +import { expectValidAs } from './helpers' /** * Excluded 3.1 fixtures: @@ -120,48 +93,48 @@ const corpus31: readonly (readonly [ name: string, doc: OpenAPIV3_1.OpenAPIObject, ])[] = [ - ['examples/non-oauth-scopes-3-1', asSpec31(exampleNonOauthScopesV31)], - ['examples/tictactoe-3-1', asSpec31(exampleTictactoeV31)], - ['examples/webhook-example-3-1', asSpec31(exampleWebhookV31)], - ['callback-object-examples', asSpec31(callbackObjectExamplesV31)], - ['comp-pathitems', asSpec31(compPathitemsV31)], - ['components-object-example', asSpec31(componentsObjectExampleV31)], - ['example-object-examples', asSpec31(exampleObjectExamplesV31)], - ['header-object-examples', asSpec31(headerObjectExamplesV31)], - ['info-object-example', asSpec31(infoObjectExampleV31)], - ['info-summary', asSpec31(infoSummaryV31)], - ['json-schema-dialect', asSpec31(jsonSchemaDialectV31)], - ['license-identifier', asSpec31(licenseIdentifierV31)], - ['link-object-examples', asSpec31(linkObjectExamplesV31)], - ['media-type-examples', asSpec31(mediaTypeExamplesV31)], - ['mega', asSpec31(megaV31)], - ['minimal-comp', asSpec31(minimalCompV31)], - ['minimal-hooks', asSpec31(minimalHooksV31)], - ['minimal-paths', asSpec31(minimalPathsV31)], - ['non-oauth-scopes', asSpec31(nonOauthScopesV31)], - ['operation-object-example', asSpec31(operationObjectExampleV31)], - ['parameter-object-examples', asSpec31(parameterObjectExamplesV31)], + ['examples/non-oauth-scopes-3-1', exampleNonOauthScopesV31], + ['examples/tictactoe-3-1', exampleTictactoeV31], + ['examples/webhook-example-3-1', exampleWebhookV31], + ['callback-object-examples', callbackObjectExamplesV31], + ['comp-pathitems', compPathitemsV31], + ['components-object-example', componentsObjectExampleV31], + ['example-object-examples', exampleObjectExamplesV31], + ['header-object-examples', headerObjectExamplesV31], + ['info-object-example', infoObjectExampleV31], + ['info-summary', infoSummaryV31], + ['json-schema-dialect', jsonSchemaDialectV31], + ['license-identifier', licenseIdentifierV31], + ['link-object-examples', linkObjectExamplesV31], + ['media-type-examples', mediaTypeExamplesV31], + ['mega', megaV31], + ['minimal-comp', minimalCompV31], + ['minimal-hooks', minimalHooksV31], + ['minimal-paths', minimalPathsV31], + ['non-oauth-scopes', nonOauthScopesV31], + ['operation-object-example', operationObjectExampleV31], + ['parameter-object-examples', parameterObjectExamplesV31], [ 'parameter-object-query-allow-reserved', - asSpec31(parameterObjectQueryAllowReservedV31), + parameterObjectQueryAllowReservedV31, ], - ['path-item-object-example', asSpec31(pathItemObjectExampleV31)], - ['path-item-servers-parameters', asSpec31(pathItemServersParametersV31)], - ['path-no-response', asSpec31(pathNoResponseV31)], - ['path-var-empty-pathitem', asSpec31(pathVarEmptyPathitemV31)], - ['paths-object-example', asSpec31(pathsObjectExampleV31)], - ['request-body-examples', asSpec31(requestBodyExamplesV31)], - ['response-object-examples', asSpec31(responseObjectExamplesV31)], - ['schema', asSpec31(schemaV31)], + ['path-item-object-example', pathItemObjectExampleV31], + ['path-item-servers-parameters', pathItemServersParametersV31], + ['path-no-response', pathNoResponseV31], + ['path-var-empty-pathitem', pathVarEmptyPathitemV31], + ['paths-object-example', pathsObjectExampleV31], + ['request-body-examples', requestBodyExamplesV31], + ['response-object-examples', responseObjectExamplesV31], + ['schema', schemaV31], [ 'schema-object-deprecated-example-keyword', - asSpec31(schemaObjectDeprecatedExampleKeywordV31), + schemaObjectDeprecatedExampleKeywordV31, ], - ['servers', asSpec31(serversV31)], - ['specification-extensions', asSpec31(specificationExtensionsV31)], - ['tag-object-example', asSpec31(tagObjectExampleV31)], - ['valid-schema-types', asSpec31(validSchemaTypesV31)], - ['webhook-example', asSpec31(webhookExampleV31)], + ['servers', serversV31], + ['specification-extensions', specificationExtensionsV31], + ['tag-object-example', tagObjectExampleV31], + ['valid-schema-types', validSchemaTypesV31], + ['webhook-example', webhookExampleV31], ] /** @@ -175,56 +148,56 @@ const corpus32: readonly (readonly [ name: string, doc: OpenAPIV3_2.OpenAPIObject, ])[] = [ - ['examples/3-2-query-example', asSpec32(exampleQueryV32)], - ['examples/3-2-tags-example', asSpec32(exampleTagsV32)], - ['callback-object-examples', asSpec32(callbackObjectExamplesV32)], - ['comp-pathitems', asSpec32(compPathitemsV32)], - ['components-object-example', asSpec32(componentsObjectExampleV32)], - ['example-object-examples', asSpec32(exampleObjectExamplesV32)], - ['header-object-examples', asSpec32(headerObjectExamplesV32)], - ['info-object-example', asSpec32(infoObjectExampleV32)], - ['info-summary', asSpec32(infoSummaryV32)], - ['json-schema-dialect', asSpec32(jsonSchemaDialectV32)], - ['license-identifier', asSpec32(licenseIdentifierV32)], - ['link-object-examples', asSpec32(linkObjectExamplesV32)], - ['media-type-examples', asSpec32(mediaTypeExamplesV32)], - ['mega', asSpec32(megaV32)], - ['minimal-comp', asSpec32(minimalCompV32)], - ['minimal-hooks', asSpec32(minimalHooksV32)], - ['minimal-paths', asSpec32(minimalPathsV32)], - ['non-oauth-scopes', asSpec32(nonOauthScopesV32)], - ['operation-object-example', asSpec32(operationObjectExampleV32)], + ['examples/3-2-query-example', exampleQueryV32], + ['examples/3-2-tags-example', exampleTagsV32], + ['callback-object-examples', callbackObjectExamplesV32], + ['comp-pathitems', compPathitemsV32], + ['components-object-example', componentsObjectExampleV32], + ['example-object-examples', exampleObjectExamplesV32], + ['header-object-examples', headerObjectExamplesV32], + ['info-object-example', infoObjectExampleV32], + ['info-summary', infoSummaryV32], + ['json-schema-dialect', jsonSchemaDialectV32], + ['license-identifier', licenseIdentifierV32], + ['link-object-examples', linkObjectExamplesV32], + ['media-type-examples', mediaTypeExamplesV32], + ['mega', megaV32], + ['minimal-comp', minimalCompV32], + ['minimal-hooks', minimalHooksV32], + ['minimal-paths', minimalPathsV32], + ['non-oauth-scopes', nonOauthScopesV32], + ['operation-object-example', operationObjectExampleV32], [ 'parameter-object-cookie-form-allow-reserved', - asSpec32(parameterObjectCookieFormAllowReservedV32), + parameterObjectCookieFormAllowReservedV32, ], - ['parameter-object-examples', asSpec32(parameterObjectExamplesV32)], + ['parameter-object-examples', parameterObjectExamplesV32], [ 'parameter-object-path-allow-reserved', - asSpec32(parameterObjectPathAllowReservedV32), + parameterObjectPathAllowReservedV32, ], [ 'parameter-object-query-allow-reserved', - asSpec32(parameterObjectQueryAllowReservedV32), + parameterObjectQueryAllowReservedV32, ], - ['path-item-object-example', asSpec32(pathItemObjectExampleV32)], - ['path-item-servers-parameters', asSpec32(pathItemServersParametersV32)], - ['path-no-response', asSpec32(pathNoResponseV32)], - ['path-var-empty-pathitem', asSpec32(pathVarEmptyPathitemV32)], - ['paths-object-example', asSpec32(pathsObjectExampleV32)], - ['request-body-examples', asSpec32(requestBodyExamplesV32)], - ['response-object-examples', asSpec32(responseObjectExamplesV32)], - ['schema', asSpec32(schemaV32)], + ['path-item-object-example', pathItemObjectExampleV32], + ['path-item-servers-parameters', pathItemServersParametersV32], + ['path-no-response', pathNoResponseV32], + ['path-var-empty-pathitem', pathVarEmptyPathitemV32], + ['paths-object-example', pathsObjectExampleV32], + ['request-body-examples', requestBodyExamplesV32], + ['response-object-examples', responseObjectExamplesV32], + ['schema', schemaV32], [ 'schema-object-deprecated-example-keyword', - asSpec32(schemaObjectDeprecatedExampleKeywordV32), + schemaObjectDeprecatedExampleKeywordV32, ], - ['servers', asSpec32(serversV32)], - ['specification-extensions', asSpec32(specificationExtensionsV32)], - ['style-defaults', asSpec32(styleDefaultsV32)], - ['tag-object-example', asSpec32(tagObjectExampleV32)], - ['valid-schema-types', asSpec32(validSchemaTypesV32)], - ['webhook-example', asSpec32(webhookExampleV32)], + ['servers', serversV32], + ['specification-extensions', specificationExtensionsV32], + ['style-defaults', styleDefaultsV32], + ['tag-object-example', tagObjectExampleV32], + ['valid-schema-types', validSchemaTypesV32], + ['webhook-example', webhookExampleV32], ] describe('3.1 corpus downgraded to 3.0', () => { diff --git a/packages/downgrader/tests/e2e.test.ts b/packages/downgrader/tests/e2e.test.ts index 24fc6a9..5473269 100644 --- a/packages/downgrader/tests/e2e.test.ts +++ b/packages/downgrader/tests/e2e.test.ts @@ -1,5 +1,4 @@ import type { OpenAPIV3_1, OpenAPIV3_2 } from '@openapi-spec/types' -import { Validator } from '@seriousme/openapi-schema-validator' import { doc as queryExample } from '../../types/tests/examples/3-2-query-example' import { doc as tagsExample } from '../../types/tests/examples/3-2-tags-example' @@ -10,34 +9,12 @@ import { doc as webhookExample } from '../../types/tests/examples/webhook-exampl import { doc as mega31 } from '../../types/tests/schema-tests-3.1/mega' import { doc as mega32 } from '../../types/tests/schema-tests-3.2/mega' import { downgradeSpecV31ToV30, downgradeSpecV32ToV31 } from '../src/index' - -function asSpec31(value: unknown): OpenAPIV3_1.OpenAPIObject { - return value as OpenAPIV3_1.OpenAPIObject -} - -function asValidatorInput(value: unknown): Record { - return value as Record -} - -async function validate(spec: object) { - const validator = new Validator() - const result = await validator.validate( - asValidatorInput(structuredClone(spec)), - ) - return { result, version: validator.version } -} - -async function expectValidAs(spec: object, expectedVersion: string): Promise { - const { result, version } = await validate(spec) - expect(result.errors ?? []).toEqual([]) - expect(result.valid).toBe(true) - expect(version).toBe(expectedVersion) -} +import { expectValidAs } from './helpers' describe('3.1 example documents downgraded to 3.0', () => { it('converts the tictactoe example to a valid 3.0.4 document without mutating the input', async () => { const before = structuredClone(tictactoe) - const converted = downgradeSpecV31ToV30(asSpec31(tictactoe)) + const converted = downgradeSpecV31ToV30(tictactoe) expect(converted.openapi).toBe('3.0.4') await expectValidAs(converted, '3.0') expect(converted).toMatchSnapshot() @@ -97,7 +74,7 @@ describe('3.1 example documents downgraded to 3.0', () => { }) it('leaves $refs into the removed components.pathItems untouched, letting them dangle', () => { - const doc = asSpec31({ + const doc: OpenAPIV3_1.OpenAPIObject = { components: { pathItems: { shared: { @@ -110,7 +87,7 @@ describe('3.1 example documents downgraded to 3.0', () => { paths: { '/shared': { $ref: '#/components/pathItems/shared' }, }, - }) + } const before = structuredClone(doc) const converted = downgradeSpecV31ToV30(doc) expect(converted.components).not.toHaveProperty('pathItems') @@ -123,7 +100,7 @@ describe('3.1 example documents downgraded to 3.0', () => { }) it('clones a discriminator with defaultMapping as-is into the 3.0 document', async () => { - const doc = asSpec31({ + const doc = { components: { schemas: { Cat: { @@ -144,7 +121,7 @@ describe('3.1 example documents downgraded to 3.0', () => { info: { title: 'Discriminated', version: '1.0.0' }, openapi: '3.1.0', paths: {}, - }) + } as any const before = structuredClone(doc) const converted = downgradeSpecV31ToV30(doc) // defaultMapping is not a schema keyword the 3.0 converter touches, and @@ -258,7 +235,7 @@ describe('3.2 example documents downgraded to 3.1 and chained to 3.0', () => { describe('already-3.0-shaped documents', () => { it('passes the petstore example through untouched apart from the version stamp', () => { const before = structuredClone(petstore) - const converted = downgradeSpecV31ToV30(asSpec31(petstore)) + const converted = downgradeSpecV31ToV30(petstore as any) expect(converted).toEqual({ ...structuredClone(petstore), openapi: '3.0.4', @@ -268,7 +245,7 @@ describe('already-3.0-shaped documents', () => { }) describe('kitchen-sink 3.2 document chained down to 3.0', () => { - const kitchenSink = { + const kitchenSink: OpenAPIV3_2.OpenAPIObject = { $self: 'https://api.example.com/openapi.json', components: { mediaTypes: { @@ -379,7 +356,7 @@ describe('kitchen-sink 3.2 document chained down to 3.0', () => { }, security: [{ deviceAuth: ['events:read'] }], servers: [{ name: 'production', url: 'https://api.example.com' }], - } satisfies OpenAPIV3_2.OpenAPIObject + } it('converts every 3.2-only construct and stays valid through both hops', async () => { const before = structuredClone(kitchenSink) diff --git a/packages/downgrader/tests/helpers.ts b/packages/downgrader/tests/helpers.ts new file mode 100644 index 0000000..7e202a7 --- /dev/null +++ b/packages/downgrader/tests/helpers.ts @@ -0,0 +1,19 @@ +import { Validator } from '@seriousme/openapi-schema-validator' +import { expect } from 'vitest' + +/** Walks converter output along `path`; the surrounding assertions pin down its shape. */ +export function dig(value: unknown, ...path: string[]): unknown { + let current: unknown = value + for (const key of path) { + current = (current as Record)[key] + } + return current +} + +export async function expectValidAs(spec: object, expectedVersion: string): Promise { + const validator = new Validator() + const result = await validator.validate(structuredClone(spec) as Record) + expect(result.errors ?? []).toEqual([]) + expect(result.valid).toBe(true) + expect(validator.version).toBe(expectedVersion) +} diff --git a/packages/types/tests/README.md b/packages/types/tests/README.md index c7ced5e..e6f538e 100644 --- a/packages/types/tests/README.md +++ b/packages/types/tests/README.md @@ -1,6 +1,6 @@ # Real-document fixtures -Type-level fixtures generated from official OpenAPI documents. Each file embeds a complete document as an object literal checked with `satisfies OpenAPIObject` against the version module matching its `openapi` field, so `tsc` at the repository root re-validates the whole corpus. +Type-level fixtures generated from official OpenAPI documents. Each file embeds a complete document as an object literal typed as the `OpenAPIObject` of the version module matching its `openapi` field, so `tsc` at the repository root re-validates the whole corpus and rejects properties the specification does not allow. Sources (Apache-2.0, © the OpenAPI Initiative): diff --git a/packages/types/tests/examples/3-2-query-example.ts b/packages/types/tests/examples/3-2-query-example.ts index a7179e6..442d4e3 100644 --- a/packages/types/tests/examples/3-2-query-example.ts +++ b/packages/types/tests/examples/3-2-query-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'Flight API', @@ -112,4 +112,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/3-2-tags-example.ts b/packages/types/tests/examples/3-2-tags-example.ts index 5518c81..0a1edbd 100644 --- a/packages/types/tests/examples/3-2-tags-example.ts +++ b/packages/types/tests/examples/3-2-tags-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'Flight API', @@ -66,4 +66,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/api-with-examples-3-0.ts b/packages/types/tests/examples/api-with-examples-3-0.ts index 089a8b2..3a33c55 100644 --- a/packages/types/tests/examples/api-with-examples-3-0.ts +++ b/packages/types/tests/examples/api-with-examples-3-0.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.0' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.0.0', info: { title: 'Simple API overview', @@ -193,4 +193,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/callback-example-3-0.ts b/packages/types/tests/examples/callback-example-3-0.ts index 13f492a..a1fc609 100644 --- a/packages/types/tests/examples/callback-example-3-0.ts +++ b/packages/types/tests/examples/callback-example-3-0.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.0' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.0.0', info: { title: 'Callback Example', @@ -88,4 +88,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/link-example-3-0.ts b/packages/types/tests/examples/link-example-3-0.ts index aec74be..04d3361 100644 --- a/packages/types/tests/examples/link-example-3-0.ts +++ b/packages/types/tests/examples/link-example-3-0.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.0' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.0.0', info: { title: 'Link Example', @@ -320,4 +320,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/non-oauth-scopes-3-1.ts b/packages/types/tests/examples/non-oauth-scopes-3-1.ts index 97da6ee..683c2e5 100644 --- a/packages/types/tests/examples/non-oauth-scopes-3-1.ts +++ b/packages/types/tests/examples/non-oauth-scopes-3-1.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'Non-oAuth Scopes example', @@ -30,4 +30,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/petstore-3-0.ts b/packages/types/tests/examples/petstore-3-0.ts index ca4d2d5..4f084ab 100644 --- a/packages/types/tests/examples/petstore-3-0.ts +++ b/packages/types/tests/examples/petstore-3-0.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.0' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.0.0', info: { version: '1.0.0', @@ -178,4 +178,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/petstore-expanded-3-0.ts b/packages/types/tests/examples/petstore-expanded-3-0.ts index 8ca4e7a..6b1fcb6 100644 --- a/packages/types/tests/examples/petstore-expanded-3-0.ts +++ b/packages/types/tests/examples/petstore-expanded-3-0.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.0' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.0.0', info: { version: '1.0.0', @@ -239,4 +239,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/tictactoe-3-1.ts b/packages/types/tests/examples/tictactoe-3-1.ts index bbf6ac2..0507b89 100644 --- a/packages/types/tests/examples/tictactoe-3-1.ts +++ b/packages/types/tests/examples/tictactoe-3-1.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'Tic Tac Toe', @@ -265,4 +265,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/uspto-3-0.ts b/packages/types/tests/examples/uspto-3-0.ts index 57b4446..48bddbb 100644 --- a/packages/types/tests/examples/uspto-3-0.ts +++ b/packages/types/tests/examples/uspto-3-0.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.0' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.0.1', servers: [ { @@ -256,4 +256,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/examples/webhook-example-3-1.ts b/packages/types/tests/examples/webhook-example-3-1.ts index 053f4b5..5b8d907 100644 --- a/packages/types/tests/examples/webhook-example-3-1.ts +++ b/packages/types/tests/examples/webhook-example-3-1.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'Webhook Example', @@ -50,4 +50,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/callback-object-examples.ts b/packages/types/tests/schema-tests-3.1/callback-object-examples.ts index b165a05..c9cef0d 100644 --- a/packages/types/tests/schema-tests-3.1/callback-object-examples.ts +++ b/packages/types/tests/schema-tests-3.1/callback-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -58,4 +58,4 @@ export const doc = { SomePayload: {}, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/comp-pathitems.ts b/packages/types/tests/schema-tests-3.1/comp-pathitems.ts index 15b98a8..42b0876 100644 --- a/packages/types/tests/schema-tests-3.1/comp-pathitems.ts +++ b/packages/types/tests/schema-tests-3.1/comp-pathitems.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -11,4 +11,4 @@ export const doc = { components: { pathItems: {}, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/components-object-example.ts b/packages/types/tests/schema-tests-3.1/components-object-example.ts index 167ee88..a2468da 100644 --- a/packages/types/tests/schema-tests-3.1/components-object-example.ts +++ b/packages/types/tests/schema-tests-3.1/components-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -107,4 +107,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/example-object-examples.ts b/packages/types/tests/schema-tests-3.1/example-object-examples.ts index a67775e..f383d6a 100644 --- a/packages/types/tests/schema-tests-3.1/example-object-examples.ts +++ b/packages/types/tests/schema-tests-3.1/example-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -113,4 +113,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/header-object-examples.ts b/packages/types/tests/schema-tests-3.1/header-object-examples.ts index 0f5626c..41349a9 100644 --- a/packages/types/tests/schema-tests-3.1/header-object-examples.ts +++ b/packages/types/tests/schema-tests-3.1/header-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -40,4 +40,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/info-object-example.ts b/packages/types/tests/schema-tests-3.1/info-object-example.ts index b7dbdfe..ed11398 100644 --- a/packages/types/tests/schema-tests-3.1/info-object-example.ts +++ b/packages/types/tests/schema-tests-3.1/info-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'Example Pet Store App', @@ -25,4 +25,4 @@ export const doc = { url: 'https://example.com', }, components: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/info-summary.ts b/packages/types/tests/schema-tests-3.1/info-summary.ts index a94c48f..8e7b29c 100644 --- a/packages/types/tests/schema-tests-3.1/info-summary.ts +++ b/packages/types/tests/schema-tests-3.1/info-summary.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -10,4 +10,4 @@ export const doc = { version: '1.0.0', }, components: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/json-schema-dialect.ts b/packages/types/tests/schema-tests-3.1/json-schema-dialect.ts index a3a2c6c..2d0f6a5 100644 --- a/packages/types/tests/schema-tests-3.1/json-schema-dialect.ts +++ b/packages/types/tests/schema-tests-3.1/json-schema-dialect.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { summary: 'Testing jsonSchemaDialect', @@ -24,4 +24,4 @@ export const doc = { }, }, paths: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/license-identifier.ts b/packages/types/tests/schema-tests-3.1/license-identifier.ts index 1f29468..2a07e0d 100644 --- a/packages/types/tests/schema-tests-3.1/license-identifier.ts +++ b/packages/types/tests/schema-tests-3.1/license-identifier.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -14,4 +14,4 @@ export const doc = { }, }, components: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/link-object-examples.ts b/packages/types/tests/schema-tests-3.1/link-object-examples.ts index c85cda7..c9ee20f 100644 --- a/packages/types/tests/schema-tests-3.1/link-object-examples.ts +++ b/packages/types/tests/schema-tests-3.1/link-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -97,4 +97,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/media-type-examples.ts b/packages/types/tests/schema-tests-3.1/media-type-examples.ts index 5f9bc04..d75e31b 100644 --- a/packages/types/tests/schema-tests-3.1/media-type-examples.ts +++ b/packages/types/tests/schema-tests-3.1/media-type-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -165,4 +165,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/mega.ts b/packages/types/tests/schema-tests-3.1/mega.ts index 793743b..cbe4cb9 100644 --- a/packages/types/tests/schema-tests-3.1/mega.ts +++ b/packages/types/tests/schema-tests-3.1/mega.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { summary: 'My API\'s summary', @@ -97,4 +97,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/minimal-comp.ts b/packages/types/tests/schema-tests-3.1/minimal-comp.ts index 6632b0f..1398c44 100644 --- a/packages/types/tests/schema-tests-3.1/minimal-comp.ts +++ b/packages/types/tests/schema-tests-3.1/minimal-comp.ts @@ -2,11 +2,11 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', version: '1.0.0', }, components: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/minimal-hooks.ts b/packages/types/tests/schema-tests-3.1/minimal-hooks.ts index 8d2c69e..d5d7a5c 100644 --- a/packages/types/tests/schema-tests-3.1/minimal-hooks.ts +++ b/packages/types/tests/schema-tests-3.1/minimal-hooks.ts @@ -2,11 +2,11 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', version: '1.0.0', }, webhooks: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/minimal-paths.ts b/packages/types/tests/schema-tests-3.1/minimal-paths.ts index 1c0e7d2..9ea2008 100644 --- a/packages/types/tests/schema-tests-3.1/minimal-paths.ts +++ b/packages/types/tests/schema-tests-3.1/minimal-paths.ts @@ -2,11 +2,11 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', version: '1.0.0', }, paths: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/non-oauth-scopes.ts b/packages/types/tests/schema-tests-3.1/non-oauth-scopes.ts index f70dc57..83baae6 100644 --- a/packages/types/tests/schema-tests-3.1/non-oauth-scopes.ts +++ b/packages/types/tests/schema-tests-3.1/non-oauth-scopes.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'Non-oAuth Scopes example', @@ -30,4 +30,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/operation-object-example.ts b/packages/types/tests/schema-tests-3.1/operation-object-example.ts index 5b16d34..45f7357 100644 --- a/packages/types/tests/schema-tests-3.1/operation-object-example.ts +++ b/packages/types/tests/schema-tests-3.1/operation-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -69,4 +69,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/parameter-object-examples.ts b/packages/types/tests/schema-tests-3.1/parameter-object-examples.ts index 86337a7..6cb8f4f 100644 --- a/packages/types/tests/schema-tests-3.1/parameter-object-examples.ts +++ b/packages/types/tests/schema-tests-3.1/parameter-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -91,4 +91,4 @@ export const doc = { ], }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/parameter-object-query-allow-reserved.ts b/packages/types/tests/schema-tests-3.1/parameter-object-query-allow-reserved.ts index c9805e5..bb2c5f7 100644 --- a/packages/types/tests/schema-tests-3.1/parameter-object-query-allow-reserved.ts +++ b/packages/types/tests/schema-tests-3.1/parameter-object-query-allow-reserved.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'allowReserved only permitted with in: query', @@ -18,4 +18,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/path-item-object-example.ts b/packages/types/tests/schema-tests-3.1/path-item-object-example.ts index 27af38b..a3da765 100644 --- a/packages/types/tests/schema-tests-3.1/path-item-object-example.ts +++ b/packages/types/tests/schema-tests-3.1/path-item-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -63,4 +63,4 @@ export const doc = { ], }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/path-item-servers-parameters.ts b/packages/types/tests/schema-tests-3.1/path-item-servers-parameters.ts index d4dd68d..1aad00f 100644 --- a/packages/types/tests/schema-tests-3.1/path-item-servers-parameters.ts +++ b/packages/types/tests/schema-tests-3.1/path-item-servers-parameters.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -184,4 +184,4 @@ export const doc = { SomePayload: {}, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/path-no-response.ts b/packages/types/tests/schema-tests-3.1/path-no-response.ts index 77a4ae4..0f96f34 100644 --- a/packages/types/tests/schema-tests-3.1/path-no-response.ts +++ b/packages/types/tests/schema-tests-3.1/path-no-response.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -13,4 +13,4 @@ export const doc = { get: {}, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/path-var-empty-pathitem.ts b/packages/types/tests/schema-tests-3.1/path-var-empty-pathitem.ts index af62c1b..7d6bbfc 100644 --- a/packages/types/tests/schema-tests-3.1/path-var-empty-pathitem.ts +++ b/packages/types/tests/schema-tests-3.1/path-var-empty-pathitem.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -11,4 +11,4 @@ export const doc = { paths: { '/{var}': {}, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/paths-object-example.ts b/packages/types/tests/schema-tests-3.1/paths-object-example.ts index bf16d12..e887e0f 100644 --- a/packages/types/tests/schema-tests-3.1/paths-object-example.ts +++ b/packages/types/tests/schema-tests-3.1/paths-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -36,4 +36,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/request-body-examples.ts b/packages/types/tests/schema-tests-3.1/request-body-examples.ts index 521108e..54e1eb5 100644 --- a/packages/types/tests/schema-tests-3.1/request-body-examples.ts +++ b/packages/types/tests/schema-tests-3.1/request-body-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -63,4 +63,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/response-object-examples.ts b/packages/types/tests/schema-tests-3.1/response-object-examples.ts index 868a911..f8ee32e 100644 --- a/packages/types/tests/schema-tests-3.1/response-object-examples.ts +++ b/packages/types/tests/schema-tests-3.1/response-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -73,4 +73,4 @@ export const doc = { VeryComplexType: {}, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/schema-object-deprecated-example-keyword.ts b/packages/types/tests/schema-tests-3.1/schema-object-deprecated-example-keyword.ts index e89318a..1f3a61c 100644 --- a/packages/types/tests/schema-tests-3.1/schema-object-deprecated-example-keyword.ts +++ b/packages/types/tests/schema-tests-3.1/schema-object-deprecated-example-keyword.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -25,4 +25,4 @@ export const doc = { ], }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/schema.ts b/packages/types/tests/schema-tests-3.1/schema.ts index 2bf1815..0cad3de 100644 --- a/packages/types/tests/schema-tests-3.1/schema.ts +++ b/packages/types/tests/schema-tests-3.1/schema.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -66,4 +66,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/security-scheme-object-examples.ts b/packages/types/tests/schema-tests-3.1/security-scheme-object-examples.ts index 45617b8..30e4454 100644 --- a/packages/types/tests/schema-tests-3.1/security-scheme-object-examples.ts +++ b/packages/types/tests/schema-tests-3.1/security-scheme-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -90,4 +90,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/servers.ts b/packages/types/tests/schema-tests-3.1/servers.ts index 2d73479..1152dc9 100644 --- a/packages/types/tests/schema-tests-3.1/servers.ts +++ b/packages/types/tests/schema-tests-3.1/servers.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -37,4 +37,4 @@ export const doc = { }, }, ], -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/specification-extensions.ts b/packages/types/tests/schema-tests-3.1/specification-extensions.ts index 2622e38..a391ce2 100644 --- a/packages/types/tests/schema-tests-3.1/specification-extensions.ts +++ b/packages/types/tests/schema-tests-3.1/specification-extensions.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { 'openapi': '3.1.0', 'info': { title: 'API', @@ -10,4 +10,4 @@ export const doc = { }, 'paths': {}, 'x-tensions': 'specification extensions are prefixed with `x-`', -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/style-defaults.ts b/packages/types/tests/schema-tests-3.1/style-defaults.ts index e6d1515..3d33719 100644 --- a/packages/types/tests/schema-tests-3.1/style-defaults.ts +++ b/packages/types/tests/schema-tests-3.1/style-defaults.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: @@ -150,4 +150,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/tag-object-example.ts b/packages/types/tests/schema-tests-3.1/tag-object-example.ts index 22f55a5..a42ced5 100644 --- a/packages/types/tests/schema-tests-3.1/tag-object-example.ts +++ b/packages/types/tests/schema-tests-3.1/tag-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'API', @@ -23,4 +23,4 @@ export const doc = { }, }, ], -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/valid-schema-types.ts b/packages/types/tests/schema-tests-3.1/valid-schema-types.ts index c002639..bb796de 100644 --- a/packages/types/tests/schema-tests-3.1/valid-schema-types.ts +++ b/packages/types/tests/schema-tests-3.1/valid-schema-types.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.1', info: { title: 'API', @@ -18,4 +18,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.1/webhook-example.ts b/packages/types/tests/schema-tests-3.1/webhook-example.ts index b0ba75e..9b5593b 100644 --- a/packages/types/tests/schema-tests-3.1/webhook-example.ts +++ b/packages/types/tests/schema-tests-3.1/webhook-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.1' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.1.0', info: { title: 'Webhook Example', @@ -49,4 +49,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/callback-object-examples.ts b/packages/types/tests/schema-tests-3.2/callback-object-examples.ts index 5e4d7fa..f82b103 100644 --- a/packages/types/tests/schema-tests-3.2/callback-object-examples.ts +++ b/packages/types/tests/schema-tests-3.2/callback-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -58,4 +58,4 @@ export const doc = { SomePayload: {}, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/comp-pathitems.ts b/packages/types/tests/schema-tests-3.2/comp-pathitems.ts index 213957d..b4b9c64 100644 --- a/packages/types/tests/schema-tests-3.2/comp-pathitems.ts +++ b/packages/types/tests/schema-tests-3.2/comp-pathitems.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -11,4 +11,4 @@ export const doc = { components: { pathItems: {}, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/components-object-example.ts b/packages/types/tests/schema-tests-3.2/components-object-example.ts index f4f3472..ef1176b 100644 --- a/packages/types/tests/schema-tests-3.2/components-object-example.ts +++ b/packages/types/tests/schema-tests-3.2/components-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -107,4 +107,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/example-object-examples.ts b/packages/types/tests/schema-tests-3.2/example-object-examples.ts index 0e0c3aa..3344922 100644 --- a/packages/types/tests/schema-tests-3.2/example-object-examples.ts +++ b/packages/types/tests/schema-tests-3.2/example-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -114,4 +114,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/header-object-examples.ts b/packages/types/tests/schema-tests-3.2/header-object-examples.ts index 53dedcf..9182dd9 100644 --- a/packages/types/tests/schema-tests-3.2/header-object-examples.ts +++ b/packages/types/tests/schema-tests-3.2/header-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -40,4 +40,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/info-object-example.ts b/packages/types/tests/schema-tests-3.2/info-object-example.ts index e0905e3..dcd6c20 100644 --- a/packages/types/tests/schema-tests-3.2/info-object-example.ts +++ b/packages/types/tests/schema-tests-3.2/info-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', $self: 'https://example.com/openapi', info: { @@ -26,4 +26,4 @@ export const doc = { url: 'https://example.com', }, components: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/info-summary.ts b/packages/types/tests/schema-tests-3.2/info-summary.ts index 4abbece..974f4ac 100644 --- a/packages/types/tests/schema-tests-3.2/info-summary.ts +++ b/packages/types/tests/schema-tests-3.2/info-summary.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -10,4 +10,4 @@ export const doc = { version: '1.0.0', }, components: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/json-schema-dialect.ts b/packages/types/tests/schema-tests-3.2/json-schema-dialect.ts index 76f25d7..03cecb0 100644 --- a/packages/types/tests/schema-tests-3.2/json-schema-dialect.ts +++ b/packages/types/tests/schema-tests-3.2/json-schema-dialect.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { summary: 'Testing jsonSchemaDialect', @@ -24,4 +24,4 @@ export const doc = { }, }, paths: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/license-identifier.ts b/packages/types/tests/schema-tests-3.2/license-identifier.ts index ea3f094..f76261a 100644 --- a/packages/types/tests/schema-tests-3.2/license-identifier.ts +++ b/packages/types/tests/schema-tests-3.2/license-identifier.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -14,4 +14,4 @@ export const doc = { }, }, components: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/link-object-examples.ts b/packages/types/tests/schema-tests-3.2/link-object-examples.ts index 70dc752..501bfed 100644 --- a/packages/types/tests/schema-tests-3.2/link-object-examples.ts +++ b/packages/types/tests/schema-tests-3.2/link-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -97,4 +97,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/media-type-examples.ts b/packages/types/tests/schema-tests-3.2/media-type-examples.ts index ba0b434..2768244 100644 --- a/packages/types/tests/schema-tests-3.2/media-type-examples.ts +++ b/packages/types/tests/schema-tests-3.2/media-type-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -246,4 +246,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/mega.ts b/packages/types/tests/schema-tests-3.2/mega.ts index f09d7e5..2949436 100644 --- a/packages/types/tests/schema-tests-3.2/mega.ts +++ b/packages/types/tests/schema-tests-3.2/mega.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { summary: 'My API\'s summary', @@ -98,4 +98,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/minimal-comp.ts b/packages/types/tests/schema-tests-3.2/minimal-comp.ts index 93e66c6..ddc5a89 100644 --- a/packages/types/tests/schema-tests-3.2/minimal-comp.ts +++ b/packages/types/tests/schema-tests-3.2/minimal-comp.ts @@ -2,11 +2,11 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', version: '1.0.0', }, components: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/minimal-hooks.ts b/packages/types/tests/schema-tests-3.2/minimal-hooks.ts index 50b66b2..5a6e7e2 100644 --- a/packages/types/tests/schema-tests-3.2/minimal-hooks.ts +++ b/packages/types/tests/schema-tests-3.2/minimal-hooks.ts @@ -2,11 +2,11 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', version: '1.0.0', }, webhooks: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/minimal-paths.ts b/packages/types/tests/schema-tests-3.2/minimal-paths.ts index ff577e5..f87dfe5 100644 --- a/packages/types/tests/schema-tests-3.2/minimal-paths.ts +++ b/packages/types/tests/schema-tests-3.2/minimal-paths.ts @@ -2,11 +2,11 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', version: '1.0.0', }, paths: {}, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/non-oauth-scopes.ts b/packages/types/tests/schema-tests-3.2/non-oauth-scopes.ts index 47b6e18..79d93af 100644 --- a/packages/types/tests/schema-tests-3.2/non-oauth-scopes.ts +++ b/packages/types/tests/schema-tests-3.2/non-oauth-scopes.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'Non-oAuth Scopes example', @@ -30,4 +30,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/operation-object-example.ts b/packages/types/tests/schema-tests-3.2/operation-object-example.ts index 0b57d5f..dea82c0 100644 --- a/packages/types/tests/schema-tests-3.2/operation-object-example.ts +++ b/packages/types/tests/schema-tests-3.2/operation-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -69,4 +69,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/parameter-object-cookie-form-allow-reserved.ts b/packages/types/tests/schema-tests-3.2/parameter-object-cookie-form-allow-reserved.ts index ec18460..e03eecb 100644 --- a/packages/types/tests/schema-tests-3.2/parameter-object-cookie-form-allow-reserved.ts +++ b/packages/types/tests/schema-tests-3.2/parameter-object-cookie-form-allow-reserved.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: @@ -25,4 +25,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/parameter-object-examples.ts b/packages/types/tests/schema-tests-3.2/parameter-object-examples.ts index fe21ee5..3814933 100644 --- a/packages/types/tests/schema-tests-3.2/parameter-object-examples.ts +++ b/packages/types/tests/schema-tests-3.2/parameter-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -117,4 +117,4 @@ export const doc = { ], }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/parameter-object-path-allow-reserved.ts b/packages/types/tests/schema-tests-3.2/parameter-object-path-allow-reserved.ts index 2350039..430c466 100644 --- a/packages/types/tests/schema-tests-3.2/parameter-object-path-allow-reserved.ts +++ b/packages/types/tests/schema-tests-3.2/parameter-object-path-allow-reserved.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'api', @@ -19,4 +19,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/parameter-object-query-allow-reserved.ts b/packages/types/tests/schema-tests-3.2/parameter-object-query-allow-reserved.ts index 6848a6b..17399c1 100644 --- a/packages/types/tests/schema-tests-3.2/parameter-object-query-allow-reserved.ts +++ b/packages/types/tests/schema-tests-3.2/parameter-object-query-allow-reserved.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: @@ -19,4 +19,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/path-item-object-example.ts b/packages/types/tests/schema-tests-3.2/path-item-object-example.ts index 9da7fd1..d2d4646 100644 --- a/packages/types/tests/schema-tests-3.2/path-item-object-example.ts +++ b/packages/types/tests/schema-tests-3.2/path-item-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -125,4 +125,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/path-item-servers-parameters.ts b/packages/types/tests/schema-tests-3.2/path-item-servers-parameters.ts index c8a3d6a..a36fb70 100644 --- a/packages/types/tests/schema-tests-3.2/path-item-servers-parameters.ts +++ b/packages/types/tests/schema-tests-3.2/path-item-servers-parameters.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -184,4 +184,4 @@ export const doc = { SomePayload: {}, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/path-no-response.ts b/packages/types/tests/schema-tests-3.2/path-no-response.ts index 1a01708..fde4702 100644 --- a/packages/types/tests/schema-tests-3.2/path-no-response.ts +++ b/packages/types/tests/schema-tests-3.2/path-no-response.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -13,4 +13,4 @@ export const doc = { get: {}, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/path-var-empty-pathitem.ts b/packages/types/tests/schema-tests-3.2/path-var-empty-pathitem.ts index a6c13a6..7a32226 100644 --- a/packages/types/tests/schema-tests-3.2/path-var-empty-pathitem.ts +++ b/packages/types/tests/schema-tests-3.2/path-var-empty-pathitem.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -11,4 +11,4 @@ export const doc = { paths: { '/{var}': {}, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/paths-object-example.ts b/packages/types/tests/schema-tests-3.2/paths-object-example.ts index 3f05aa0..92cd832 100644 --- a/packages/types/tests/schema-tests-3.2/paths-object-example.ts +++ b/packages/types/tests/schema-tests-3.2/paths-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -36,4 +36,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/request-body-examples.ts b/packages/types/tests/schema-tests-3.2/request-body-examples.ts index c80e081..bd0e24e 100644 --- a/packages/types/tests/schema-tests-3.2/request-body-examples.ts +++ b/packages/types/tests/schema-tests-3.2/request-body-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -63,4 +63,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/response-object-examples.ts b/packages/types/tests/schema-tests-3.2/response-object-examples.ts index 116db54..55597dd 100644 --- a/packages/types/tests/schema-tests-3.2/response-object-examples.ts +++ b/packages/types/tests/schema-tests-3.2/response-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -74,4 +74,4 @@ export const doc = { VeryComplexType: {}, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/schema-object-deprecated-example-keyword.ts b/packages/types/tests/schema-tests-3.2/schema-object-deprecated-example-keyword.ts index 7228755..d896dde 100644 --- a/packages/types/tests/schema-tests-3.2/schema-object-deprecated-example-keyword.ts +++ b/packages/types/tests/schema-tests-3.2/schema-object-deprecated-example-keyword.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -25,4 +25,4 @@ export const doc = { ], }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/schema.ts b/packages/types/tests/schema-tests-3.2/schema.ts index e530a89..010c783 100644 --- a/packages/types/tests/schema-tests-3.2/schema.ts +++ b/packages/types/tests/schema-tests-3.2/schema.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -66,4 +66,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/security-scheme-object-examples.ts b/packages/types/tests/schema-tests-3.2/security-scheme-object-examples.ts index a8f2a9d..5e64ecc 100644 --- a/packages/types/tests/schema-tests-3.2/security-scheme-object-examples.ts +++ b/packages/types/tests/schema-tests-3.2/security-scheme-object-examples.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -104,4 +104,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/servers.ts b/packages/types/tests/schema-tests-3.2/servers.ts index 7fb4251..d5941c4 100644 --- a/packages/types/tests/schema-tests-3.2/servers.ts +++ b/packages/types/tests/schema-tests-3.2/servers.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -38,4 +38,4 @@ export const doc = { }, }, ], -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/specification-extensions.ts b/packages/types/tests/schema-tests-3.2/specification-extensions.ts index d2ae897..41b6457 100644 --- a/packages/types/tests/schema-tests-3.2/specification-extensions.ts +++ b/packages/types/tests/schema-tests-3.2/specification-extensions.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { 'openapi': '3.2.0', 'info': { title: 'API', @@ -10,4 +10,4 @@ export const doc = { }, 'paths': {}, 'x-tensions': 'specification extensions are prefixed with `x-`', -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/style-defaults.ts b/packages/types/tests/schema-tests-3.2/style-defaults.ts index 5062963..aedcac5 100644 --- a/packages/types/tests/schema-tests-3.2/style-defaults.ts +++ b/packages/types/tests/schema-tests-3.2/style-defaults.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: @@ -153,4 +153,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/tag-object-example.ts b/packages/types/tests/schema-tests-3.2/tag-object-example.ts index 03b458b..9574819 100644 --- a/packages/types/tests/schema-tests-3.2/tag-object-example.ts +++ b/packages/types/tests/schema-tests-3.2/tag-object-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'API', @@ -34,4 +34,4 @@ export const doc = { }, }, ], -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/valid-schema-types.ts b/packages/types/tests/schema-tests-3.2/valid-schema-types.ts index 88215cf..beb38a6 100644 --- a/packages/types/tests/schema-tests-3.2/valid-schema-types.ts +++ b/packages/types/tests/schema-tests-3.2/valid-schema-types.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.1', info: { title: 'API', @@ -18,4 +18,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} diff --git a/packages/types/tests/schema-tests-3.2/webhook-example.ts b/packages/types/tests/schema-tests-3.2/webhook-example.ts index 20e8398..536aca9 100644 --- a/packages/types/tests/schema-tests-3.2/webhook-example.ts +++ b/packages/types/tests/schema-tests-3.2/webhook-example.ts @@ -2,7 +2,7 @@ // Do not edit by hand; regenerate instead. import type { OpenAPIObject } from '../../src/v3.2' -export const doc = { +export const doc: OpenAPIObject = { openapi: '3.2.0', info: { title: 'Webhook Example', @@ -49,4 +49,4 @@ export const doc = { }, }, }, -} satisfies OpenAPIObject +} From f2dcfb5b83bc5fbe2c7146719257e7768c31e077 Mon Sep 17 00:00:00 2001 From: Dinh Le Date: Sun, 6 Sep 2026 14:53:52 +0700 Subject: [PATCH 2/2] chore: strip trailing spaces from pullfrog workflow --- .github/workflows/pullfrog.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pullfrog.yml b/.github/workflows/pullfrog.yml index b74bcd4..47ccedc 100644 --- a/.github/workflows/pullfrog.yml +++ b/.github/workflows/pullfrog.yml @@ -44,14 +44,14 @@ jobs: OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} AI_GATEWAY_API_KEY: ${{ secrets.AI_GATEWAY_API_KEY }} OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} - + # for Amazon Bedrock (https://docs.pullfrog.com/bedrock) # AWS_BEARER_TOKEN_BEDROCK: ${{ secrets.AWS_BEARER_TOKEN_BEDROCK }} # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # AWS_REGION: us-east-1 # BEDROCK_MODEL_ID: - + # for Google Vertex AI (https://docs.pullfrog.com/vertex) # VERTEX_SERVICE_ACCOUNT_JSON: >- # ${{ secrets.VERTEX_SERVICE_ACCOUNT_JSON }}