question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic type modifiers not respected?

See original GitHub issue

I’m trying to declare the types of my type fields using the constructors for NonNullType, StringType, etc and finding that the type modifiers (NonNullType and ListType) aren’t being respected when declaring them this way.

eg. If I use the Star Wars template example, and in line 20 of QueryType.cs change the statement from:

descriptor.Field(t => t.GetCharacter(default, default))
          .Type<NonNullType<ListType<NonNullType<CharacterType>>>>()
          .Argument("characterIds",
              a => a.Type<NonNullType<ListType<NonNullType<IdType>>>>());

to:

descriptor.Field(t => t.GetCharacter(default, default))
          .Type<NonNullType<ListType<NonNullType<CharacterType>>>>()
          .Argument("characterIds",
              a => a.Type(new NonNullType(new ListType(new NonNullType(new IdType())))));

then I see that the field definition for characterIds in Query becomes just:

character(characterIds: ID): [Character!]!

ie. the input type is ID rather than [ID!]!. I’m not sure if this is supposed to work but I note that the style appears to work for normal types (and is extremely helpful for constructing the schema dynamically), just not the modifiers.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelstaibcommented, Jun 6, 2019

we skipped 0.8.3 and I overlooked this one… I moved it to the current stream.

0reactions
michaelstaibcommented, Sep 26, 2020

We will look at dynamic Schemas after 11. We will however look at better ways to enable this. I am closing this issue and we will create a new issue lining out our idea around this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic type modifiers not respected? · Issue #689
I'm trying to declare the types of my type fields using the constructors for NonNullType, StringType, etc and finding that the type ......
Read more >
Idea: Public Access Modifier Respected in Type Definition
It is a deliberate design decision that public types do not automatically expose members without explicit access modifiers; this has been ...
Read more >
Chapter 2: Dynamic modifiers, effects, collections and ...
This is the second chapter of my guide on modifiers, explaining the underlying anatomy of the modifiers system including dynamic modifiers ...
Read more >
Jetpack Compose Tricks: Conditionally Applying Modifiers ...
Jetpack Compose Tricks: Conditionally Applying Modifiers for Dynamic UIs. Streamline your UI code. Katie Barnett.
Read more >
c# - Dynamic method access modifier
The UDPManager has certain events that can be subscribed to and I do not want them available if these events are not relevant,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found