8000 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
Open
@thejeff77

Description

@thejeff77

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0