You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it { is_expected.to have_field(:isPublished).of_type("Boolean") }
The string notation of GQL types has it place, but I'd suggest something different:
it {
is_expected
.to have_field(:isPublished)
.of_type(GraphQL::Types::Boolean)
.exposed_as("Boolean")
}
This way you can do both:
Make an explicit specification that this field is of this BE type, and
Make an explicit specification that this field's type is exposed as a type understandable by FE GQL lib.
For example, if I changed the graphql_name of my type, the exposed_as would fail, but of_type would not. Giving you a better picture of what's happening.
I know it's a radical change for a gen that has a version 2 already coming, but I love to discuss this.
Maybe to keep the syntax more stable:
it {
is_expected
.to have_field(:isPublished)
.of_type("Boolean")
.implemented_with(GraphQL::Types::Boolean)
}
The text was updated successfully, but these errors were encountered:
@Pawlik thanks for the suggestion. A syntax such as the one you proposed last is definitely doable, as it'd be fully backwards compatible. I haven't been actively developing this gem lately, but I'll gladly accept a PR ;)
Hey @khamusa, excellent idea!
I see a one problem with the current approach:
The string notation of GQL types has it place, but I'd suggest something different:
This way you can do both:
For example, if I changed the
graphql_name
of my type, theexposed_as
would fail, butof_type
would not. Giving you a better picture of what's happening.I know it's a radical change for a gen that has a version 2 already coming, but I love to discuss this.
Maybe to keep the syntax more stable:
The text was updated successfully, but these errors were encountered: