-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I encountered a bug when attempting to generate types for the following JSON schema:
openapi: 3.0.3
info:
title: example
version: 1.0.0
paths:
/example:
get:
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
name:
type: string
value:
type: integer
oneOf:
- properties:
value:
minimum: 0
maximum: 5
- properties:
value:
minimum: 10
maximum: 15
Expected result:
The library detects that there's an overlap between the properties names of $.oneOf
and $.properties
and generates a type that satisfies all specifications:
export interface GetExampleResponse {
name?: string;
value?: number;
}
Actual result:
The library ignores $.properties
when $.oneOf
is present. It also does not detect there's an overlap between the elements of the $.oneOf
array and generates a type union that's redundant.
export type GetExampleResponse = {
value?: any;
} | {
value?: any;
};
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working