Skip to content

Commit

Permalink
fix Oas3_1Schema nested types & make it as interface
Browse files Browse the repository at this point in the history
  • Loading branch information
vladkens committed Jan 17, 2024
1 parent 869f2a0 commit bc00b32
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions packages/core/src/typings/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ export interface Oas3Xml {
wrapped?: string;
}

export interface Oas3Schema {
// common fields for OpenAPI Schema v3.x
interface Oas3XSchemaBase<T> {
$ref?: string;
type?: string;
properties?: { [name: string]: Oas3Schema };
additionalProperties?: boolean | Oas3Schema;
properties?: { [name: string]: T };
additionalProperties?: boolean | T;
description?: string;
default?: any;
items?: Oas3Schema;
items?: T;
required?: string[];
readOnly?: boolean;
writeOnly?: boolean;
Expand All @@ -127,10 +127,10 @@ export interface Oas3Schema {
externalDocs?: Oas3ExternalDocs;
discriminator?: Oas3Discriminator;
nullable?: boolean;
oneOf?: Oas3Schema[];
anyOf?: Oas3Schema[];
allOf?: Oas3Schema[];
not?: Oas3Schema;
oneOf?: T[];
anyOf?: T[];
allOf?: T[];
not?: T;

title?: string;
multipleOf?: number;
Expand All @@ -153,11 +153,15 @@ export interface Oas3Schema {
'x-tags'?: string[];
}

export type Oas3_1Schema = Omit<Oas3Schema, "type"> & {
export interface Oas3Schema extends Oas3XSchemaBase<Oas3Schema> {
type?: string;
}

export interface Oas3_1Schema extends Oas3XSchemaBase<Oas3_1Schema> {
type?: string | string[];
examples?: any[];
prefixItems?: Oas3_1Schema[];
};
}

export interface Oas3_1Definition extends Oas3Definition {
webhooks?: Oas3_1Webhooks;
Expand Down

0 comments on commit bc00b32

Please sign in to comment.