Skip to content

Commit 4ab2157

Browse files
committed
Replace union types with Enums extension
1 parent 7e0f892 commit 4ab2157

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

Containers/generate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const fs = require('fs');
22
const { exec } = require('child_process');
33

4-
// Generate the base TypeScript file from OpenAPI
5-
exec('npx openapi-typescript /app/api.json -o /app/models.ts', (error, stdout, stderr) => {
4+
// Generate the base TypeScript file from OpenAPI using the --enum flag
5+
exec('npx openapi-typescript /app/api.json -o /app/models.ts --enum', (error, stdout, stderr) => {
66
if (error) {
77
console.error('Error generating TypeScript types:', error);
88
console.error(stderr);

typescript/src/models.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ export type webhooks = Record<string, never>;
201201
export interface components {
202202
schemas: {
203203
/** @enum {string} */
204-
AccountType: "artist" | "manager" | "lawyer" | "producer" | "publisher";
204+
AccountType: AccountType;
205205
AuthenticationErrorResponseContent: {
206206
message: string;
207207
};
208208
/** @enum {string} */
209-
ContractStatus: "processing" | "complete" | "error" | "awaiting_upload";
209+
ContractStatus: ContractStatus;
210210
ContractSummaryItem: {
211211
contractId: string;
212212
name: string;
@@ -221,7 +221,7 @@ export interface components {
221221
sharedEmails?: string[];
222222
};
223223
/** @enum {string} */
224-
ContractType: "recording" | "publishing" | "management" | "producer" | "tbd";
224+
ContractType: ContractType;
225225
DeleteContractRequestContent: {
226226
contractId: string;
227227
};
@@ -845,3 +845,23 @@ export interface operations {
845845
};
846846
};
847847
}
848+
export enum AccountType {
849+
artist = "artist",
850+
manager = "manager",
851+
lawyer = "lawyer",
852+
producer = "producer",
853+
publisher = "publisher"
854+
}
855+
export enum ContractStatus {
856+
processing = "processing",
857+
complete = "complete",
858+
error = "error",
859+
awaiting_upload = "awaiting_upload"
860+
}
861+
export enum ContractType {
862+
recording = "recording",
863+
publishing = "publishing",
864+
management = "management",
865+
producer = "producer",
866+
tbd = "tbd"
867+
}

0 commit comments

Comments
 (0)