Code Monkey home page Code Monkey logo

Comments (10)

srinivasankavitha avatar srinivasankavitha commented on July 19, 2024

The generated types already come with a builder. We don't plan to support additional builders since this is not a common use case for us.

from dgs-codegen.

SaranSundar avatar SaranSundar commented on July 19, 2024

@srinivasankavitha Could you give an example of how to use the builder? I don't see anything in Intellijs auto complete or on the docs.

from dgs-codegen.

srinivasankavitha avatar srinivasankavitha commented on July 19, 2024

If I understand correctly, you are referring to building the generated POJOs, correct? If you take a look at one of the generated classes, you would see a builder for each class.

from dgs-codegen.

SaranSundar avatar SaranSundar commented on July 19, 2024

This is for the generated POJO, but when looking at the generated type i don't see a builder, in Intellij nothing also comes up in the auto complete for making a builder

import com.fasterxml.jackson.`annotation`.JsonProperty
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.collections.List

public data class InterviewIG(
  @JsonProperty("id")
  public val id: Int,
  @JsonProperty("employer")
  public val employer: Employer? = null,
  @JsonProperty("userQuestions")
  public val userQuestions: List<InterviewUserQuestionIG?>? = null,
  @JsonProperty("employerResponses")
  public val employerResponses: List<InterviewEmployerResponse?>? = null,
  /**
   * Link building is resolved by the ui using seo central
   */
  @JsonProperty("links")
  public val links: EiInterviewLinks? = null,
) {
  public companion object
}

from dgs-codegen.

srinivasankavitha avatar srinivasankavitha commented on July 19, 2024

What do you mean by generated type?

from dgs-codegen.

SaranSundar avatar SaranSundar commented on July 19, 2024

Sorry I mean in my schema I'll have a type called

type InterviewIG and when generated it will have the code above, but I don't see a builder anywhere

from dgs-codegen.

srinivasankavitha avatar srinivasankavitha commented on July 19, 2024

Ah ok, this is for kotlin. We generate builders for Java classes. For kotlin, they are generated as data classes, so easy enough to instantiate them since you have named arguments and default values.

from dgs-codegen.

SaranSundar avatar SaranSundar commented on July 19, 2024

Oh is there a way to configure the code Gen to generate Java classes instead of kotlin, I didn't know that was an option it's just always been generating kotlin for me.

from dgs-codegen.

srinivasankavitha avatar srinivasankavitha commented on July 19, 2024

from dgs-codegen.

SaranSundar avatar SaranSundar commented on July 19, 2024

Ah ok thanks I'll give that a try. I think having a builder is more useful then a data class because it allows you to more easily spread the construction of the object given various conditions throughout a method vs needing all the variables in one place.

from dgs-codegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.