Skip to content

[Scala] Setting generateModelOpenClasses := true will lead to compile failure #583

@jxnu-liguobin

Description

@jxnu-liguobin

Issue Description

Describe your bug in detail.

For normal classes, Scala does not generate get methods for fields by default. So fields cannot be access in other methods.(This is a problem that is not in a hurry to solve)

There are two solutions:

  1. explicitly add val / var to the constructor of ordinary class.
  2. or add @BeanProperty on field.

If Java interoperability is required, the second method should be used, otherwise the first method should be used. I think the first method should be used here.

https://stackoverflow.com/questions/15639078/scala-class-constructor-parameters.

This problem is very clear and easy to solve. At the same time, Newcomes can understand some knowledge of scala compilation. I hope it can also be as a good first issue.

Your Environment and Setup

  • graphql-java-codegen version: 4.1.5-SNAPSHOT
  • Build tool: E.g.: Maven/Gradle/SBT
  • Mapping Config: E.g.:
<configuration>
    <outputDir>${project.build.directory}/generated-sources/graphql</outputDir>
    <packageName>io.github.kobylynskyi.graphql.model</packageName>
</configuration>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood-first-issueGood for newcomershelp-wantedExtra attention is neededscalaPull requests that update Scala code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions