Skip to content

Set discriminators types before other types than enums #2535

Set discriminators types before other types than enums

Set discriminators types before other types than enums #2535

Triggered via pull request September 8, 2025 13:54
Status Failure
Total duration 1m 15s
Artifacts

main.yml

on: pull_request
Matrix: build-and-test
Fit to window
Zoom out
Zoom in

Annotations

9 errors
build-and-test (24)
Process completed with exit code 1.
tests/spec/enumNotFirstInComponents/basic.test.ts > basic > enum not first in components: tests/spec/enumNotFirstInComponents/basic.test.ts#L31
Error: Snapshot `basic > enum not first in components 1` mismatched - Expected + Received @@ -13,27 +13,27 @@ export enum ExampleEnum { Example1 = "Example1", Example2 = "Example2", } - export interface DtoExample1 { - name: string; - age: number; - toto?: DtoExample2; - } - - export interface DtoExample2 { - title: string; - description: string; - } - export type ExampleObject = BaseExampleObject & ( | BaseExampleObjectTypeMapping<ExampleEnum.Example1, DtoExample1> | BaseExampleObjectTypeMapping<ExampleEnum.Example2, DtoExample2> ); + export interface DtoExample1 { + name: string; + age: number; + toto?: DtoExample2; + } + + export interface DtoExample2 { + title: string; + description: string; + } + interface BaseExampleObject { type?: ExampleEnum; } type BaseExampleObjectTypeMapping<Key, Type> = { ❯ tests/spec/enumNotFirstInComponents/basic.test.ts:31:21
tests/spec/discriminator/basic.test.ts > basic > discriminator: tests/spec/discriminator/basic.test.ts#L32
Error: Snapshot `basic > discriminator 1` mismatched - Expected + Received @@ -20,59 +20,46 @@ Csv = "csv", File = "file", Kek = "kek", } - export type SimpleDiscriminator = SimpleObject | ComplexObject; - - export interface SimpleObject { - objectType: string; - } - - export interface ComplexObject { - objectType: string; - } - - export type BlockDTOWithEnum = BaseBlockDtoWithEnum & - ( - | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.Csv, CsvBlockWithEnumDTO> - | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.File, FileBlockWithEnumDTO> - ); - - export type CsvBlockWithEnumDTO = BaseBlockDtoWithEnum & { + /** kek pek */ + export type Variant = + | ({ + type: "update"; + } & VariantUpdate) + | ({ + type: "undo"; + } & VariantUndo) + | ({ + type: "rollback"; + } & VariantRollback) + | ({ + type: "scale"; + } & VariantScale) + | ({ - type: BlockDTOEnum.Csv; - text: string; - }; - - export type FileBlockWithEnumDTO = BaseBlockDtoWithEnum & { - type: BlockDTOEnum.File; - fileId: string; - }; - - export type BlockDTO = BaseBlockDto & + type: "resources"; + } & VariantResources) + | ({ + type: "firewall"; + } & VariantFirewall) + | ({ + type: "gateway"; + } & VariantGateway); + + export type InvalidDiscriminatorPropertyName = + BaseInvalidDiscriminatorPropertyName & - ( + ( - | BaseBlockDtoTypeMapping<"csv", CsvBlockDTO> - | BaseBlockDtoTypeMapping<"file", FileBlockDTO> + | BaseInvalidDiscriminatorPropertyNameTypeMapping<"num", number> - ); - - export type CsvBlockDTO = BaseBlockDto & { - /** @default "csv" */ - type: "csv"; - text: string; - }; - - export type FileBlockDTO = BaseBlockDto & { - /** @default "file" */ - type: "file"; - fileId: string; - }; + | BaseInvalidDiscriminatorPropertyNameTypeMapping<"str", string> + ); - export type Pet = BasePet & + export type PetWithEnum = BasePetWithEnum & ( - | BasePetPetTypeMapping<"dog", Dog> + | BasePetWithEnumPetTypeMapping<PetEnum.Dog, DogWithEnum> - | BasePetPetTypeMapping<"cat", Cat> + | BasePetWithEnumPetTypeMapping<PetEnum.Cat, CatWithEnum> - | BasePetPetTypeMapping<"lizard", Lizard> + | BasePetWithEnumPetTypeMapping<PetEnum.Lizard, LizardWithEnum> ); export type PetOnlyDiscriminator = | ({ pet_type: "dog"; @@ -82,71 +69,84 @@ } & Cat) | ({ pet_type: "lizard"; } & Lizard); - export type Cat = BasePet & { - name?: string; - }; - - export type Dog = BasePet & { - bark?: string; - }; - - export type Lizard = BasePet & { - lovesRocks?: boolean; - }; + export type Pet = BasePet & + ( + | BasePetPetTypeMapping<"dog", Dog> + | BasePetPetTypeMapping<"cat", Cat> + | BasePetPetTypeMapping<"lizard", Lizard> + ); + + export type BlockDTO = BaseBlockDto & + ( + | BaseBlockDtoTypeMapping<"csv", CsvBlockDTO> + | BaseBlockDtoTypeMapping<"file", FileBlockDTO> + ); - export type PetWithEnum = BasePetWithEnum & + export type BlockDTOWithEnum = BaseBlockDtoWithEnum & ( - | BasePetWithEnumPetTypeMapping<PetEnum.Dog, DogWithEnum> + | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.Csv, CsvBlockWithEnumDTO> - | BasePetWithEnumPetTypeMapping<PetEnum.Cat, CatWithEnum> + | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.File, FileBlockWithEnumDTO> - | BasePetWithEnumPetTypeMapping<PetEnum.Lizard, LizardWithEnum> - ); - - export type CatWithEnum = BasePetWithEnum & { - name?: string; + ); + + export type SimpleDiscriminator = SimpleObject | ComplexObject; + + export interface SimpleObject { + objectType: string; + } + + export interface ComplexObject { + objectType: string; - }; + } - export type DogWithEnum = BasePetWithEnum & { + export type CsvBlockWithEnumDTO = BaseBlockDtoWithEnum & { - bark?: string; + type: BlockDTOEnum.Csv; + text: string; }; - export type LizardWithEnum = BasePetWithEnum & { + export type FileBlockWithEnumDTO = BaseBlockDtoWithEnum & { - lovesRocks?: boolean; -
build-and-test (22)
Process completed with exit code 1.
tests/spec/enumNotFirstInComponents/basic.test.ts > basic > enum not first in components: tests/spec/enumNotFirstInComponents/basic.test.ts#L31
Error: Snapshot `basic > enum not first in components 1` mismatched - Expected + Received @@ -13,27 +13,27 @@ export enum ExampleEnum { Example1 = "Example1", Example2 = "Example2", } - export interface DtoExample1 { - name: string; - age: number; - toto?: DtoExample2; - } - - export interface DtoExample2 { - title: string; - description: string; - } - export type ExampleObject = BaseExampleObject & ( | BaseExampleObjectTypeMapping<ExampleEnum.Example1, DtoExample1> | BaseExampleObjectTypeMapping<ExampleEnum.Example2, DtoExample2> ); + export interface DtoExample1 { + name: string; + age: number; + toto?: DtoExample2; + } + + export interface DtoExample2 { + title: string; + description: string; + } + interface BaseExampleObject { type?: ExampleEnum; } type BaseExampleObjectTypeMapping<Key, Type> = { ❯ tests/spec/enumNotFirstInComponents/basic.test.ts:31:21
tests/spec/discriminator/basic.test.ts > basic > discriminator: tests/spec/discriminator/basic.test.ts#L32
Error: Snapshot `basic > discriminator 1` mismatched - Expected + Received @@ -20,59 +20,46 @@ Csv = "csv", File = "file", Kek = "kek", } - export type SimpleDiscriminator = SimpleObject | ComplexObject; - - export interface SimpleObject { - objectType: string; - } - - export interface ComplexObject { - objectType: string; - } - - export type BlockDTOWithEnum = BaseBlockDtoWithEnum & - ( - | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.Csv, CsvBlockWithEnumDTO> - | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.File, FileBlockWithEnumDTO> - ); - - export type CsvBlockWithEnumDTO = BaseBlockDtoWithEnum & { + /** kek pek */ + export type Variant = + | ({ + type: "update"; + } & VariantUpdate) + | ({ + type: "undo"; + } & VariantUndo) + | ({ + type: "rollback"; + } & VariantRollback) + | ({ + type: "scale"; + } & VariantScale) + | ({ - type: BlockDTOEnum.Csv; - text: string; - }; - - export type FileBlockWithEnumDTO = BaseBlockDtoWithEnum & { - type: BlockDTOEnum.File; - fileId: string; - }; - - export type BlockDTO = BaseBlockDto & + type: "resources"; + } & VariantResources) + | ({ + type: "firewall"; + } & VariantFirewall) + | ({ + type: "gateway"; + } & VariantGateway); + + export type InvalidDiscriminatorPropertyName = + BaseInvalidDiscriminatorPropertyName & - ( + ( - | BaseBlockDtoTypeMapping<"csv", CsvBlockDTO> - | BaseBlockDtoTypeMapping<"file", FileBlockDTO> + | BaseInvalidDiscriminatorPropertyNameTypeMapping<"num", number> - ); - - export type CsvBlockDTO = BaseBlockDto & { - /** @default "csv" */ - type: "csv"; - text: string; - }; - - export type FileBlockDTO = BaseBlockDto & { - /** @default "file" */ - type: "file"; - fileId: string; - }; + | BaseInvalidDiscriminatorPropertyNameTypeMapping<"str", string> + ); - export type Pet = BasePet & + export type PetWithEnum = BasePetWithEnum & ( - | BasePetPetTypeMapping<"dog", Dog> + | BasePetWithEnumPetTypeMapping<PetEnum.Dog, DogWithEnum> - | BasePetPetTypeMapping<"cat", Cat> + | BasePetWithEnumPetTypeMapping<PetEnum.Cat, CatWithEnum> - | BasePetPetTypeMapping<"lizard", Lizard> + | BasePetWithEnumPetTypeMapping<PetEnum.Lizard, LizardWithEnum> ); export type PetOnlyDiscriminator = | ({ pet_type: "dog"; @@ -82,71 +69,84 @@ } & Cat) | ({ pet_type: "lizard"; } & Lizard); - export type Cat = BasePet & { - name?: string; - }; - - export type Dog = BasePet & { - bark?: string; - }; - - export type Lizard = BasePet & { - lovesRocks?: boolean; - }; + export type Pet = BasePet & + ( + | BasePetPetTypeMapping<"dog", Dog> + | BasePetPetTypeMapping<"cat", Cat> + | BasePetPetTypeMapping<"lizard", Lizard> + ); + + export type BlockDTO = BaseBlockDto & + ( + | BaseBlockDtoTypeMapping<"csv", CsvBlockDTO> + | BaseBlockDtoTypeMapping<"file", FileBlockDTO> + ); - export type PetWithEnum = BasePetWithEnum & + export type BlockDTOWithEnum = BaseBlockDtoWithEnum & ( - | BasePetWithEnumPetTypeMapping<PetEnum.Dog, DogWithEnum> + | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.Csv, CsvBlockWithEnumDTO> - | BasePetWithEnumPetTypeMapping<PetEnum.Cat, CatWithEnum> + | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.File, FileBlockWithEnumDTO> - | BasePetWithEnumPetTypeMapping<PetEnum.Lizard, LizardWithEnum> - ); - - export type CatWithEnum = BasePetWithEnum & { - name?: string; + ); + + export type SimpleDiscriminator = SimpleObject | ComplexObject; + + export interface SimpleObject { + objectType: string; + } + + export interface ComplexObject { + objectType: string; - }; + } - export type DogWithEnum = BasePetWithEnum & { + export type CsvBlockWithEnumDTO = BaseBlockDtoWithEnum & { - bark?: string; + type: BlockDTOEnum.Csv; + text: string; }; - export type LizardWithEnum = BasePetWithEnum & { + export type FileBlockWithEnumDTO = BaseBlockDtoWithEnum & { - lovesRocks?: boolean; -
build-and-test (20)
Process completed with exit code 1.
tests/spec/enumNotFirstInComponents/basic.test.ts > basic > enum not first in components: tests/spec/enumNotFirstInComponents/basic.test.ts#L31
Error: Snapshot `basic > enum not first in components 1` mismatched - Expected + Received @@ -13,27 +13,27 @@ export enum ExampleEnum { Example1 = "Example1", Example2 = "Example2", } - export interface DtoExample1 { - name: string; - age: number; - toto?: DtoExample2; - } - - export interface DtoExample2 { - title: string; - description: string; - } - export type ExampleObject = BaseExampleObject & ( | BaseExampleObjectTypeMapping<ExampleEnum.Example1, DtoExample1> | BaseExampleObjectTypeMapping<ExampleEnum.Example2, DtoExample2> ); + export interface DtoExample1 { + name: string; + age: number; + toto?: DtoExample2; + } + + export interface DtoExample2 { + title: string; + description: string; + } + interface BaseExampleObject { type?: ExampleEnum; } type BaseExampleObjectTypeMapping<Key, Type> = { ❯ tests/spec/enumNotFirstInComponents/basic.test.ts:31:21
tests/spec/discriminator/basic.test.ts > basic > discriminator: tests/spec/discriminator/basic.test.ts#L32
Error: Snapshot `basic > discriminator 1` mismatched - Expected + Received @@ -20,59 +20,46 @@ Csv = "csv", File = "file", Kek = "kek", } - export type SimpleDiscriminator = SimpleObject | ComplexObject; - - export interface SimpleObject { - objectType: string; - } - - export interface ComplexObject { - objectType: string; - } - - export type BlockDTOWithEnum = BaseBlockDtoWithEnum & - ( - | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.Csv, CsvBlockWithEnumDTO> - | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.File, FileBlockWithEnumDTO> - ); - - export type CsvBlockWithEnumDTO = BaseBlockDtoWithEnum & { + /** kek pek */ + export type Variant = + | ({ + type: "update"; + } & VariantUpdate) + | ({ + type: "undo"; + } & VariantUndo) + | ({ + type: "rollback"; + } & VariantRollback) + | ({ + type: "scale"; + } & VariantScale) + | ({ - type: BlockDTOEnum.Csv; - text: string; - }; - - export type FileBlockWithEnumDTO = BaseBlockDtoWithEnum & { - type: BlockDTOEnum.File; - fileId: string; - }; - - export type BlockDTO = BaseBlockDto & + type: "resources"; + } & VariantResources) + | ({ + type: "firewall"; + } & VariantFirewall) + | ({ + type: "gateway"; + } & VariantGateway); + + export type InvalidDiscriminatorPropertyName = + BaseInvalidDiscriminatorPropertyName & - ( + ( - | BaseBlockDtoTypeMapping<"csv", CsvBlockDTO> - | BaseBlockDtoTypeMapping<"file", FileBlockDTO> + | BaseInvalidDiscriminatorPropertyNameTypeMapping<"num", number> - ); - - export type CsvBlockDTO = BaseBlockDto & { - /** @default "csv" */ - type: "csv"; - text: string; - }; - - export type FileBlockDTO = BaseBlockDto & { - /** @default "file" */ - type: "file"; - fileId: string; - }; + | BaseInvalidDiscriminatorPropertyNameTypeMapping<"str", string> + ); - export type Pet = BasePet & + export type PetWithEnum = BasePetWithEnum & ( - | BasePetPetTypeMapping<"dog", Dog> + | BasePetWithEnumPetTypeMapping<PetEnum.Dog, DogWithEnum> - | BasePetPetTypeMapping<"cat", Cat> + | BasePetWithEnumPetTypeMapping<PetEnum.Cat, CatWithEnum> - | BasePetPetTypeMapping<"lizard", Lizard> + | BasePetWithEnumPetTypeMapping<PetEnum.Lizard, LizardWithEnum> ); export type PetOnlyDiscriminator = | ({ pet_type: "dog"; @@ -82,71 +69,84 @@ } & Cat) | ({ pet_type: "lizard"; } & Lizard); - export type Cat = BasePet & { - name?: string; - }; - - export type Dog = BasePet & { - bark?: string; - }; - - export type Lizard = BasePet & { - lovesRocks?: boolean; - }; + export type Pet = BasePet & + ( + | BasePetPetTypeMapping<"dog", Dog> + | BasePetPetTypeMapping<"cat", Cat> + | BasePetPetTypeMapping<"lizard", Lizard> + ); + + export type BlockDTO = BaseBlockDto & + ( + | BaseBlockDtoTypeMapping<"csv", CsvBlockDTO> + | BaseBlockDtoTypeMapping<"file", FileBlockDTO> + ); - export type PetWithEnum = BasePetWithEnum & + export type BlockDTOWithEnum = BaseBlockDtoWithEnum & ( - | BasePetWithEnumPetTypeMapping<PetEnum.Dog, DogWithEnum> + | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.Csv, CsvBlockWithEnumDTO> - | BasePetWithEnumPetTypeMapping<PetEnum.Cat, CatWithEnum> + | BaseBlockDtoWithEnumTypeMapping<BlockDTOEnum.File, FileBlockWithEnumDTO> - | BasePetWithEnumPetTypeMapping<PetEnum.Lizard, LizardWithEnum> - ); - - export type CatWithEnum = BasePetWithEnum & { - name?: string; + ); + + export type SimpleDiscriminator = SimpleObject | ComplexObject; + + export interface SimpleObject { + objectType: string; + } + + export interface ComplexObject { + objectType: string; - }; + } - export type DogWithEnum = BasePetWithEnum & { + export type CsvBlockWithEnumDTO = BaseBlockDtoWithEnum & { - bark?: string; + type: BlockDTOEnum.Csv; + text: string; }; - export type LizardWithEnum = BasePetWithEnum & { + export type FileBlockWithEnumDTO = BaseBlockDtoWithEnum & { - lovesRocks?: boolean; -