Skip to content

No way to initialize String with values from json as default values?#436

Description

@Kuros85Ya

Hello!
We use this plugin to generate models during tests automation, and sometimes the goal is to input an object into code from json that manual tester has already created and filled with proper data. So it would be useful to be able to take json from manual tester, fill every field with already added values and then for example parametrize on or two of them, by inititalizing data class with new values.

So I expertimented a lot with plugin but couldn't find a way to fill strings and other field with default values taken from json.
It always inits them with empty strings, the only thing it does to help to fullflill this tasks - there is an option to see values from json as comments to the fields.

Example:
JSON:

{
    a: "TestValue1",
    b: "TestValue2"
}

Current output:

data class Test(
    val a: String? = "", // TestValue1
    val b: String? = "" // TestValue2
)

What I'm trying to get:

data class Test(
    val a: String? = "TestValue1",
    val b: String? = "TestValue2"
)

I there any option to do so?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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