From 5d3134f47b3649b20f11d42ffdc156097ccca85f Mon Sep 17 00:00:00 2001 From: Nicolas Froidure Date: Thu, 30 May 2024 12:37:00 +0200 Subject: [PATCH] refactor(types): better null type handling Use `null` literal to compose types intersections instead of using `NonNullable` for not nullable fields. It should lead to a lighter type definition. BREAKING CHANGE: Not sure if it really breaks anything but won't hurt to create a major version just in case. fix #33 --- src/__snapshots__/index.test.ts.snap | 1786 +++++++++++++------------- src/index.test.ts | 548 ++++---- src/index.ts | 79 +- 3 files changed, 1195 insertions(+), 1218 deletions(-) diff --git a/src/__snapshots__/index.test.ts.snap b/src/__snapshots__/index.test.ts.snap index ea2f850..e3f7585 100644 --- a/src/__snapshots__/index.test.ts.snap +++ b/src/__snapshots__/index.test.ts.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`generateJSONSchemaTypes() with JSONSchema samples should work with array_of_things.json 1`] = ` -"declare type Main = NonNullable<{ - fruits?: NonNullable[]>; - vegetables?: NonNullable; -}>; +"declare type Main = { + fruits?: string[]; + vegetables?: Definitions.Veggie[]; +}; declare namespace Definitions { - export type Veggie = NonNullable<{ - veggieName: NonNullable; - veggieLike: NonNullable; - }>; + export type Veggie = { + veggieName: string; + veggieLike: boolean; + }; }" `; -exports[`generateJSONSchemaTypes() with JSONSchema samples should work with wierd_schema.json 1`] = `"declare type Main = NonNullable<{}> | null;"`; +exports[`generateJSONSchemaTypes() with JSONSchema samples should work with wierd_schema.json 1`] = `"declare type Main = {} | null;"`; exports[`generateOpenAPITypes() with OpenAPI samples should work with diagrams.json 1`] = ` "declare namespace API { @@ -360,12 +360,12 @@ declare namespace Components { export type SensorId = Components.Schemas.UUID; export type SourceId = Components.Schemas.UUID; export type UserId = Components.Schemas.UUID; - export type ClientId = NonNullable; - export type RedirectURI = NonNullable; - export type Scope = NonNullable; - export type State = NonNullable; - export type XSdkVersion = NonNullable; - export type XApplicationVersion = NonNullable; + export type ClientId = string; + export type RedirectURI = string; + export type Scope = string; + export type State = string; + export type XSdkVersion = string; + export type XApplicationVersion = string; } export namespace Responses { export type getMySelfResponse302 = { @@ -373,28 +373,28 @@ declare namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type postPasswordChangeRequestResponse200 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type putPredictionsDataResponse201 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getOAuth2AuthorizeResponse302 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getAnomalyResponse200 = { readonly status: S; @@ -510,166 +510,166 @@ declare namespace Components { }; } export namespace Schemas { - export type UserModel = NonNullable<{ + export type UserModel = { id?: Components.Schemas.UUID; - roles?: NonNullable; - password?: NonNullable; - organisationsIds?: NonNullable; + roles?: Components.Schemas.Role[]; + password?: string; + organisationsIds?: Components.Schemas.UUID[]; data: Components.Schemas.UserData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; + }; export type TokenRequestBody = Components.Schemas.PasswordRequestBody | Components.Schemas.AuthorizationCodeRequestBody | Components.Schemas.ClientCredentialsRequestBody | Components.Schemas.RefreshTokenRequestBody | Components.Schemas.VerifyTokenRequestBody | Components.Schemas.PasswordChangeBody; - export type RequestBodiespostPasswordChangeRequestRequestBodyBody0 = NonNullable<{ - email: NonNullable; - }>; - export type RequestBodiesputPredictionsDataRequestBodyBody0 = NonNullable<{ + export type RequestBodiespostPasswordChangeRequestRequestBodyBody0 = { + email: string; + }; + export type RequestBodiesputPredictionsDataRequestBodyBody0 = { [pattern: string]: unknown; - }>; - export type RequestBodiesputPredictionsDataRequestBodyBody1 = NonNullable; - export type UUID = NonNullable; - export type AnomalyItem = NonNullable<{ + }; + export type RequestBodiesputPredictionsDataRequestBodyBody1 = string; + export type UUID = string; + export type AnomalyItem = { item: Components.Schemas.UUID; anomalies: Components.Schemas.AnomalyModelHash; - }>; - export type FactoryItem = NonNullable<{ + }; + export type FactoryItem = { item: Components.Schemas.UUID; factories: Components.Schemas.FactoryModelHash; - }>; - export type LineItem = NonNullable<{ + }; + export type LineItem = { item: Components.Schemas.UUID; lines: Components.Schemas.LineModelHash; - }>; - export type MachineItem = NonNullable<{ + }; + export type MachineItem = { item: Components.Schemas.UUID; machines: Components.Schemas.MachineModelHash; - }>; - export type ResponsesgetOpenAPIResponse200Body0 = NonNullable<{}>; - export type OrganisationItem = NonNullable<{ + }; + export type ResponsesgetOpenAPIResponse200Body0 = {}; + export type OrganisationItem = { item: Components.Schemas.UUID; organisations: Components.Schemas.OrganisationModelHash; - }>; - export type ResponsesgetPredictionDatasetResponse200Body0 = NonNullable; - export type SensorItem = NonNullable<{ + }; + export type ResponsesgetPredictionDatasetResponse200Body0 = string; + export type SensorItem = { item: Components.Schemas.UUID; sensors: Components.Schemas.SensorModelHash; - }>; - export type SourceItem = NonNullable<{ + }; + export type SourceItem = { item: Components.Schemas.UUID; sources: Components.Schemas.SourceModelHash; - }>; - export type ResponsesgetTrainingDatasetResponse200Body0 = NonNullable; - export type UserItem = NonNullable<{ + }; + export type ResponsesgetTrainingDatasetResponse200Body0 = string; + export type UserItem = { item: Components.Schemas.UUID; users: Components.Schemas.UserModelHash; - }>; - export type ResponsespostOAuth2TokenResponse200Body0 = NonNullable<{ - access_token: NonNullable; + }; + export type ResponsespostOAuth2TokenResponse200Body0 = { + access_token: string; token_type: Enums.TokenType; - expires_in?: NonNullable; - refresh_token?: NonNullable; - }>; - export type ResponsespostOAuth2TokenResponse400Body0 = NonNullable<{ + expires_in?: number; + refresh_token?: string; + }; + export type ResponsespostOAuth2TokenResponse400Body0 = { error: Enums.Error; - error_description?: NonNullable; - error_uri?: NonNullable; - }>; - export type ResponsesgetPingResponse200Body0 = NonNullable<{ + error_description?: string; + error_uri?: string; + }; + export type ResponsesgetPingResponse200Body0 = { pong?: "pong"; - }>; + }; export type Role = Enums.Role; - export type UserData = NonNullable<{ - email: NonNullable; - name: NonNullable; - givenName?: NonNullable; - familyName?: NonNullable; - phone?: NonNullable; - birthDay?: NonNullable; + export type UserData = { + email: string; + name: string; + givenName?: string; + familyName?: string; + phone?: string; + birthDay?: string; locale: Components.Schemas.Locale; timeZone: Components.Schemas.TimeZone; - }>; - export type Date = NonNullable; - export type PasswordRequestBody = NonNullable<{ + }; + export type Date = string; + export type PasswordRequestBody = { grant_type: "password"; - username: NonNullable; - password: NonNullable; - scope?: NonNullable; - }>; - export type AuthorizationCodeRequestBody = NonNullable<{ + username: string; + password: string; + scope?: string; + }; + export type AuthorizationCodeRequestBody = { grant_type: "authorization_code"; - code?: NonNullable; - client_id?: NonNullable; - redirect_uri?: NonNullable; - }>; - export type ClientCredentialsRequestBody = NonNullable<{ + code?: string; + client_id?: string; + redirect_uri?: string; + }; + export type ClientCredentialsRequestBody = { grant_type: "client_credentials"; - scope?: NonNullable; - }>; - export type RefreshTokenRequestBody = NonNullable<{ + scope?: string; + }; + export type RefreshTokenRequestBody = { grant_type: "refresh_token"; - refresh_token: NonNullable; - scope?: NonNullable; - }>; - export type VerifyTokenRequestBody = NonNullable<{ + refresh_token: string; + scope?: string; + }; + export type VerifyTokenRequestBody = { grant_type: "verify_token"; - verify_token: NonNullable; - }>; - export type PasswordChangeBody = NonNullable<{ + verify_token: string; + }; + export type PasswordChangeBody = { grant_type: "password_change"; - token: NonNullable; - new_password: NonNullable; - }>; - export type AnomalyModelHash = NonNullable<{ + token: string; + new_password: string; + }; + export type AnomalyModelHash = { [pattern: string]: Components.Schemas.AnomalyModel; - }>; - export type FactoryModelHash = NonNullable<{ + }; + export type FactoryModelHash = { [pattern: string]: Components.Schemas.FactoryModel; - }>; - export type LineModelHash = NonNullable<{ + }; + export type LineModelHash = { [pattern: string]: Components.Schemas.LineModel; - }>; - export type MachineModelHash = NonNullable<{ + }; + export type MachineModelHash = { [pattern: string]: Components.Schemas.MachineModel; - }>; - export type OrganisationModelHash = NonNullable<{ + }; + export type OrganisationModelHash = { [pattern: string]: Components.Schemas.OrganisationModel; - }>; - export type SensorModelHash = NonNullable<{ + }; + export type SensorModelHash = { [pattern: string]: Components.Schemas.SensorModel; - }>; - export type SourceModelHash = NonNullable<{ + }; + export type SourceModelHash = { [pattern: string]: Components.Schemas.SourceModel; - }>; - export type UserModelHash = NonNullable<{ + }; + export type UserModelHash = { [pattern: string]: Components.Schemas.UserModel; - }>; - export type Locale = NonNullable; - export type TimeZone = NonNullable; - export type AnomalyModel = NonNullable<{ + }; + export type Locale = string; + export type TimeZone = string; + export type AnomalyModel = { id?: Components.Schemas.UUID; organisationId?: Components.Schemas.UUID; - linesIds?: NonNullable; - machinesIds?: NonNullable; - sensorsIds?: NonNullable; + linesIds?: Components.Schemas.UUID[]; + machinesIds?: Components.Schemas.UUID[]; + sensorsIds?: Components.Schemas.UUID[]; data: Components.Schemas.AnomalyData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; archivedAt?: Components.Schemas.Date; - }>; - export type FactoryModel = NonNullable<{ + }; + export type FactoryModel = { id?: Components.Schemas.UUID; organisationId?: Components.Schemas.UUID; data: Components.Schemas.FactoryData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type LineModel = NonNullable<{ + }; + export type LineModel = { id?: Components.Schemas.UUID; data: Components.Schemas.LineData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type MachineModel = NonNullable<{ + }; + export type MachineModel = { id?: Components.Schemas.UUID; data: Components.Schemas.MachineData; powerState: Enums.PowerState; @@ -677,74 +677,74 @@ declare namespace Components { healthState: Enums.HealthState; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type OrganisationModel = NonNullable<{ + }; + export type OrganisationModel = { id?: Components.Schemas.UUID; - factoriesIds?: NonNullable; + factoriesIds?: Components.Schemas.UUID[]; data: Components.Schemas.OrganisationData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type SensorModel = NonNullable<{ + }; + export type SensorModel = { id?: Components.Schemas.UUID; data: Components.Schemas.SensorData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type SourceModel = NonNullable<{ + }; + export type SourceModel = { id?: Components.Schemas.UUID; data: Components.Schemas.SourceData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type AnomalyData = NonNullable<{ + }; + export type AnomalyData = { assignedUser?: Components.Schemas.UUID; status: Enums.Status; - archived: NonNullable; + archived: boolean; priority: Enums.Priority; severity: Enums.Severity; - }>; - export type FactoryData = NonNullable<{ - externalId?: NonNullable; - name: NonNullable; - }>; - export type LineData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; + }; + export type FactoryData = { + externalId?: string; + name: string; + }; + export type LineData = { + name: string; + externalId?: string; factoryId: Components.Schemas.UUID; - machinesIds?: NonNullable; - machinesTree?: NonNullable<{}>; + machinesIds?: Components.Schemas.UUID[]; + machinesTree?: {}; machineId: unknown; settings: unknown; - }>; - export type MachineData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; + }; + export type MachineData = { + name: string; + externalId?: string; factoryId: Components.Schemas.UUID; - }>; - export type OrganisationData = NonNullable<{ - name: NonNullable; + }; + export type OrganisationData = { + name: string; locale: Components.Schemas.Locale; timeZone: Components.Schemas.TimeZone; - }>; - export type SensorData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; + }; + export type SensorData = { + name: string; + externalId?: string; factoryId: Components.Schemas.UUID; machineId: Components.Schemas.UUID; - settings: NonNullable<{ + settings: { type?: "opc-ua"; - uri?: NonNullable; - }>; - }>; - export type SourceData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; - settings: NonNullable<{ + uri?: string; + }; + }; + export type SourceData = { + name: string; + externalId?: string; + settings: { type?: "opc-ua"; - uri?: NonNullable; - }>; - }>; + uri?: string; + }; + }; } } declare namespace Enums { @@ -1149,12 +1149,12 @@ declare namespace Components { export type SensorId = Components.Schemas.UUID; export type SourceId = Components.Schemas.UUID; export type UserId = Components.Schemas.UUID; - export type ClientId = NonNullable; - export type RedirectURI = NonNullable; - export type Scope = NonNullable; - export type State = NonNullable; - export type XSdkVersion = NonNullable; - export type XApplicationVersion = NonNullable; + export type ClientId = string; + export type RedirectURI = string; + export type Scope = string; + export type State = string; + export type XSdkVersion = string; + export type XApplicationVersion = string; } export namespace Responses { export type postPasswordChangeRequestResponse200 = { @@ -1162,14 +1162,14 @@ declare namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type putPredictionsDataResponse201 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getAnomalyResponse200 = { readonly status: S; @@ -1278,171 +1278,171 @@ declare namespace Components { }; } export namespace Schemas { - export type UserModel = NonNullable<{ + export type UserModel = { id?: Components.Schemas.UUID; - roles?: NonNullable; - password?: NonNullable; - organisationsIds?: NonNullable; + roles?: Components.Schemas.Role[]; + password?: string; + organisationsIds?: Components.Schemas.UUID[]; data: Components.Schemas.UserData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; + }; export type TokenRequestBody = Components.Schemas.PasswordRequestBody | Components.Schemas.AuthorizationCodeRequestBody | Components.Schemas.ClientCredentialsRequestBody | Components.Schemas.RefreshTokenRequestBody | Components.Schemas.VerifyTokenRequestBody | Components.Schemas.PasswordChangeBody; - export type RequestBodiespostPasswordChangeRequestRequestBodyBody0 = NonNullable<{ - email: NonNullable; - }>; - export type RequestBodiesputPredictionsDataRequestBodyBody0 = NonNullable<{ + export type RequestBodiespostPasswordChangeRequestRequestBodyBody0 = { + email: string; + }; + export type RequestBodiesputPredictionsDataRequestBodyBody0 = { [pattern: string]: unknown; - }>; - export type RequestBodiesputPredictionsDataRequestBodyBody1 = NonNullable; - export type UUID = NonNullable & NonNullable<{ + }; + export type RequestBodiesputPredictionsDataRequestBodyBody1 = string; + export type UUID = string & { _type?: "UUID"; - }>; - export type AnomalyItem = NonNullable<{ + }; + export type AnomalyItem = { item: Components.Schemas.UUID; anomalies: Components.Schemas.AnomalyModelHash; - }>; - export type FactoryItem = NonNullable<{ + }; + export type FactoryItem = { item: Components.Schemas.UUID; factories: Components.Schemas.FactoryModelHash; - }>; - export type LineItem = NonNullable<{ + }; + export type LineItem = { item: Components.Schemas.UUID; lines: Components.Schemas.LineModelHash; - }>; - export type MachineItem = NonNullable<{ + }; + export type MachineItem = { item: Components.Schemas.UUID; machines: Components.Schemas.MachineModelHash; - }>; - export type ResponsesgetOpenAPIResponse200Body0 = NonNullable<{}>; - export type OrganisationItem = NonNullable<{ + }; + export type ResponsesgetOpenAPIResponse200Body0 = {}; + export type OrganisationItem = { item: Components.Schemas.UUID; organisations: Components.Schemas.OrganisationModelHash; - }>; - export type ResponsesgetPredictionDatasetResponse200Body0 = NonNullable; - export type SensorItem = NonNullable<{ + }; + export type ResponsesgetPredictionDatasetResponse200Body0 = string; + export type SensorItem = { item: Components.Schemas.UUID; sensors: Components.Schemas.SensorModelHash; - }>; - export type SourceItem = NonNullable<{ + }; + export type SourceItem = { item: Components.Schemas.UUID; sources: Components.Schemas.SourceModelHash; - }>; - export type ResponsesgetTrainingDatasetResponse200Body0 = NonNullable; - export type UserItem = NonNullable<{ + }; + export type ResponsesgetTrainingDatasetResponse200Body0 = string; + export type UserItem = { item: Components.Schemas.UUID; users: Components.Schemas.UserModelHash; - }>; - export type ResponsespostOAuth2TokenResponse200Body0 = NonNullable<{ - access_token: NonNullable; + }; + export type ResponsespostOAuth2TokenResponse200Body0 = { + access_token: string; token_type: "bearer" | "mac" | "\\uD83D\\uDC95-\\u2705"; - expires_in?: NonNullable; - refresh_token?: NonNullable; - }>; - export type ResponsesgetPingResponse200Body0 = NonNullable<{ + expires_in?: number; + refresh_token?: string; + }; + export type ResponsesgetPingResponse200Body0 = { pong?: "pong"; - }>; - export type Role = ("admin" | "user" | "candidate") & NonNullable<{ + }; + export type Role = ("admin" | "user" | "candidate") & { _type?: "Role"; - }>; - export type UserData = NonNullable<{ - email: NonNullable; - name: NonNullable; - givenName?: NonNullable; - familyName?: NonNullable; - phone?: NonNullable; - birthDay?: NonNullable; + }; + export type UserData = { + email: string; + name: string; + givenName?: string; + familyName?: string; + phone?: string; + birthDay?: string; locale: Components.Schemas.Locale; timeZone: Components.Schemas.TimeZone; - }>; - export type Date = NonNullable & NonNullable<{ + }; + export type Date = string & { _type?: "Date"; - }>; - export type PasswordRequestBody = NonNullable<{ + }; + export type PasswordRequestBody = { grant_type: "password"; - username: NonNullable; - password: NonNullable; - scope?: NonNullable; - }>; - export type AuthorizationCodeRequestBody = NonNullable<{ + username: string; + password: string; + scope?: string; + }; + export type AuthorizationCodeRequestBody = { grant_type: "authorization_code"; - code?: NonNullable; - client_id?: NonNullable; - redirect_uri?: NonNullable; - }>; - export type ClientCredentialsRequestBody = NonNullable<{ + code?: string; + client_id?: string; + redirect_uri?: string; + }; + export type ClientCredentialsRequestBody = { grant_type: "client_credentials"; - scope?: NonNullable; - }>; - export type RefreshTokenRequestBody = NonNullable<{ + scope?: string; + }; + export type RefreshTokenRequestBody = { grant_type: "refresh_token"; - refresh_token: NonNullable; - scope?: NonNullable; - }>; - export type VerifyTokenRequestBody = NonNullable<{ + refresh_token: string; + scope?: string; + }; + export type VerifyTokenRequestBody = { grant_type: "verify_token"; - verify_token: NonNullable; - }>; - export type PasswordChangeBody = NonNullable<{ + verify_token: string; + }; + export type PasswordChangeBody = { grant_type: "password_change"; - token: NonNullable; - new_password: NonNullable; - }>; - export type AnomalyModelHash = NonNullable<{ + token: string; + new_password: string; + }; + export type AnomalyModelHash = { [pattern: string]: Components.Schemas.AnomalyModel; - }>; - export type FactoryModelHash = NonNullable<{ + }; + export type FactoryModelHash = { [pattern: string]: Components.Schemas.FactoryModel; - }>; - export type LineModelHash = NonNullable<{ + }; + export type LineModelHash = { [pattern: string]: Components.Schemas.LineModel; - }>; - export type MachineModelHash = NonNullable<{ + }; + export type MachineModelHash = { [pattern: string]: Components.Schemas.MachineModel; - }>; - export type OrganisationModelHash = NonNullable<{ + }; + export type OrganisationModelHash = { [pattern: string]: Components.Schemas.OrganisationModel; - }>; - export type SensorModelHash = NonNullable<{ + }; + export type SensorModelHash = { [pattern: string]: Components.Schemas.SensorModel; - }>; - export type SourceModelHash = NonNullable<{ + }; + export type SourceModelHash = { [pattern: string]: Components.Schemas.SourceModel; - }>; - export type UserModelHash = NonNullable<{ + }; + export type UserModelHash = { [pattern: string]: Components.Schemas.UserModel; - }>; - export type Locale = NonNullable & NonNullable<{ + }; + export type Locale = string & { _type?: "Locale"; - }>; - export type TimeZone = NonNullable & NonNullable<{ + }; + export type TimeZone = string & { _type?: "TimeZone"; - }>; - export type AnomalyModel = NonNullable<{ + }; + export type AnomalyModel = { id?: Components.Schemas.UUID; organisationId?: Components.Schemas.UUID; - linesIds?: NonNullable; - machinesIds?: NonNullable; - sensorsIds?: NonNullable; + linesIds?: Components.Schemas.UUID[]; + machinesIds?: Components.Schemas.UUID[]; + sensorsIds?: Components.Schemas.UUID[]; data: Components.Schemas.AnomalyData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; archivedAt?: Components.Schemas.Date; - }>; - export type FactoryModel = NonNullable<{ + }; + export type FactoryModel = { id?: Components.Schemas.UUID; organisationId?: Components.Schemas.UUID; data: Components.Schemas.FactoryData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type LineModel = NonNullable<{ + }; + export type LineModel = { id?: Components.Schemas.UUID; data: Components.Schemas.LineData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type MachineModel = NonNullable<{ + }; + export type MachineModel = { id?: Components.Schemas.UUID; data: Components.Schemas.MachineData; powerState: "unknown" | "on" | "off"; @@ -1450,74 +1450,74 @@ declare namespace Components { healthState: "unknown" | "good" | "faulty" | "erroring"; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type OrganisationModel = NonNullable<{ + }; + export type OrganisationModel = { id?: Components.Schemas.UUID; - factoriesIds?: NonNullable; + factoriesIds?: Components.Schemas.UUID[]; data: Components.Schemas.OrganisationData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type SensorModel = NonNullable<{ + }; + export type SensorModel = { id?: Components.Schemas.UUID; data: Components.Schemas.SensorData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type SourceModel = NonNullable<{ + }; + export type SourceModel = { id?: Components.Schemas.UUID; data: Components.Schemas.SourceData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type AnomalyData = NonNullable<{ + }; + export type AnomalyData = { assignedUser?: Components.Schemas.UUID; status: "open" | "discarded" | "assigned" | "fixed" | "closed"; - archived: NonNullable; + archived: boolean; priority: "not_set" | "urgent" | "important" | "secondary"; severity: "not_set" | "critical" | "major" | "moderate" | "minor" | "cosmetic"; - }>; - export type FactoryData = NonNullable<{ - externalId?: NonNullable; - name: NonNullable; - }>; - export type LineData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; + }; + export type FactoryData = { + externalId?: string; + name: string; + }; + export type LineData = { + name: string; + externalId?: string; factoryId: Components.Schemas.UUID; - machinesIds?: NonNullable; - machinesTree?: NonNullable<{}>; + machinesIds?: Components.Schemas.UUID[]; + machinesTree?: {}; machineId: unknown; settings: unknown; - }>; - export type MachineData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; + }; + export type MachineData = { + name: string; + externalId?: string; factoryId: Components.Schemas.UUID; - }>; - export type OrganisationData = NonNullable<{ - name: NonNullable; + }; + export type OrganisationData = { + name: string; locale: Components.Schemas.Locale; timeZone: Components.Schemas.TimeZone; - }>; - export type SensorData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; + }; + export type SensorData = { + name: string; + externalId?: string; factoryId: Components.Schemas.UUID; machineId: Components.Schemas.UUID; - settings: NonNullable<{ + settings: { type?: "opc-ua"; - uri?: NonNullable; - }>; - }>; - export type SourceData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; - settings: NonNullable<{ + uri?: string; + }; + }; + export type SourceData = { + name: string; + externalId?: string; + settings: { type?: "opc-ua"; - uri?: NonNullable; - }>; - }>; + uri?: string; + }; + }; } }" `; @@ -1867,12 +1867,12 @@ export namespace Components { export type SensorId = Components.Schemas.UUID; export type SourceId = Components.Schemas.UUID; export type UserId = Components.Schemas.UUID; - export type ClientId = NonNullable; - export type RedirectURI = NonNullable; - export type Scope = NonNullable; - export type State = NonNullable; - export type XSdkVersion = NonNullable; - export type XApplicationVersion = NonNullable; + export type ClientId = string; + export type RedirectURI = string; + export type Scope = string; + export type State = string; + export type XSdkVersion = string; + export type XApplicationVersion = string; } export namespace Responses { export type getMySelfResponse302 = { @@ -1880,28 +1880,28 @@ export namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type postPasswordChangeRequestResponse200 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type putPredictionsDataResponse201 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getOAuth2AuthorizeResponse302 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getAnomalyResponse200 = { readonly status: S; @@ -2017,89 +2017,89 @@ export namespace Components { }; } export namespace Schemas { - export type AnomalyData = NonNullable<{ + export type AnomalyData = { assignedUser?: Components.Schemas.UUID; status: Enums.Status; - archived: NonNullable; + archived: boolean; priority: Enums.Priority; severity: Enums.Severity; - }>; - export type AnomalyModel = NonNullable<{ + }; + export type AnomalyModel = { id?: Components.Schemas.UUID; organisationId?: Components.Schemas.UUID; - linesIds?: NonNullable; - machinesIds?: NonNullable; - sensorsIds?: NonNullable; + linesIds?: Components.Schemas.UUID[]; + machinesIds?: Components.Schemas.UUID[]; + sensorsIds?: Components.Schemas.UUID[]; data: Components.Schemas.AnomalyData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; archivedAt?: Components.Schemas.Date; - }>; - export type AnomalyModelHash = NonNullable<{ + }; + export type AnomalyModelHash = { [pattern: string]: Components.Schemas.AnomalyModel; - }>; - export type AnomalyItem = NonNullable<{ + }; + export type AnomalyItem = { item: Components.Schemas.UUID; anomalies: Components.Schemas.AnomalyModelHash; - }>; - export type AnomaliesItems = NonNullable<{ - items: NonNullable; + }; + export type AnomaliesItems = { + items: Components.Schemas.UUID[]; anomalies: Components.Schemas.AnomalyModelHash; - }>; - export type FactoryData = NonNullable<{ - externalId?: NonNullable; - name: NonNullable; - }>; - export type FactoryModel = NonNullable<{ + }; + export type FactoryData = { + externalId?: string; + name: string; + }; + export type FactoryModel = { id?: Components.Schemas.UUID; organisationId?: Components.Schemas.UUID; data: Components.Schemas.FactoryData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type FactoryModelHash = NonNullable<{ + }; + export type FactoryModelHash = { [pattern: string]: Components.Schemas.FactoryModel; - }>; - export type FactoryItem = NonNullable<{ + }; + export type FactoryItem = { item: Components.Schemas.UUID; factories: Components.Schemas.FactoryModelHash; - }>; - export type FactoriesItems = NonNullable<{ - items: NonNullable; + }; + export type FactoriesItems = { + items: Components.Schemas.UUID[]; factories: Components.Schemas.FactoryModelHash; - }>; - export type LineData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; + }; + export type LineData = { + name: string; + externalId?: string; factoryId: Components.Schemas.UUID; - machinesIds?: NonNullable; - machinesTree?: NonNullable<{}>; + machinesIds?: Components.Schemas.UUID[]; + machinesTree?: {}; machineId: unknown; settings: unknown; - }>; - export type LineModel = NonNullable<{ + }; + export type LineModel = { id?: Components.Schemas.UUID; data: Components.Schemas.LineData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type LineModelHash = NonNullable<{ + }; + export type LineModelHash = { [pattern: string]: Components.Schemas.LineModel; - }>; - export type LineItem = NonNullable<{ + }; + export type LineItem = { item: Components.Schemas.UUID; lines: Components.Schemas.LineModelHash; - }>; - export type LinesItems = NonNullable<{ - items: NonNullable; + }; + export type LinesItems = { + items: Components.Schemas.UUID[]; lines: Components.Schemas.LineModelHash; - }>; - export type MachineData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; + }; + export type MachineData = { + name: string; + externalId?: string; factoryId: Components.Schemas.UUID; - }>; - export type MachineModel = NonNullable<{ + }; + export type MachineModel = { id?: Components.Schemas.UUID; data: Components.Schemas.MachineData; powerState: Enums.PowerState; @@ -2107,187 +2107,187 @@ export namespace Components { healthState: Enums.HealthState; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type MachineModelHash = NonNullable<{ + }; + export type MachineModelHash = { [pattern: string]: Components.Schemas.MachineModel; - }>; - export type MachineItem = NonNullable<{ + }; + export type MachineItem = { item: Components.Schemas.UUID; machines: Components.Schemas.MachineModelHash; - }>; - export type MachinesItems = NonNullable<{ - items: NonNullable; + }; + export type MachinesItems = { + items: Components.Schemas.UUID[]; machines: Components.Schemas.MachineModelHash; - }>; - export type OrganisationData = NonNullable<{ - name: NonNullable; + }; + export type OrganisationData = { + name: string; locale: Components.Schemas.Locale; timeZone: Components.Schemas.TimeZone; - }>; - export type OrganisationModel = NonNullable<{ + }; + export type OrganisationModel = { id?: Components.Schemas.UUID; - factoriesIds?: NonNullable; + factoriesIds?: Components.Schemas.UUID[]; data: Components.Schemas.OrganisationData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type OrganisationModelHash = NonNullable<{ + }; + export type OrganisationModelHash = { [pattern: string]: Components.Schemas.OrganisationModel; - }>; - export type OrganisationItem = NonNullable<{ + }; + export type OrganisationItem = { item: Components.Schemas.UUID; organisations: Components.Schemas.OrganisationModelHash; - }>; - export type OrganisationsItems = NonNullable<{ - items: NonNullable; + }; + export type OrganisationsItems = { + items: Components.Schemas.UUID[]; organisations: Components.Schemas.OrganisationModelHash; - }>; - export type SensorData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; + }; + export type SensorData = { + name: string; + externalId?: string; factoryId: Components.Schemas.UUID; machineId: Components.Schemas.UUID; - settings: NonNullable<{ + settings: { type?: "opc-ua"; - uri?: NonNullable; - }>; - }>; - export type SensorModel = NonNullable<{ + uri?: string; + }; + }; + export type SensorModel = { id?: Components.Schemas.UUID; data: Components.Schemas.SensorData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type SensorModelHash = NonNullable<{ + }; + export type SensorModelHash = { [pattern: string]: Components.Schemas.SensorModel; - }>; - export type SensorItem = NonNullable<{ + }; + export type SensorItem = { item: Components.Schemas.UUID; sensors: Components.Schemas.SensorModelHash; - }>; - export type SensorsItems = NonNullable<{ - items: NonNullable; + }; + export type SensorsItems = { + items: Components.Schemas.UUID[]; sensors: Components.Schemas.SensorModelHash; - }>; - export type SourceData = NonNullable<{ - name: NonNullable; - externalId?: NonNullable; - settings: NonNullable<{ + }; + export type SourceData = { + name: string; + externalId?: string; + settings: { type?: "opc-ua"; - uri?: NonNullable; - }>; - }>; - export type SourceModel = NonNullable<{ + uri?: string; + }; + }; + export type SourceModel = { id?: Components.Schemas.UUID; data: Components.Schemas.SourceData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type SourceModelHash = NonNullable<{ + }; + export type SourceModelHash = { [pattern: string]: Components.Schemas.SourceModel; - }>; - export type SourceItem = NonNullable<{ + }; + export type SourceItem = { item: Components.Schemas.UUID; sources: Components.Schemas.SourceModelHash; - }>; - export type SourcesItems = NonNullable<{ - items: NonNullable; + }; + export type SourcesItems = { + items: Components.Schemas.UUID[]; sources: Components.Schemas.SourceModelHash; - }>; - export type Locale = NonNullable; - export type TimeZone = NonNullable; - export type UUID = NonNullable; - export type Date = NonNullable; + }; + export type Locale = string; + export type TimeZone = string; + export type UUID = string; + export type Date = string; export type Role = Enums.Role; - export type UserData = NonNullable<{ - email: NonNullable; - name: NonNullable; - givenName?: NonNullable; - familyName?: NonNullable; - phone?: NonNullable; - birthDay?: NonNullable; + export type UserData = { + email: string; + name: string; + givenName?: string; + familyName?: string; + phone?: string; + birthDay?: string; locale: Components.Schemas.Locale; timeZone: Components.Schemas.TimeZone; - }>; - export type UserModel = NonNullable<{ + }; + export type UserModel = { id?: Components.Schemas.UUID; - roles?: NonNullable; - password?: NonNullable; - organisationsIds?: NonNullable; + roles?: Components.Schemas.Role[]; + password?: string; + organisationsIds?: Components.Schemas.UUID[]; data: Components.Schemas.UserData; creation?: Components.Schemas.Date; lastModification?: Components.Schemas.Date; - }>; - export type UserModelHash = NonNullable<{ + }; + export type UserModelHash = { [pattern: string]: Components.Schemas.UserModel; - }>; - export type UserItem = NonNullable<{ + }; + export type UserItem = { item: Components.Schemas.UUID; users: Components.Schemas.UserModelHash; - }>; - export type UsersItems = NonNullable<{ - items: NonNullable; + }; + export type UsersItems = { + items: Components.Schemas.UUID[]; users: Components.Schemas.UserModelHash; - }>; - export type AuthorizationCodeRequestBody = NonNullable<{ + }; + export type AuthorizationCodeRequestBody = { grant_type: "authorization_code"; - code?: NonNullable; - client_id?: NonNullable; - redirect_uri?: NonNullable; - }>; - export type PasswordRequestBody = NonNullable<{ + code?: string; + client_id?: string; + redirect_uri?: string; + }; + export type PasswordRequestBody = { grant_type: "password"; - username: NonNullable; - password: NonNullable; - scope?: NonNullable; - }>; - export type ClientCredentialsRequestBody = NonNullable<{ + username: string; + password: string; + scope?: string; + }; + export type ClientCredentialsRequestBody = { grant_type: "client_credentials"; - scope?: NonNullable; - }>; - export type RefreshTokenRequestBody = NonNullable<{ + scope?: string; + }; + export type RefreshTokenRequestBody = { grant_type: "refresh_token"; - refresh_token: NonNullable; - scope?: NonNullable; - }>; - export type VerifyTokenRequestBody = NonNullable<{ + refresh_token: string; + scope?: string; + }; + export type VerifyTokenRequestBody = { grant_type: "verify_token"; - verify_token: NonNullable; - }>; - export type PasswordChangeBody = NonNullable<{ + verify_token: string; + }; + export type PasswordChangeBody = { grant_type: "password_change"; - token: NonNullable; - new_password: NonNullable; - }>; + token: string; + new_password: string; + }; export type TokenRequestBody = Components.Schemas.PasswordRequestBody | Components.Schemas.AuthorizationCodeRequestBody | Components.Schemas.ClientCredentialsRequestBody | Components.Schemas.RefreshTokenRequestBody | Components.Schemas.VerifyTokenRequestBody | Components.Schemas.PasswordChangeBody; - export type UnusedSchema = NonNullable<{ - foo: NonNullable; - bar?: NonNullable; - }>; - export type RequestBodiespostPasswordChangeRequestRequestBodyBody0 = NonNullable<{ - email: NonNullable; - }>; - export type RequestBodiesputPredictionsDataRequestBodyBody0 = NonNullable<{ + export type UnusedSchema = { + foo: string; + bar?: string; + }; + export type RequestBodiespostPasswordChangeRequestRequestBodyBody0 = { + email: string; + }; + export type RequestBodiesputPredictionsDataRequestBodyBody0 = { [pattern: string]: unknown; - }>; - export type RequestBodiesputPredictionsDataRequestBodyBody1 = NonNullable; - export type ResponsesgetOpenAPIResponse200Body0 = NonNullable<{}>; - export type ResponsesgetPredictionDatasetResponse200Body0 = NonNullable; - export type ResponsesgetTrainingDatasetResponse200Body0 = NonNullable; - export type ResponsespostOAuth2TokenResponse200Body0 = NonNullable<{ - access_token: NonNullable; + }; + export type RequestBodiesputPredictionsDataRequestBodyBody1 = string; + export type ResponsesgetOpenAPIResponse200Body0 = {}; + export type ResponsesgetPredictionDatasetResponse200Body0 = string; + export type ResponsesgetTrainingDatasetResponse200Body0 = string; + export type ResponsespostOAuth2TokenResponse200Body0 = { + access_token: string; token_type: Enums.TokenType; - expires_in?: NonNullable; - refresh_token?: NonNullable; - }>; - export type ResponsespostOAuth2TokenResponse400Body0 = NonNullable<{ + expires_in?: number; + refresh_token?: string; + }; + export type ResponsespostOAuth2TokenResponse400Body0 = { error: Enums.Error; - error_description?: NonNullable; - error_uri?: NonNullable; - }>; - export type ResponsesgetPingResponse200Body0 = NonNullable<{ + error_description?: string; + error_uri?: string; + }; + export type ResponsesgetPingResponse200Body0 = { pong?: "pong"; - }>; + }; } } export namespace Enums { @@ -2611,20 +2611,20 @@ declare namespace Components { export type UpdateUserRequestBody = Components.Schemas.User; } export namespace Parameters { - export type GetPetById0 = NonNullable; - export type UpdatePetWithForm0 = NonNullable; - export type DeletePet0 = NonNullable; - export type DeletePet1 = NonNullable; - export type UploadFile0 = NonNullable; - export type GetOrderById0 = NonNullable; - export type DeleteOrder0 = NonNullable; - export type LoginUser0 = NonNullable; - export type LoginUser1 = NonNullable; - export type GetUserByName0 = NonNullable; - export type UpdateUser0 = NonNullable; - export type DeleteUser0 = NonNullable; - export type FindPetsByStatus0 = NonNullable<("available" | "pending" | "sold")[]>; - export type FindPetsByTags0 = NonNullable[]>; + export type GetPetById0 = number; + export type UpdatePetWithForm0 = number; + export type DeletePet0 = string; + export type DeletePet1 = number; + export type UploadFile0 = number; + export type GetOrderById0 = number; + export type DeleteOrder0 = string; + export type LoginUser0 = string; + export type LoginUser1 = string; + export type GetUserByName0 = string; + export type UpdateUser0 = string; + export type DeleteUser0 = string; + export type FindPetsByStatus0 = ("available" | "pending" | "sold")[]; + export type FindPetsByTags0 = string[]; } export namespace Responses { export type updatePetResponse400 = { @@ -2632,182 +2632,182 @@ declare namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updatePetResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updatePetResponse405 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type addPetResponse405 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type findPetsByStatusResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type findPetsByTagsResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getPetByIdResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getPetByIdResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updatePetWithFormResponse405 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deletePetResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type placeOrderResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getOrderByIdResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getOrderByIdResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deleteOrderResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deleteOrderResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type createUserResponsedefault = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type createUsersWithArrayInputResponsedefault = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type createUsersWithListInputResponsedefault = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type loginUserResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type logoutUserResponsedefault = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getUserByNameResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getUserByNameResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updateUserResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updateUserResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deleteUserResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deleteUserResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type findPetsByStatusResponse200 = { readonly status: S; @@ -2876,67 +2876,67 @@ declare namespace Components { }; } export namespace Headers { - export type LoginUserResponse200HeadersXRateLimit = NonNullable; - export type LoginUserResponse200HeadersXExpiresAfter = NonNullable; + export type LoginUserResponse200HeadersXRateLimit = number; + export type LoginUserResponse200HeadersXExpiresAfter = string; } export namespace Schemas { - export type RequestBodiesUserArrayBody0 = NonNullable; - export type Pet = NonNullable<{ - id?: NonNullable; + export type RequestBodiesUserArrayBody0 = Components.Schemas.User[]; + export type Pet = { + id?: number; category?: Components.Schemas.Category; - name: NonNullable; - photoUrls: NonNullable[]>; - tags?: NonNullable; + name: string; + photoUrls: string[]; + tags?: Components.Schemas.Tag[]; status?: Enums.PetStatusInTheStore; - }>; - export type Body = NonNullable<{ - name?: NonNullable; - status?: NonNullable; - }>; - export type Body1 = NonNullable<{ - additionalMetadata?: NonNullable; - file?: NonNullable; - }>; - export type Order = NonNullable<{ - id?: NonNullable; - petId?: NonNullable; - quantity?: NonNullable; - shipDate?: NonNullable; + }; + export type Body = { + name?: string; + status?: string; + }; + export type Body1 = { + additionalMetadata?: string; + file?: string; + }; + export type Order = { + id?: number; + petId?: number; + quantity?: number; + shipDate?: string; status?: Enums.OrderStatus; - complete?: NonNullable; - }>; - export type User = NonNullable<{ - id?: NonNullable; - username?: NonNullable; - firstName?: NonNullable; - lastName?: NonNullable; - email?: NonNullable; - password?: NonNullable; - phone?: NonNullable; - userStatus?: NonNullable; - }>; - export type ResponsesfindPetsByStatusResponse200Body0 = NonNullable; - export type ResponsesfindPetsByStatusResponse200Body1 = NonNullable; - export type ResponsesfindPetsByTagsResponse200Body0 = NonNullable; - export type ResponsesfindPetsByTagsResponse200Body1 = NonNullable; - export type ApiResponse = NonNullable<{ - code?: NonNullable; - type?: NonNullable; - message?: NonNullable; - }>; - export type ResponsesgetInventoryResponse200Body0 = NonNullable<{ + complete?: boolean; + }; + export type User = { + id?: number; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + password?: string; + phone?: string; + userStatus?: number; + }; + export type ResponsesfindPetsByStatusResponse200Body0 = Components.Schemas.Pet[]; + export type ResponsesfindPetsByStatusResponse200Body1 = Components.Schemas.Pet[]; + export type ResponsesfindPetsByTagsResponse200Body0 = Components.Schemas.Pet[]; + export type ResponsesfindPetsByTagsResponse200Body1 = Components.Schemas.Pet[]; + export type ApiResponse = { + code?: number; + type?: string; + message?: string; + }; + export type ResponsesgetInventoryResponse200Body0 = { [pattern: string]: unknown; - }>; - export type ResponsesloginUserResponse200Body0 = NonNullable; - export type ResponsesloginUserResponse200Body1 = NonNullable; - export type Category = NonNullable<{ - id?: NonNullable; - name?: NonNullable; - }>; - export type Tag = NonNullable<{ - id?: NonNullable; - name?: NonNullable; - }>; + }; + export type ResponsesloginUserResponse200Body0 = string; + export type ResponsesloginUserResponse200Body1 = string; + export type Category = { + id?: number; + name?: string; + }; + export type Tag = { + id?: number; + name?: string; + }; } } declare namespace Enums { @@ -3162,20 +3162,20 @@ declare namespace Components { export type UpdateUserRequestBody = Components.Schemas.User; } export namespace Parameters { - export type GetPetById0 = NonNullable; - export type UpdatePetWithForm0 = NonNullable; - export type DeletePet0 = NonNullable; - export type DeletePet1 = NonNullable; - export type UploadFile0 = NonNullable; - export type GetOrderById0 = NonNullable; - export type DeleteOrder0 = NonNullable; - export type LoginUser0 = NonNullable; - export type LoginUser1 = NonNullable; - export type GetUserByName0 = NonNullable; - export type UpdateUser0 = NonNullable; - export type DeleteUser0 = NonNullable; - export type FindPetsByStatus0 = NonNullable<("available" | "pending" | "sold")[]>; - export type FindPetsByTags0 = NonNullable[]>; + export type GetPetById0 = number; + export type UpdatePetWithForm0 = number; + export type DeletePet0 = string; + export type DeletePet1 = number; + export type UploadFile0 = number; + export type GetOrderById0 = number; + export type DeleteOrder0 = string; + export type LoginUser0 = string; + export type LoginUser1 = string; + export type GetUserByName0 = string; + export type UpdateUser0 = string; + export type DeleteUser0 = string; + export type FindPetsByStatus0 = ("available" | "pending" | "sold")[]; + export type FindPetsByTags0 = string[]; } export namespace Responses { export type findPetsByStatusResponse200 = { @@ -3245,67 +3245,67 @@ declare namespace Components { }; } export namespace Headers { - export type LoginUserResponse200HeadersXRateLimit = NonNullable; - export type LoginUserResponse200HeadersXExpiresAfter = NonNullable; + export type LoginUserResponse200HeadersXRateLimit = number; + export type LoginUserResponse200HeadersXExpiresAfter = string; } export namespace Schemas { - export type RequestBodiesUserArrayBody0 = NonNullable; - export type Pet = NonNullable<{ - id?: NonNullable; + export type RequestBodiesUserArrayBody0 = Components.Schemas.User[]; + export type Pet = { + id?: number; category?: Components.Schemas.Category; - name: NonNullable; - photoUrls: NonNullable[]>; - tags?: NonNullable; + name: string; + photoUrls: string[]; + tags?: Components.Schemas.Tag[]; status?: "available" | "pending" | "sold"; - }>; - export type Body = NonNullable<{ - name?: NonNullable; - status?: NonNullable; - }>; - export type Body1 = NonNullable<{ - additionalMetadata?: NonNullable; - file?: NonNullable; - }>; - export type Order = NonNullable<{ - id?: NonNullable; - petId?: NonNullable; - quantity?: NonNullable; - shipDate?: NonNullable; + }; + export type Body = { + name?: string; + status?: string; + }; + export type Body1 = { + additionalMetadata?: string; + file?: string; + }; + export type Order = { + id?: number; + petId?: number; + quantity?: number; + shipDate?: string; status?: "placed" | "approved" | "delivered"; - complete?: NonNullable; - }>; - export type User = NonNullable<{ - id?: NonNullable; - username?: NonNullable; - firstName?: NonNullable; - lastName?: NonNullable; - email?: NonNullable; - password?: NonNullable; - phone?: NonNullable; - userStatus?: NonNullable; - }>; - export type ResponsesfindPetsByStatusResponse200Body0 = NonNullable; - export type ResponsesfindPetsByStatusResponse200Body1 = NonNullable; - export type ResponsesfindPetsByTagsResponse200Body0 = NonNullable; - export type ResponsesfindPetsByTagsResponse200Body1 = NonNullable; - export type ApiResponse = NonNullable<{ - code?: NonNullable; - type?: NonNullable; - message?: NonNullable; - }>; - export type ResponsesgetInventoryResponse200Body0 = NonNullable<{ + complete?: boolean; + }; + export type User = { + id?: number; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + password?: string; + phone?: string; + userStatus?: number; + }; + export type ResponsesfindPetsByStatusResponse200Body0 = Components.Schemas.Pet[]; + export type ResponsesfindPetsByStatusResponse200Body1 = Components.Schemas.Pet[]; + export type ResponsesfindPetsByTagsResponse200Body0 = Components.Schemas.Pet[]; + export type ResponsesfindPetsByTagsResponse200Body1 = Components.Schemas.Pet[]; + export type ApiResponse = { + code?: number; + type?: string; + message?: string; + }; + export type ResponsesgetInventoryResponse200Body0 = { [pattern: string]: unknown; - }>; - export type ResponsesloginUserResponse200Body0 = NonNullable; - export type ResponsesloginUserResponse200Body1 = NonNullable; - export type Category = NonNullable<{ - id?: NonNullable; - name?: NonNullable; - }>; - export type Tag = NonNullable<{ - id?: NonNullable; - name?: NonNullable; - }>; + }; + export type ResponsesloginUserResponse200Body0 = string; + export type ResponsesloginUserResponse200Body1 = string; + export type Category = { + id?: number; + name?: string; + }; + export type Tag = { + id?: number; + name?: string; + }; } }" `; @@ -3567,20 +3567,20 @@ export namespace Components { export type UpdateUserRequestBody = Components.Schemas.User; } export namespace Parameters { - export type GetPetById0 = NonNullable; - export type UpdatePetWithForm0 = NonNullable; - export type DeletePet0 = NonNullable; - export type DeletePet1 = NonNullable; - export type UploadFile0 = NonNullable; - export type GetOrderById0 = NonNullable; - export type DeleteOrder0 = NonNullable; - export type LoginUser0 = NonNullable; - export type LoginUser1 = NonNullable; - export type GetUserByName0 = NonNullable; - export type UpdateUser0 = NonNullable; - export type DeleteUser0 = NonNullable; - export type FindPetsByStatus0 = NonNullable<("available" | "pending" | "sold")[]>; - export type FindPetsByTags0 = NonNullable[]>; + export type GetPetById0 = number; + export type UpdatePetWithForm0 = number; + export type DeletePet0 = string; + export type DeletePet1 = number; + export type UploadFile0 = number; + export type GetOrderById0 = number; + export type DeleteOrder0 = string; + export type LoginUser0 = string; + export type LoginUser1 = string; + export type GetUserByName0 = string; + export type UpdateUser0 = string; + export type DeleteUser0 = string; + export type FindPetsByStatus0 = ("available" | "pending" | "sold")[]; + export type FindPetsByTags0 = string[]; } export namespace Responses { export type updatePetResponse400 = { @@ -3588,182 +3588,182 @@ export namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updatePetResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updatePetResponse405 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type addPetResponse405 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type findPetsByStatusResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type findPetsByTagsResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getPetByIdResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getPetByIdResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updatePetWithFormResponse405 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deletePetResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type placeOrderResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getOrderByIdResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getOrderByIdResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deleteOrderResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deleteOrderResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type createUserResponsedefault = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type createUsersWithArrayInputResponsedefault = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type createUsersWithListInputResponsedefault = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type loginUserResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type logoutUserResponsedefault = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getUserByNameResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getUserByNameResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updateUserResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type updateUserResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deleteUserResponse400 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type deleteUserResponse404 = { readonly status: S; readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type findPetsByStatusResponse200 = { readonly status: S; @@ -3832,67 +3832,67 @@ export namespace Components { }; } export namespace Headers { - export type LoginUserResponse200HeadersXRateLimit = NonNullable; - export type LoginUserResponse200HeadersXExpiresAfter = NonNullable; + export type LoginUserResponse200HeadersXRateLimit = number; + export type LoginUserResponse200HeadersXExpiresAfter = string; } export namespace Schemas { - export type Order = NonNullable<{ - id?: NonNullable; - petId?: NonNullable; - quantity?: NonNullable; - shipDate?: NonNullable; + export type Order = { + id?: number; + petId?: number; + quantity?: number; + shipDate?: string; status?: Enums.OrderStatus; - complete?: NonNullable; - }>; - export type Category = NonNullable<{ - id?: NonNullable; - name?: NonNullable; - }>; - export type User = NonNullable<{ - id?: NonNullable; - username?: NonNullable; - firstName?: NonNullable; - lastName?: NonNullable; - email?: NonNullable; - password?: NonNullable; - phone?: NonNullable; - userStatus?: NonNullable; - }>; - export type Tag = NonNullable<{ - id?: NonNullable; - name?: NonNullable; - }>; - export type Pet = NonNullable<{ - id?: NonNullable; + complete?: boolean; + }; + export type Category = { + id?: number; + name?: string; + }; + export type User = { + id?: number; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + password?: string; + phone?: string; + userStatus?: number; + }; + export type Tag = { + id?: number; + name?: string; + }; + export type Pet = { + id?: number; category?: Components.Schemas.Category; - name: NonNullable; - photoUrls: NonNullable[]>; - tags?: NonNullable; + name: string; + photoUrls: string[]; + tags?: Components.Schemas.Tag[]; status?: Enums.PetStatusInTheStore; - }>; - export type ApiResponse = NonNullable<{ - code?: NonNullable; - type?: NonNullable; - message?: NonNullable; - }>; - export type Body = NonNullable<{ - name?: NonNullable; - status?: NonNullable; - }>; - export type Body1 = NonNullable<{ - additionalMetadata?: NonNullable; - file?: NonNullable; - }>; - export type RequestBodiesUserArrayBody0 = NonNullable; - export type ResponsesfindPetsByStatusResponse200Body0 = NonNullable; - export type ResponsesfindPetsByStatusResponse200Body1 = NonNullable; - export type ResponsesfindPetsByTagsResponse200Body0 = NonNullable; - export type ResponsesfindPetsByTagsResponse200Body1 = NonNullable; - export type ResponsesgetInventoryResponse200Body0 = NonNullable<{ + }; + export type ApiResponse = { + code?: number; + type?: string; + message?: string; + }; + export type Body = { + name?: string; + status?: string; + }; + export type Body1 = { + additionalMetadata?: string; + file?: string; + }; + export type RequestBodiesUserArrayBody0 = Components.Schemas.User[]; + export type ResponsesfindPetsByStatusResponse200Body0 = Components.Schemas.Pet[]; + export type ResponsesfindPetsByStatusResponse200Body1 = Components.Schemas.Pet[]; + export type ResponsesfindPetsByTagsResponse200Body0 = Components.Schemas.Pet[]; + export type ResponsesfindPetsByTagsResponse200Body1 = Components.Schemas.Pet[]; + export type ResponsesgetInventoryResponse200Body0 = { [pattern: string]: unknown; - }>; - export type ResponsesloginUserResponse200Body0 = NonNullable; - export type ResponsesloginUserResponse200Body1 = NonNullable; + }; + export type ResponsesloginUserResponse200Body0 = string; + export type ResponsesloginUserResponse200Body1 = string; } } export namespace Enums { @@ -3984,9 +3984,9 @@ declare namespace Components { } export namespace Parameters { export type PathParam2 = Components.Schemas.Strings; - export type Duration = NonNullable; - export type PathParam1 = NonNullable; - export type GetParameters2 = NonNullable; + export type Duration = number; + export type PathParam1 = number; + export type GetParameters2 = boolean; } export namespace Responses { export type getDelayResponse204 = { @@ -3994,7 +3994,7 @@ declare namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getDiagnosticResponse200 = { readonly status: S; @@ -4044,27 +4044,27 @@ declare namespace Components { export type GetParametersResponse204HeadersXDelayPrecision = Enums.GetParametersResponse204HeadersXDelayPrecision; } export namespace Schemas { - export type Echo = NonNullable<{ - echo: NonNullable; - }>; - export type Strings = NonNullable[]>; - export type ResponsesgetDiagnosticResponse200Body0 = NonNullable<{ - transactions: NonNullable<{ + export type Echo = { + echo: string; + }; + export type Strings = string[]; + export type ResponsesgetDiagnosticResponse200Body0 = { + transactions: { [pattern: string]: unknown; - }>; - }>; - export type ResponsesgetOpenAPIResponse200Body0 = NonNullable<{}>; - export type ResponsesgetParametersResponse204Body0 = NonNullable<{ - aHeader?: NonNullable; - pathParam1?: NonNullable; - pathParam2?: NonNullable[]>; - }>; - export type TimeSchema = NonNullable<{ - currentDate?: NonNullable; - }>; - export type ResponsesgetPingResponse200Body0 = NonNullable<{ + }; + }; + export type ResponsesgetOpenAPIResponse200Body0 = {}; + export type ResponsesgetParametersResponse204Body0 = { + aHeader?: boolean; + pathParam1?: number; + pathParam2?: string[]; + }; + export type TimeSchema = { + currentDate?: string; + }; + export type ResponsesgetPingResponse200Body0 = { pong?: "pong"; - }>; + }; } } declare namespace Enums { @@ -4145,9 +4145,9 @@ declare namespace Components { } export namespace Parameters { export type PathParam2 = Components.Schemas.Strings; - export type Duration = NonNullable; - export type PathParam1 = NonNullable; - export type GetParameters2 = NonNullable; + export type Duration = number; + export type PathParam1 = number; + export type GetParameters2 = boolean; } export namespace Responses { export type getDiagnosticResponse200 = { @@ -4187,22 +4187,22 @@ declare namespace Components { }; } export namespace Schemas { - export type Echo = NonNullable<{ - echo: NonNullable; - }>; - export type Strings = NonNullable[]>; - export type ResponsesgetDiagnosticResponse200Body0 = NonNullable<{ - transactions: NonNullable<{ + export type Echo = { + echo: string; + }; + export type Strings = string[]; + export type ResponsesgetDiagnosticResponse200Body0 = { + transactions: { [pattern: string]: unknown; - }>; - }>; - export type ResponsesgetOpenAPIResponse200Body0 = NonNullable<{}>; - export type TimeSchema = NonNullable<{ - currentDate?: NonNullable; - }>; - export type ResponsesgetPingResponse200Body0 = NonNullable<{ + }; + }; + export type ResponsesgetOpenAPIResponse200Body0 = {}; + export type TimeSchema = { + currentDate?: string; + }; + export type ResponsesgetPingResponse200Body0 = { pong?: "pong"; - }>; + }; } }" `; @@ -4282,9 +4282,9 @@ export namespace Components { } export namespace Parameters { export type PathParam2 = Components.Schemas.Strings; - export type Duration = NonNullable; - export type PathParam1 = NonNullable; - export type GetParameters2 = NonNullable; + export type Duration = number; + export type PathParam1 = number; + export type GetParameters2 = boolean; } export namespace Responses { export type getDelayResponse204 = { @@ -4292,7 +4292,7 @@ export namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type getDiagnosticResponse200 = { readonly status: S; @@ -4342,27 +4342,27 @@ export namespace Components { export type GetParametersResponse204HeadersXDelayPrecision = Enums.GetParametersResponse204HeadersXDelayPrecision; } export namespace Schemas { - export type TimeSchema = NonNullable<{ - currentDate?: NonNullable; - }>; - export type Echo = NonNullable<{ - echo: NonNullable; - }>; - export type Strings = NonNullable[]>; - export type ResponsesgetDiagnosticResponse200Body0 = NonNullable<{ - transactions: NonNullable<{ + export type TimeSchema = { + currentDate?: string; + }; + export type Echo = { + echo: string; + }; + export type Strings = string[]; + export type ResponsesgetDiagnosticResponse200Body0 = { + transactions: { [pattern: string]: unknown; - }>; - }>; - export type ResponsesgetOpenAPIResponse200Body0 = NonNullable<{}>; - export type ResponsesgetParametersResponse204Body0 = NonNullable<{ - aHeader?: NonNullable; - pathParam1?: NonNullable; - pathParam2?: NonNullable[]>; - }>; - export type ResponsesgetPingResponse200Body0 = NonNullable<{ + }; + }; + export type ResponsesgetOpenAPIResponse200Body0 = {}; + export type ResponsesgetParametersResponse204Body0 = { + aHeader?: boolean; + pathParam1?: number; + pathParam2?: string[]; + }; + export type ResponsesgetPingResponse200Body0 = { pong?: "pong"; - }>; + }; } } export namespace Enums { @@ -4449,9 +4449,9 @@ declare namespace Components { } export namespace Parameters { export type PathParam2 = Components.Schemas.Strings; - export type Duration = NonNullable; - export type PathParam1 = NonNullable; - export type GetParameters2 = NonNullable; + export type Duration = number; + export type PathParam1 = number; + export type GetParameters2 = boolean; } export namespace Responses { export type Delay204 = { @@ -4459,7 +4459,7 @@ declare namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type Diagnostic200 = { readonly status: S; @@ -4509,27 +4509,27 @@ declare namespace Components { export type XDelayPrecision = Enums.XDelayPrecision; } export namespace Schemas { - export type Echo = NonNullable<{ - echo: NonNullable; - }>; - export type Strings = NonNullable[]>; - export type ResponsesDiagnostic200Body0 = NonNullable<{ - transactions: NonNullable<{ + export type Echo = { + echo: string; + }; + export type Strings = string[]; + export type ResponsesDiagnostic200Body0 = { + transactions: { [pattern: string]: unknown; - }>; - }>; - export type ResponsesOpenAPI200Body0 = NonNullable<{}>; - export type ResponsesParams204Body0 = NonNullable<{ - aHeader?: NonNullable; - pathParam1?: NonNullable; - pathParam2?: NonNullable[]>; - }>; - export type TimeSchema = NonNullable<{ - currentDate?: NonNullable; - }>; - export type ResponsesPing200Body0 = NonNullable<{ + }; + }; + export type ResponsesOpenAPI200Body0 = {}; + export type ResponsesParams204Body0 = { + aHeader?: boolean; + pathParam1?: number; + pathParam2?: string[]; + }; + export type TimeSchema = { + currentDate?: string; + }; + export type ResponsesPing200Body0 = { pong?: "pong"; - }>; + }; } } declare namespace Enums { @@ -4610,9 +4610,9 @@ declare namespace Components { } export namespace Parameters { export type PathParam2 = Components.Schemas.Strings; - export type Duration = NonNullable; - export type PathParam1 = NonNullable; - export type GetParameters2 = NonNullable; + export type Duration = number; + export type PathParam1 = number; + export type GetParameters2 = boolean; } export namespace Responses { export type Delay204 = { @@ -4620,7 +4620,7 @@ declare namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type Diagnostic200 = { readonly status: S; @@ -4670,27 +4670,27 @@ declare namespace Components { export type XDelayPrecision = "ns" | "ms" | "s"; } export namespace Schemas { - export type Echo = NonNullable<{ - echo: NonNullable; - }>; - export type Strings = NonNullable[]>; - export type ResponsesDiagnostic200Body0 = NonNullable<{ - transactions: NonNullable<{ + export type Echo = { + echo: string; + }; + export type Strings = string[]; + export type ResponsesDiagnostic200Body0 = { + transactions: { [pattern: string]: unknown; - }>; - }>; - export type ResponsesOpenAPI200Body0 = NonNullable<{}>; - export type ResponsesParams204Body0 = NonNullable<{ - aHeader?: NonNullable; - pathParam1?: NonNullable; - pathParam2?: NonNullable[]>; - }>; - export type TimeSchema = NonNullable<{ - currentDate?: NonNullable; - }>; - export type ResponsesPing200Body0 = NonNullable<{ + }; + }; + export type ResponsesOpenAPI200Body0 = {}; + export type ResponsesParams204Body0 = { + aHeader?: boolean; + pathParam1?: number; + pathParam2?: string[]; + }; + export type TimeSchema = { + currentDate?: string; + }; + export type ResponsesPing200Body0 = { pong?: "pong"; - }>; + }; } }" `; @@ -4770,9 +4770,9 @@ export namespace Components { } export namespace Parameters { export type PathParam2 = Components.Schemas.Strings; - export type Duration = NonNullable; - export type PathParam1 = NonNullable; - export type GetParameters2 = NonNullable; + export type Duration = number; + export type PathParam1 = number; + export type GetParameters2 = boolean; } export namespace Responses { export type Delay204 = { @@ -4780,7 +4780,7 @@ export namespace Components { readonly headers?: { readonly [name: string]: unknown; }; - readonly body?: NonNullable; + readonly body?: unknown; }; export type Diagnostic200 = { readonly status: S; @@ -4830,27 +4830,27 @@ export namespace Components { export type XDelayPrecision = Enums.XDelayPrecision; } export namespace Schemas { - export type TimeSchema = NonNullable<{ - currentDate?: NonNullable; - }>; - export type Echo = NonNullable<{ - echo: NonNullable; - }>; - export type Strings = NonNullable[]>; - export type ResponsesDiagnostic200Body0 = NonNullable<{ - transactions: NonNullable<{ + export type TimeSchema = { + currentDate?: string; + }; + export type Echo = { + echo: string; + }; + export type Strings = string[]; + export type ResponsesDiagnostic200Body0 = { + transactions: { [pattern: string]: unknown; - }>; - }>; - export type ResponsesOpenAPI200Body0 = NonNullable<{}>; - export type ResponsesParams204Body0 = NonNullable<{ - aHeader?: NonNullable; - pathParam1?: NonNullable; - pathParam2?: NonNullable[]>; - }>; - export type ResponsesPing200Body0 = NonNullable<{ + }; + }; + export type ResponsesOpenAPI200Body0 = {}; + export type ResponsesParams204Body0 = { + aHeader?: boolean; + pathParam1?: number; + pathParam2?: string[]; + }; + export type ResponsesPing200Body0 = { pong?: "pong"; - }>; + }; } } export namespace Enums { diff --git a/src/index.test.ts b/src/index.test.ts index 0c203dc..6a0c377 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -90,53 +90,53 @@ describe('generateOpenAPITypes()', () => { }), ), ).toMatchInlineSnapshot(` - "export namespace API { - export namespace GetPing { - export type Body = Components.RequestBodies.GetPingRequestBody; - export type Output = Responses.$200; - export type Input = { - readonly body?: Body; - readonly xAHeader?: Parameters.XAHeader; - readonly xApiVersion?: Parameters.XAPIVersion; - }; - export namespace Responses { - export type $200 = Components.Responses.GetPingResponse200<200>; - } - export namespace Parameters { - export type XAHeader = Components.Parameters.GetPing0; - export type XAPIVersion = Components.Parameters.GetPing1; - } - } - } - export namespace Components { - export namespace RequestBodies { - export type GetPingRequestBody = Components.Schemas.RequestBodiesGetPingRequestBodyBody0; - } - export namespace Parameters { - export type GetPing0 = NonNullable; - export type GetPing1 = NonNullable; - } - export namespace Responses { - export type GetPingResponse200 = { - readonly status: S; - readonly headers: { - readonly "x-a-header": Components.Headers.GetPingResponse200HeadersXAHeader; - readonly "x-sdk-version"?: Components.Headers.GetPingResponse200HeadersXSDKVersion; - readonly [name: string]: unknown; - }; - readonly body: Components.Schemas.ResponsesGetPingResponse200Body0; - }; - } - export namespace Headers { - export type GetPingResponse200HeadersXAHeader = NonNullable; - export type GetPingResponse200HeadersXSDKVersion = NonNullable; - } - export namespace Schemas { - export type RequestBodiesGetPingRequestBodyBody0 = NonNullable; - export type ResponsesGetPingResponse200Body0 = NonNullable; - } - }" - `); +"export namespace API { + export namespace GetPing { + export type Body = Components.RequestBodies.GetPingRequestBody; + export type Output = Responses.$200; + export type Input = { + readonly body?: Body; + readonly xAHeader?: Parameters.XAHeader; + readonly xApiVersion?: Parameters.XAPIVersion; + }; + export namespace Responses { + export type $200 = Components.Responses.GetPingResponse200<200>; + } + export namespace Parameters { + export type XAHeader = Components.Parameters.GetPing0; + export type XAPIVersion = Components.Parameters.GetPing1; + } + } +} +export namespace Components { + export namespace RequestBodies { + export type GetPingRequestBody = Components.Schemas.RequestBodiesGetPingRequestBodyBody0; + } + export namespace Parameters { + export type GetPing0 = number; + export type GetPing1 = string; + } + export namespace Responses { + export type GetPingResponse200 = { + readonly status: S; + readonly headers: { + readonly "x-a-header": Components.Headers.GetPingResponse200HeadersXAHeader; + readonly "x-sdk-version"?: Components.Headers.GetPingResponse200HeadersXSDKVersion; + readonly [name: string]: unknown; + }; + readonly body: Components.Schemas.ResponsesGetPingResponse200Body0; + }; + } + export namespace Headers { + export type GetPingResponse200HeadersXAHeader = number; + export type GetPingResponse200HeadersXSDKVersion = string; + } + export namespace Schemas { + export type RequestBodiesGetPingRequestBodyBody0 = string; + export type ResponsesGetPingResponse200Body0 = string; + } +}" +`); }); test('with a normalized simple sample', async () => { @@ -243,53 +243,53 @@ describe('generateOpenAPITypes()', () => { }), ), ).toMatchInlineSnapshot(` - "declare namespace API { - export namespace GetTest { - export type Body = Components.RequestBodies.TheBody; - export type Output = Responses.$200; - export type Input = { - readonly body?: Body; - readonly testParam?: Parameters.TestParam; - }; - export namespace Responses { - export type $200 = Components.Responses.TheResponse<200>; - } - export namespace Parameters { - export type TestParam = Components.Parameters.TheTestParam; - } - } - } - declare namespace Components { - export namespace RequestBodies { - export type TheBodyClone = Components.RequestBodies.TheBody; - export type TheBody = Components.Schemas.TheSchemaClone; - } - export namespace Parameters { - export type TheTestParamClone = Components.Parameters.TheTestParam; - export type TheTestParam = Components.Schemas.TheSchema; - } - export namespace Responses { - export type TheResponseClone = Components.Responses.TheResponse; - export type TheResponse = { - readonly status: S; - readonly headers?: { - readonly "x-a-header"?: Components.Headers.TheXAHeader; - readonly [name: string]: unknown; - }; - readonly body: Components.Schemas.TheSchema; - }; - } - export namespace Headers { - export type TheXAHeader = NonNullable; - } - export namespace Schemas { - export type TheSchemaClone = Components.Schemas.TheSchema; - export type TheSchema = NonNullable & NonNullable<{ - _type?: "TheSchema"; - }>; - } - }" - `); +"declare namespace API { + export namespace GetTest { + export type Body = Components.RequestBodies.TheBody; + export type Output = Responses.$200; + export type Input = { + readonly body?: Body; + readonly testParam?: Parameters.TestParam; + }; + export namespace Responses { + export type $200 = Components.Responses.TheResponse<200>; + } + export namespace Parameters { + export type TestParam = Components.Parameters.TheTestParam; + } + } +} +declare namespace Components { + export namespace RequestBodies { + export type TheBodyClone = Components.RequestBodies.TheBody; + export type TheBody = Components.Schemas.TheSchemaClone; + } + export namespace Parameters { + export type TheTestParamClone = Components.Parameters.TheTestParam; + export type TheTestParam = Components.Schemas.TheSchema; + } + export namespace Responses { + export type TheResponseClone = Components.Responses.TheResponse; + export type TheResponse = { + readonly status: S; + readonly headers?: { + readonly "x-a-header"?: Components.Headers.TheXAHeader; + readonly [name: string]: unknown; + }; + readonly body: Components.Schemas.TheSchema; + }; + } + export namespace Headers { + export type TheXAHeader = number; + } + export namespace Schemas { + export type TheSchemaClone = Components.Schemas.TheSchema; + export type TheSchema = string & { + _type?: "TheSchema"; + }; + } +}" +`); }); describe('with OpenAPI samples', () => { @@ -437,7 +437,7 @@ describe('generateTypeDeclaration()', () => { schema, ), ), - ).toMatchInlineSnapshot(`"declare type Limit = NonNullable;"`); + ).toMatchInlineSnapshot(`"declare type Limit = number;"`); }); test('should work with several literal type schema', async () => { @@ -449,7 +449,7 @@ describe('generateTypeDeclaration()', () => { expect( toSource(await generateTypeDeclaration(context, schema)), ).toMatchInlineSnapshot( - `"export type Limit = NonNullable | NonNullable | NonNullable;"`, + `"export type Limit = number | string | boolean;"`, ); }); @@ -461,7 +461,7 @@ describe('generateTypeDeclaration()', () => { expect( toSource(await generateTypeDeclaration(context, schema)), - ).toMatchInlineSnapshot(`"export type Limit = number;"`); + ).toMatchInlineSnapshot(`"export type Limit = number | null;"`); }); test('should work with several literal nullable type schema', async () => { @@ -472,7 +472,7 @@ describe('generateTypeDeclaration()', () => { expect( toSource(await generateTypeDeclaration(context, schema)), - ).toMatchInlineSnapshot(`"export type Limit = number | string;"`); + ).toMatchInlineSnapshot(`"export type Limit = number | string | null;"`); }); test('should work with literal enums', async () => { @@ -505,14 +505,14 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` - "export type Limit = NonNullable<{ - min: NonNullable; - max: NonNullable; - minIncluded?: NonNullable; - maxIncluded?: NonNullable; - pace?: NonNullable; - }>;" - `); +"export type Limit = { + min: number; + max: number; + minIncluded?: boolean; + maxIncluded?: boolean; + pace?: number; +};" +`); }); test('should work with nullable object schema', async () => { @@ -538,18 +538,18 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` - "export type Limit = { - min?: NonNullable; - max?: NonNullable; - minIncluded?: NonNullable; - maxIncluded?: NonNullable; - pace?: NonNullable; - nothing?: never; - anything?: unknown; - aConst?: "test"; - [pattern: string]: NonNullable | unknown; - };" - `); +"export type Limit = { + min?: number; + max?: number; + minIncluded?: boolean; + maxIncluded?: boolean; + pace?: number; + nothing?: never; + anything?: unknown; + aConst?: "test"; + [pattern: string]: string | unknown; +} | null;" +`); }); test('should work with nested schemas', async () => { @@ -569,14 +569,14 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` "export type Limit = { - min?: NonNullable; - max?: NonNullable; - minIncluded?: NonNullable; - maxIncluded?: NonNullable; - readonly pace?: NonNullable; -} | number | [ - NonNullable, - NonNullable + min?: number; + max?: number; + minIncluded?: boolean; + maxIncluded?: boolean; + readonly pace?: number; +} | null | number | [ + number, + string ];" `); }); @@ -607,16 +607,16 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` -"export type Limit = number | NonNullable<{ - min?: NonNullable; - max?: NonNullable; - minIncluded?: NonNullable; - maxIncluded?: NonNullable; - readonly pace?: NonNullable; -}> | NonNullable<[ - NonNullable, - NonNullable -]>;" +"export type Limit = (null | number) | { + min?: number; + max?: number; + minIncluded?: boolean; + maxIncluded?: boolean; + readonly pace?: number; +} | [ + number, + string +];" `); }); @@ -646,16 +646,16 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` -"export type Limit = number | NonNullable<{ - min?: NonNullable; - max?: NonNullable; - minIncluded?: NonNullable; - maxIncluded?: NonNullable; - readonly pace?: NonNullable; -}> | NonNullable<[ - NonNullable, - NonNullable -]>;" +"export type Limit = (null | number) | { + min?: number; + max?: number; + minIncluded?: boolean; + maxIncluded?: boolean; + readonly pace?: number; +} | [ + number, + string +];" `); }); @@ -692,14 +692,14 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` - "export type User = NonNullable<{ - name?: NonNullable; - }> & (NonNullable<{ - email: NonNullable; - }> | NonNullable<{ - cellphone: NonNullable; - }>);" - `); +"export type User = { + name?: string; +} & ({ + email: string; +} | { + cellphone: string; +});" +`); }); test('should work with base schema and nested oneof schemas and inherited types', async () => { @@ -733,14 +733,14 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` - "export type User = NonNullable<{ - name?: NonNullable; - }> & (NonNullable<{ - email: NonNullable; - }> | NonNullable<{ - cellphone: NonNullable; - }>);" - `); +"export type User = { + name?: string; +} & ({ + email: string; +} | { + cellphone: string; +});" +`); }); test('should work with allOf schemas', async () => { @@ -769,16 +769,16 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` -"export type Limit = number & NonNullable<{ - min?: NonNullable; - max?: NonNullable; - minIncluded?: NonNullable; - maxIncluded?: NonNullable; - readonly pace?: NonNullable; -}> & NonNullable<[ - NonNullable, - NonNullable -]>;" +"export type Limit = (null | number) & { + min?: number; + max?: number; + minIncluded?: boolean; + maxIncluded?: boolean; + readonly pace?: number; +} & [ + number, + string +];" `); }); @@ -805,17 +805,17 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` - "export type Limit = NonNullable<{ - min?: NonNullable; - max?: NonNullable; - minIncluded?: NonNullable; - maxIncluded?: NonNullable; - readonly pace?: NonNullable; - }> & NonNullable<{ - min: unknown; - max: unknown; - }>;" - `); +"export type Limit = { + min?: number; + max?: number; + minIncluded?: boolean; + maxIncluded?: boolean; + readonly pace?: number; +} & { + min: unknown; + max: unknown; +};" +`); }); test('should work with simple literal type schema', async () => { @@ -874,14 +874,14 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` - "export type Unknown = NonNullable<{ - name: NonNullable; - }> & (NonNullable<{ - email: NonNullable; - }> | NonNullable<{ - phone: NonNullable; - }>);" - `); +"export type Unknown = { + name: string; +} & ({ + email: string; +} | { + phone: string; +});" +`); }); test('should work with not defined items array schemas', async () => { @@ -891,9 +891,7 @@ describe('generateTypeDeclaration()', () => { expect( toSource(await generateTypeDeclaration(context, schema)), - ).toMatchInlineSnapshot( - `"export type Unknown = NonNullable;"`, - ); + ).toMatchInlineSnapshot(`"export type Unknown = unknown[];"`); }); test('should work with no items array schemas', async () => { @@ -904,7 +902,7 @@ describe('generateTypeDeclaration()', () => { expect( toSource(await generateTypeDeclaration(context, schema)), - ).toMatchInlineSnapshot(`"export type Unknown = NonNullable;"`); + ).toMatchInlineSnapshot(`"export type Unknown = never[];"`); }); test('should work with anyOf/array special test case schemas', async () => { @@ -992,18 +990,18 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` - "export type TrickyThing = NonNullable<{ - name: NonNullable; - duration: NonNullable; - start: Components.Schemas.Date; - end: Components.Schemas.Date; - labels: NonNullable<("value" | "peaks" | "startTime" | "endTime" | "peakTime")[]>; - timestamp: NonNullable<("startTime" | "endTime" | "peakTime")[]>; - data: NonNullable | ("first" | "bosse" | "last") | NonNullable)[]>[]>; - context: Components.Schemas.Data; - [pattern: string]: unknown; - }>;" - `); +"export type TrickyThing = { + name: string; + duration: number; + start: Components.Schemas.Date; + end: Components.Schemas.Date; + labels: ("value" | "peaks" | "startTime" | "endTime" | "peakTime")[]; + timestamp: ("startTime" | "endTime" | "peakTime")[]; + data: (Components.Schemas.Date | number | ("first" | "bosse" | "last") | string)[][]; + context: Components.Schemas.Data; + [pattern: string]: unknown; +};" +`); }); }); @@ -1034,14 +1032,14 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` -"export type TupleTest = NonNullable<{ - data: NonNullable, - NonNullable, - NonNullable, - NonNullable[]> - ]>[]>; -}>;" +"export type TupleTest = { + data: [ + string, + number, + number, + string[] + ][]; +};" `); }); @@ -1063,14 +1061,14 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` -"export type FixedArrayToTupleTest = NonNullable<{ - data: NonNullable<[ - NonNullable, - NonNullable, - NonNullable, - NonNullable - ]>; -}>;" +"export type FixedArrayToTupleTest = { + data: [ + string, + string, + string, + string + ]; +};" `); }); @@ -1091,13 +1089,13 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` -"export type FixedArrayToTupleTest = NonNullable<{ - data: NonNullable<[ - NonNullable, - NonNullable, - ...NonNullable[] - ]>; -}>;" +"export type FixedArrayToTupleTest = { + data: [ + string, + string, + ...string[] + ]; +};" `); }); @@ -1129,15 +1127,15 @@ describe('generateTypeDeclaration()', () => { expect(toSource(await generateTypeDeclaration(context, schema))) .toMatchInlineSnapshot(` -"export type TupleTest = NonNullable<{ - data: NonNullable, - NonNullable, - NonNullable, - NonNullable[]>, - ...NonNullable[] - ]>[]>; -}>;" +"export type TupleTest = { + data: [ + string, + number, + number, + string[], + ...boolean[] + ][]; +};" `); }); @@ -1152,9 +1150,7 @@ describe('generateTypeDeclaration()', () => { expect( toSource(await generateTypeDeclaration(context, schema)), - ).toMatchInlineSnapshot( - `"export type Unknown = NonNullable<(NonNullable | NonNullable)[]>;"`, - ); + ).toMatchInlineSnapshot(`"export type Unknown = (boolean | string)[];"`); }); test('should work with snake case parameter in query', async () => { @@ -1199,23 +1195,23 @@ describe('generateTypeDeclaration()', () => { }), ), ).toMatchInlineSnapshot(` - "declare namespace API { - export namespace Test { - export type Output = unknown; - export type Input = { - readonly foo_bar?: Parameters.FooBar; - }; - export namespace Parameters { - export type FooBar = Components.Parameters.Test0; - } - } - } - declare namespace Components { - export namespace Parameters { - export type Test0 = NonNullable; - } - }" - `); +"declare namespace API { + export namespace Test { + export type Output = unknown; + export type Input = { + readonly foo_bar?: Parameters.FooBar; + }; + export namespace Parameters { + export type FooBar = Components.Parameters.Test0; + } + } +} +declare namespace Components { + export namespace Parameters { + export type Test0 = string; + } +}" +`); }); test('should work without operation id per default', async () => { @@ -1259,22 +1255,22 @@ describe('generateTypeDeclaration()', () => { }), ), ).toMatchInlineSnapshot(` - "declare namespace API { - export namespace GetTest { - export type Output = unknown; - export type Input = { - readonly foo_bar?: Parameters.FooBar; - }; - export namespace Parameters { - export type FooBar = Components.Parameters.GetTest0; - } - } - } - declare namespace Components { - export namespace Parameters { - export type GetTest0 = NonNullable; - } - }" - `); +"declare namespace API { + export namespace GetTest { + export type Output = unknown; + export type Input = { + readonly foo_bar?: Parameters.FooBar; + }; + export namespace Parameters { + export type FooBar = Components.Parameters.GetTest0; + } + } +} +declare namespace Components { + export namespace Parameters { + export type GetTest0 = string; + } +}" +`); }); }); diff --git a/src/index.ts b/src/index.ts index 4b5d13f..0e3c2cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1011,60 +1011,41 @@ async function handleTypedSchema( schema: Schema, ): Promise { const types = schema.type instanceof Array ? schema.type : [schema.type]; - const isNullable = types.includes('null'); - const typesParameters: ts.TypeNode[] = await Promise.all( - types - .filter( - (type): type is Exclude<(typeof types)[number], 'null'> => - type !== 'null', - ) - .map(async (type) => { - switch (type) { - case 'any': - return ts.factory.createKeywordTypeNode( - ts.SyntaxKind.UnknownKeyword, - ); - case 'boolean': - return ts.factory.createKeywordTypeNode( - ts.SyntaxKind.BooleanKeyword, - ); - case 'integer': - return ts.factory.createKeywordTypeNode( - ts.SyntaxKind.NumberKeyword, - ); - case 'number': - return ts.factory.createKeywordTypeNode( - ts.SyntaxKind.NumberKeyword, - ); - case 'string': - return ts.factory.createKeywordTypeNode( - ts.SyntaxKind.StringKeyword, - ); - case 'object': - return await buildObjectTypeNode( - { ...context, candidateName: undefined }, - schema, - ); - case 'array': - return await buildArrayTypeNode( - { ...context, candidateName: undefined }, - schema, - ); - default: - throw new YError('E_BAD_TYPE', type); - } - }), + const baseTypes: ts.TypeNode[] = await Promise.all( + types.map(async (type) => { + switch (type) { + case 'null': + return ts.factory.createLiteralTypeNode(ts.factory.createNull()); + case 'any': + return ts.factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword); + case 'boolean': + return ts.factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword); + case 'integer': + return ts.factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword); + case 'number': + return ts.factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword); + case 'string': + return ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword); + case 'object': + return await buildObjectTypeNode( + { ...context, candidateName: undefined }, + schema, + ); + case 'array': + return await buildArrayTypeNode( + { ...context, candidateName: undefined }, + schema, + ); + default: + throw new YError('E_BAD_TYPE', type); + } + }), ); - const baseTypes = isNullable - ? typesParameters - : typesParameters.map((typeParameter) => - ts.factory.createTypeReferenceNode('NonNullable', [typeParameter]), - ); - // Schema also contains a composed schema, handle it as well and do a intersection with base schema if (schema.anyOf || schema.allOf || schema.oneOf) { const innerTypes = await handleComposedSchemas(context, schema); + return [ ts.factory.createIntersectionTypeNode([...baseTypes, ...innerTypes]), ];