Skip to content

Commit 94cf5fe

Browse files
committed
test(enum-values): fix options > enumValues
1 parent 4243602 commit 94cf5fe

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/openapi-typescript/test/node-api.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,14 +830,17 @@ export interface components {
830830
pathItems: never;
831831
}
832832
export type $defs = Record<string, never>;
833+
type FlattenedDeepRequired<T> = {
834+
[K in keyof T]-?: FlattenedDeepRequired<T[K] extends unknown[] | undefined | null ? Extract<T[K], unknown[]>[number] : T[K]>;
835+
};
833836
type ReadonlyArray<T> = [
834837
Exclude<T, undefined>
835838
] extends [
836839
unknown[]
837840
] ? Readonly<Exclude<T, undefined>> : Readonly<Exclude<T, undefined>[]>;
838-
export const pathsUrlGetParametersQueryStatusValues: ReadonlyArray<paths["/url"]["get"]["parameters"]["query"]["status"]> = ["active", "inactive"];
839-
export const statusValues: ReadonlyArray<components["schemas"]["Status"]> = ["active", "inactive"];
840-
export const errorCodeValues: ReadonlyArray<components["schemas"]["ErrorCode"]> = [100, 101, 102, 103, 104, 105];
841+
export const pathsUrlGetParametersQueryStatusValues: ReadonlyArray<FlattenedDeepRequired<paths>["/url"]["get"]["parameters"]["query"]["status"]> = ["active", "inactive"];
842+
export const statusValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["Status"]> = ["active", "inactive"];
843+
export const errorCodeValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["ErrorCode"]> = [100, 101, 102, 103, 104, 105];
841844
export type operations = Record<string, never>;`,
842845
options: { enumValues: true },
843846
},

0 commit comments

Comments
 (0)