Skip to content

Commit 8b6cb3a

Browse files
committed
fix(openapi): readonly for allowedStrategies and components in SchemaConverter types
1 parent 460b50b commit 8b6cb3a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/openapi/src/openapi-generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AnyContractProcedure, AnyContractRouter, AnySchema, ErrorMap, Open
22
import type { StandardOpenAPIJsonSerializerOptions } from '@orpc/openapi-client/standard'
33
import type { AnyProcedure, AnyRouter } from '@orpc/server'
44
import type { JSONSchema } from './schema'
5-
import type { ConditionalSchemaConverter, SchemaConverter, SchemaConvertOptions } from './schema-converter'
5+
import type { ConditionalSchemaConverter, SchemaConverter, SchemaConverterComponent, SchemaConvertOptions } from './schema-converter'
66
import { fallbackORPCErrorMessage, fallbackORPCErrorStatus, isORPCErrorStatus } from '@orpc/client'
77
import { toHttpPath } from '@orpc/client/standard'
88
import { fallbackContractConfig, getEventIteratorSchemaDetails } from '@orpc/contract'
@@ -153,7 +153,7 @@ export class OpenAPIGenerator {
153153
}
154154

155155
async #resolveCommonSchemas(doc: OpenAPI.Document, commonSchemas: OpenAPIGeneratorGenerateOptions['commonSchemas']): Promise<Pick<SchemaConvertOptions, 'components'>> {
156-
const baseOptions: Pick<SchemaConvertOptions, 'components'> = {}
156+
const baseOptions: { components?: SchemaConverterComponent[] } = {}
157157

158158
if (commonSchemas) {
159159
baseOptions.components = []

packages/openapi/src/schema-converter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Promisable } from '@orpc/shared'
33
import type { JSONSchema } from './schema'
44

55
export interface SchemaConverterComponent {
6-
allowedStrategies: SchemaConvertOptions['strategy'][]
6+
allowedStrategies: readonly SchemaConvertOptions['strategy'][]
77
schema: AnySchema
88
required: boolean
99
ref: string
@@ -15,7 +15,7 @@ export interface SchemaConvertOptions {
1515
/**
1616
* Common components should use `$ref` to represent themselves if matched.
1717
*/
18-
components?: SchemaConverterComponent[]
18+
components?: readonly SchemaConverterComponent[]
1919

2020
/**
2121
* Minimum schema structure depth required before using `$ref` for components.

0 commit comments

Comments
 (0)