Skip to content
Discussion options

You must be logged in to vote

this is type mismatch between typia IJsonSchema and OpenAPI SchemaObject.

typia uses examples as Record<string, any> (OpenAPI 3.0 style) but oRPC expects any[] (OpenAPI 3.1 style).

quick fix - transform the schemas:

const typiaSchemas = json.schemas<[MyType1, MyType2]>();

const convertedSchemas = Object.fromEntries(
  Object.entries(typiaSchemas.components.schemas).map(([key, schema]) => [
    key,
    {
      ...schema,
      examples: schema.examples 
        ? Object.values(schema.examples) 
        : undefined,
    },
  ])
);

new OpenAPIReferencePlugin({
  // ...
  specGenerateOptions: {
    components: {
      schemas: convertedSchemas,
    },
  },
})

or use type assertion if you d…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zdila
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants