kowainik / github-graphql

πŸ•ΈοΈ GraphQL bindings to GitHub API
https://kowainik.github.io/projects/github-graphql
Mozilla Public License 2.0
7 stars 0 forks source link

[#10] Implement lens API for setting query args #21

Closed chshersh closed 3 years ago

chshersh commented 3 years ago

Resolves #10

It works! The errors messages are on the screenshot below: Screenshot from 2021-01-05 16-48-31

Currently, I've implemented this only for the Repository type, but it's the same pattern for the IssuesArgs and PullRequestsArgs. It looks a bit complicated, so, @vrom911, please review and let me know if we should proceed with this πŸ™‚

I think, the quality of our custom error messages can be really great! So, in the same spirit, any suggestions to improving error messages are appreciated. For example, one alternative more verbose error message:

You haven't set some of the required fields of 'RepositoryArgs'.
Typically, you set values of this type using lenses:

    defRepositoryArgs
    & set ownerL "owner-name"
    & set nameL "repository-name"

Use corresponding lenses to set the following missing fields:

    * name
        Lens: nameL (from GitHub.Lens.HasOwnerName)

I recommend to start review from the GitHub.Lens module, then GitHub.Issues and GitHub.PullRequests, and then GitHub.Repository.

chshersh commented 3 years ago

Addressed review comments. Still need to implement custom error messages for IssuesArgs and PullRequestsArgs...