-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Description
openapi2aspida seems to incorrectly transform OpenAPI schemas using allOf and oneOf. The issue is with combining common properties (defined with allOf) and selective properties (defined with oneOf) in TypeScript type.
OpenAPI Spec
MyObject:
type: object
allOf:
- type: object
properties:
commonProperty:
type: string
required:
- commonProperty
- type: object
oneOf:
- type: object
properties:
optionA:
type: string
required:
- optionA
- type: object
properties:
optionB:
type: number
required:
- optionBExpected Output
export type MyObject = {
commonProperty: string;
} & (
| {
optionA: string;
}
| {
optionB: number;
}
);Actual Output
export type MyObject = {
commonProperty: string;
} & {
optionA: string;
} | {
optionB: number;
};Environment
- Package version:
v0.23.2 - OS:
macOS - Node.js version:
20.6.1 - npm version:
9.8.1
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels