Skip to content

Commit aa3bbdd

Browse files
committed
🔧 fix: rename function to convertEnumToOpenApi
1 parent 01c237b commit aa3bbdd

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/openapi.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export const unwrapSchema = (
203203
return schema.toJSONSchema?.() ?? schema?.toJsonSchema?.()
204204
}
205205

206-
const convertEnumToOpenAPI = (schema: any): any => {
206+
const convertEnumToOpenApi = (schema: any): any => {
207207
if (!schema || typeof schema !== 'object') return schema
208208

209209
if (
@@ -227,7 +227,7 @@ const convertEnumToOpenAPI = (schema: any): any => {
227227
if (schema.type === 'object' && schema.properties) {
228228
const convertedProperties: any = {}
229229
for (const [key, value] of Object.entries(schema.properties)) {
230-
convertedProperties[key] = convertEnumToOpenAPI(value)
230+
convertedProperties[key] = convertEnumToOpenApi(value)
231231
}
232232
return {
233233
...schema,
@@ -238,7 +238,7 @@ const convertEnumToOpenAPI = (schema: any): any => {
238238
if (schema.type === 'array' && schema.items) {
239239
return {
240240
...schema,
241-
items: convertEnumToOpenAPI(schema.items)
241+
items: convertEnumToOpenApi(schema.items)
242242
}
243243
}
244244

@@ -390,7 +390,7 @@ export function toOpenAPISchema(
390390
params.properties
391391
)) {
392392
convertedProperties[paramName] =
393-
convertEnumToOpenAPI(paramSchema)
393+
convertEnumToOpenApi(paramSchema)
394394
}
395395

396396
for (const [paramName, paramSchema] of Object.entries(
@@ -418,7 +418,7 @@ export function toOpenAPISchema(
418418
query.properties
419419
)) {
420420
convertedProperties[queryName] =
421-
convertEnumToOpenAPI(querySchema)
421+
convertEnumToOpenApi(querySchema)
422422
}
423423

424424
const required = query.required || []
@@ -447,7 +447,7 @@ export function toOpenAPISchema(
447447
headers.properties
448448
)) {
449449
convertedProperties[headerName] =
450-
convertEnumToOpenAPI(headerSchema)
450+
convertEnumToOpenApi(headerSchema)
451451
}
452452

453453
const required = headers.required || []
@@ -476,7 +476,7 @@ export function toOpenAPISchema(
476476
cookie.properties
477477
)) {
478478
convertedProperties[cookieName] =
479-
convertEnumToOpenAPI(cookieSchema)
479+
convertEnumToOpenApi(cookieSchema)
480480
}
481481

482482
const required = cookie.required || []
@@ -500,7 +500,8 @@ export function toOpenAPISchema(
500500
const body = unwrapSchema(hooks.body, vendors)
501501

502502
if (body) {
503-
const convertedBody = convertEnumToOpenAPI(body)
503+
const convertedBody = convertEnumToOpenApi(body)
504+
504505
// @ts-ignore
505506
const { type: _type, description, $ref, ...options } = convertedBody
506507
const type = _type as string | undefined
@@ -592,7 +593,7 @@ export function toOpenAPISchema(
592593

593594
if (!response) continue
594595

595-
const convertedResponse = convertEnumToOpenAPI(response)
596+
const convertedResponse = convertEnumToOpenApi(response)
596597
// @ts-ignore Must exclude $ref from root options
597598
const { type: _type, description, $ref, ...options } = convertedResponse
598599
const type = _type as string | undefined
@@ -625,7 +626,7 @@ export function toOpenAPISchema(
625626
const response = unwrapSchema(hooks.response as any, vendors)
626627

627628
if (response) {
628-
const convertedResponse = convertEnumToOpenAPI(response)
629+
const convertedResponse = convertEnumToOpenApi(response)
629630

630631
// @ts-ignore
631632
const {

0 commit comments

Comments
 (0)