Skip to content
New issue

Have a question about this project? Sign up for a free 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

Client Generator should respect defaults #1470

Open
paulpdaniels opened this issue Sep 26, 2022 · 0 comments
Open

Client Generator should respect defaults #1470

paulpdaniels opened this issue Sep 26, 2022 · 0 comments
Labels
client GraphQL Client module enhancement New feature or request

Comments

@paulpdaniels
Copy link
Collaborator

In the server case we obviously have limitations around being able to create type safe default values, however for the client we should be able to respect the default values (at the very least for primitives). Consider the following generated code:

input FindEmailStatusInput {
  userId: String!
  personId: ID!
  companyId: ID
  isExternalCompanyId: Boolean! = false
}
final case class FindEmailStatusInput(
  userId: String,
  personId: String,
  companyId: scala.Option[String] = None,
  isExternalCompanyId: Boolean
)

Here it should be relatively trivial to support the default parameter. For non-primitives we could ignore the, add a configuration that allows specifying how to transform them (somewhat brittle), or we could attempt to recurse through the type description and line up the fields with their declarations.

@ghostdogpr ghostdogpr added enhancement New feature or request client GraphQL Client module labels Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client GraphQL Client module enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants