1- import type { OpenAPIV3 } from 'openapi-types'
1+ import type { OpenAPIV3_1 } from 'openapi-types'
22
33/**
44 * Resolve $ref reference in OpenAPI schema
55 */
66export function resolveRef (
77 ref : string ,
8- document : OpenAPIV3 . Document ,
9- ) : OpenAPIV3 . SchemaObject | null {
8+ document : OpenAPIV3_1 . Document ,
9+ ) : OpenAPIV3_1 . SchemaObject | null {
1010 if ( ! ref . startsWith ( '#/' ) ) {
1111 return null
1212 }
@@ -23,7 +23,7 @@ export function resolveRef(
2323 }
2424
2525 if ( current && typeof current === 'object' && ! ( '$ref' in current ) ) {
26- return current as OpenAPIV3 . SchemaObject
26+ return current as OpenAPIV3_1 . SchemaObject
2727 }
2828
2929 return null
@@ -33,8 +33,8 @@ export function resolveRef(
3333 * Convert OpenAPI schema to TypeScript type representation
3434 */
3535export function getTypeFromSchema (
36- schema : OpenAPIV3 . SchemaObject | OpenAPIV3 . ReferenceObject ,
37- document : OpenAPIV3 . Document ,
36+ schema : OpenAPIV3_1 . SchemaObject | OpenAPIV3_1 . ReferenceObject ,
37+ document : OpenAPIV3_1 . Document ,
3838) : unknown {
3939 // Handle $ref
4040 if ( '$ref' in schema ) {
@@ -45,7 +45,7 @@ export function getTypeFromSchema(
4545 return 'unknown'
4646 }
4747
48- const schemaObj = schema as OpenAPIV3 . SchemaObject
48+ const schemaObj = schema as OpenAPIV3_1 . SchemaObject
4949
5050 // Handle allOf, anyOf, oneOf
5151 if ( schemaObj . allOf ) {
@@ -161,9 +161,9 @@ export function formatTypeValue(value: unknown): string {
161161 * Extract parameters from OpenAPI operation
162162 */
163163export function extractParameters (
164- pathItem : OpenAPIV3 . PathItemObject | undefined ,
165- operation : OpenAPIV3 . OperationObject | undefined ,
166- document : OpenAPIV3 . Document ,
164+ pathItem : OpenAPIV3_1 . PathItemObject | undefined ,
165+ operation : OpenAPIV3_1 . OperationObject | undefined ,
166+ document : OpenAPIV3_1 . Document ,
167167) : {
168168 pathParams : Record < string , unknown >
169169 queryParams : Record < string , unknown >
@@ -223,10 +223,10 @@ export function extractParameters(
223223 */
224224export function extractRequestBody (
225225 requestBody :
226- | OpenAPIV3 . RequestBodyObject
227- | OpenAPIV3 . ReferenceObject
226+ | OpenAPIV3_1 . RequestBodyObject
227+ | OpenAPIV3_1 . ReferenceObject
228228 | undefined ,
229- document : OpenAPIV3 . Document ,
229+ document : OpenAPIV3_1 . Document ,
230230) : unknown {
231231 if ( ! requestBody ) {
232232 return undefined
@@ -235,7 +235,8 @@ export function extractRequestBody(
235235 if ( '$ref' in requestBody ) {
236236 const resolved = resolveRef ( requestBody . $ref , document )
237237 if ( resolved && 'content' in resolved && resolved . content ) {
238- const content = resolved . content as OpenAPIV3 . RequestBodyObject [ 'content' ]
238+ const content =
239+ resolved . content as OpenAPIV3_1 . RequestBodyObject [ 'content' ]
239240 const jsonContent = content [ 'application/json' ]
240241 if ( jsonContent && 'schema' in jsonContent && jsonContent . schema ) {
241242 return getTypeFromSchema ( jsonContent . schema , document )
0 commit comments