octokit.graphql.net
octokit.graphql.net copied to clipboard
How to express arguments?
We're currently passing arguments using standard C# parameters, but this has a couple of problems:
- Since #166, the arguments are now sorted by name. This means if an argument is added to the schema, it could show up in the middle of existing arguments breaking our API.
- In theory we can use named arguments (which would also solve 1) but in reality we often can't because C# expressions don't support named arguments, leading to some horrible
null, null, null, nullbusiness. And because of this, adding an argument to the schema is a breaking change.
@StanleyGoldman suggested doing something like this instead:
Repository(x => x.Owner("Owner").Name("Name"))
Pros:
- Additions to schema no longer break our API
- Will no longer see
null, null, null, nullin expressions
Cons:
- Will need to generate a lot more code
- Moves us further away from looking like "just C#" code
I was originally against this idea because of the cons above, but I'm starting to think the pros outweigh the cons, especially given that it looks like C#'s expression support isn't going to be improved anytime soon (despite some proposals).
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!