-
-
Notifications
You must be signed in to change notification settings - Fork 554
Closed
Description
Orval version: "7.8.0"
OAS:
openapi: 3.0.2
paths:
"/animals":
get:
parameters:
- $ref: '#/components/parameters/AnimalParam'
components:
parameters:
AnimalParam:
name: animal
in: query
schema:
oneOf:
- $ref: "#/components/schemas/Foo"
- type: string
enum:
- mouse
required: false
schemas:
Foo:
type: string
nullable: true
enum:
- cat
- dogGenerated types:
import { Foo } from './foo'
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const AnimalParamParameter = { ...Foo, mouse: 'mouse' } as constIt does not export type for AnimalParamParameter
Workaround:
components:
parameters:
AnimalParam:
name: animal
in: query
schema:
oneOf:
- $ref: "#/components/schemas/Bar"
schemas:
Foo:
nullable: true
type: string
enum:
- cat
- dog
Bar:
nullable: true
oneOf:
- $ref: "#/components/schemas/Foo"
- type: string
enum:
- mouseIt exports the type as needed
import { Foo } from './foo'
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const Bar = { ...Foo, mouse: 'mouse' } as const
export type Bar = (typeof Bar)[keyof typeof Bar]import type { Bar } from './bar'
export type AnimalParamParameter = BarWithout the oneOf workaround on AnimalParams which it should not need, I do not get the type exported
AnimalParam:
name: animal
in: query
schema:
$ref: "#/components/schemas/Bar"Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working