patrick.wtf

šŸ“

Open-source updates - 15 August 2021

Open-source updates - 15 August 2021

This week Iā€™ve spent some time fixing a couple of issues on the Twitter workflow for Strawberry. Iā€™ve also reviewed some PRs for Strawberry and Strawberry Django and made a small bug-fix. Oh and Iā€™ve also added a feedback form for Strawberryā€™s docs.

Feedback form

I think this is probably the most interesting thing that Iā€™ve worked on this week. We were discussing documentation on our discord server (we still have loads to do to improve it) and Hannes suggested to implement a feedback form so we can understand what the pain points of our docs.

Iā€™ve implemented a basic form that can be used to send us some feedback about our documentation. Hopefully this helps with prioritising docs that are confusing/missing/lacking. Weā€™ll see!

I was also thinking of doing some one on one session with people using Strawberry and see how they use the library, to make sure the documentation is well understood and to see if we can make it even easier to use. If youā€™re interested in doing something like this let me know!

Code reviews

Iā€™ve spent a bit of time review a few PRs on both Strawberry and Strawberry Django. Hopefully the backlog will decrease over time.

Markā€™s PR is adding support for Chalice. You can see it here: https://github.com/strawberry-graphql/strawberry/pull/923

I did a merge with the main branch but something broke with MyPy. Iā€™ll fix this either after publishing these notes or the day after. Then it should be ready to merge :)

Jonā€™s PR is another great addition to Strawberry and it will allow to override default scalars and define new scalars on a per-schema basis. The PR looks great, but thereā€™s a couple of things to sort out before merging.

You can see the PR here: https://github.com/strawberry-graphql/strawberry/pull/1147

The last PR I reviewed is from Vojtěch Dohnal and it aims to make Strawberry Django compatibile with the latest version of Strawberry. We did a lot of internal changes, so unfortunately we broke compatibility with Strawberry Django. The PR looks great and I think Iā€™ll merge and release in the next couple of days, just want to make sure the main maintainer of Strawberry Django is happy with the changes.

PR: https://github.com/strawberry-graphql/strawberry-graphql-django/pull/50

Duck typing fixes

Iā€™ve also managed to make some time to fix a bug that prevented returning non-strawberry types in resolvers where the field type was extending an interface.

Strawberry supports duck typing, meaning you donā€™t have to return instances of a Strawberry types from resolvers as long as the shape matches. Unfortunately this is broken for types that extend interface. Iā€™ve made a PR to fix this, but I need to double check the code is actually sound.

In future we also want to enable returning dictionaries in resolvers; sometimes it is pointless to convert a dictionary (ie from a db or api) into a Strawberry type if the shape is the same.

PR: https://github.com/strawberry-graphql/strawberry/pull/1150

Selected fields on the info parameter

Aric Coady made a very useful PR a while ago and I finally managed to merge it this week. It adds better support for finding out what fields have been selected in a GraphQL query. You could use this to optimise GraphQL queries for example.

PR: https://github.com/strawberry-graphql/strawberry/pull/874/

Bug fixes in the tweet workflow

There were a couple of issues with the tweet workflow I made last week, for example the contributor name in the preview comment was always the name of the last person that had sent a commit to that PR, which is not what I wanted; maybe in future we need to work with multiple contributors on PRs, but for now this is good enough.

In addition to that the workflow wasnā€™t really working when non-core dev were sending PRs since the GITHUB_TOKEN wasnā€™t passed the workflow, switching the workflow from pull_request to pull_request_target fixed the issue. Thanks to Bryce for the tip!

This also means I can fix the workflow for releasing docs in the same way!

PRs: https://github.com/strawberry-graphql/strawberry/pull/1140 https://github.com/strawberry-graphql/strawberry/pull/1136

Fin

This week I managed to review some long standing PRs, thereā€™s definitely more work to do. I hope next week I manage to review more. Weā€™ll see. I also have some new ideas for other features and projects related to Strawberry, but I donā€™t have much to share for the time being. Stay tuned for more in future!


Written at home šŸ˜Š

Webmentions