10000 Exception Handling Discriminator Mapping · Issue #381 · cjbooms/fabrikt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Exception Handling Discriminator Mapping #381

New issue

Have a question about this project? Sign up for a fre 8000 e GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thejeff77 opened this issue Feb 25, 2025 · 2 comments
Open

Exception Handling Discriminator Mapping #381

thejeff77 opened this issue Feb 25, 2025 · 2 comments

Comments

@thejeff77
Copy link
thejeff77 commented Feb 25, 2025

Hey guys! Hoping you could help with this one.

I have the following exception occurring:

Error: Exception in thread "main" java.util.NoSuchElementException: List is empty.
	at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:221)
	at com.cjbooms.fabrikt.generators.PropertyUtils.addToClass(PropertyUtils.kt:144)
	at com.cjbooms.fabrikt.generators.model.ModelGenerator.addToClass(ModelGenerator.kt:716)
	at com.cjbooms.fabrikt.generators.model.ModelGenerator.buildPolymorphicSubType(ModelGenerator.kt:700)
	at com.cjbooms.fabrikt.generators.model.ModelGenerator.buildPolymorphicSubType$default(ModelGenerator.kt:668)
	at com.cjbooms.fabrikt.generators.model.ModelGenerator.polymorphicSubType(ModelGenerator.kt:666)
	at com.cjbooms.fabrikt.generators.model.ModelGenerator.buildPrimaryModel(ModelGenerator.kt:241)
	at com.cjbooms.fabrikt.generators.model.ModelGenerator.createModels(ModelGenerator.kt:184)
	at com.cjbooms.fabrikt.generators.model.ModelGenerator.generate(ModelGenerator.kt:162)
	at com.cjbooms.fabrikt.cli.CodeGenerator.models(CodeGenerator.kt:65)
	at com.cjbooms.fabrikt.cli.CodeGenerator.generateClient(CodeGenerator.kt:55)
	at com.cjbooms.fabrikt.cli.CodeGenerator.generateCode(CodeGenerator.kt:36)
	at com.cjbooms.fabrikt.cli.CodeGenerator.generate(CodeGenerator.kt:32)
	at com.cjbooms.fabrikt.cli.CodeGen.generate(CodeGen.kt:84)
	at com.cjbooms.fabrikt.cli.CodeGen.main(CodeGen.kt:22)
Error: Process completed with exit code 1.

Checking the fabrikt generator, it happens within this function on line 144 in PropertyUtils.kt

Image

I verified that my spec file doesn't have discriminators with only one value in them. Obfuscated it looks like:

        "discriminator" : {
          "propertyName" : "something",
          "mapping" : {
            "ABUG" : "#/components/schemas/Bug",
            "INARUG" : "#/components/schemas/Rug"
          }
        }

So it looks like a discriminator exists and the .first() function is not finding it on line 144, I don't know why this would occur.

If you'd like I can email the whole spec file to someone, or you can email me to request it.

@ulrikandersen
Copy link
Collaborator
ulrikandersen commented Feb 26, 2025

Send it here and I can take a look: values.skylark-8x[at]icloud[dot]com.

@thejeff77
Copy link
Author
thejeff77 commented Feb 26, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0