octokit.graphql.net icon indicating copy to clipboard operation
octokit.graphql.net copied to clipboard

How to express arguments?

Open grokys opened this issue 6 years ago • 1 comments

We're currently passing arguments using standard C# parameters, but this has a couple of problems:

  1. 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.
  2. 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, null business. 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:

  1. Additions to schema no longer break our API
  2. Will no longer see null, null, null, null in expressions

Cons:

  1. Will need to generate a lot more code
  2. 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).

grokys avatar Nov 15 '18 09:11 grokys

👋 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!

github-actions[bot] avatar Dec 04 '22 02:12 github-actions[bot]