Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Fragment generation produces invalid output on fields with parameters #2306

Open
TuringJest opened this issue Feb 18, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@TuringJest
Copy link

TuringJest commented Feb 18, 2022

  • Module: graphback-cli
  • Version: 1.1.2
  • Node.js / npm versions: 16.6.1 / 8.3.0
  • Example/snippet of the model that is causing issue

"""
@model
"""
type Item {
id: ID!
itemConnection(input: ItemConnectionInput): ItemConnection!
}
input ItemConnectionInput {
id: ID!
}
type ItemConnection {
item: Item
}

I'm using graphback to generate fragments on the client. When a type has field that accepts a parameter the output unfortunately is invalid.

It's a slippery slope but it would be nice if that field is at least ignored to avoid invalid output, maybe with a warning.
Even more slippery, but if we accept that generating fragments is already a special case, then maybe we can also accept to generate variable placeholder based on the field and parameter name.

E.g. itemConnection(input: SomeType) -> fragment field: `input: $itemConnectionInput // could be enumerated, too?

It doesn't look nice to go down that road, on the other hand it can be very helpful for faster prototyping.

@TuringJest TuringJest added the bug Something isn't working label Feb 18, 2022
@TuringJest TuringJest changed the title Fragment generation produces invalid codes on fields with parameters Fragment generation produces invalid generated code on fields with parameters Feb 19, 2022
@TuringJest TuringJest changed the title Fragment generation produces invalid generated code on fields with parameters Fragment generation produces invalid output on fields with parameters Feb 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant