-
-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in JSONScalar example #1647
Conversation
parse_value takes a data structure (dicts, lists and primitive types) instead of a JSON string Also updated the description
good find! @paulo-raca would you mind adding a test for the JSON example? 😊 |
Sure! |
I think we can add one! Also see this comment here, the code is slightly different 🤔 #1409 (comment) |
The default implementation of |
Thanks for adding the Here's a preview of the changelog: This release adds the following scalar types:
they can be used like so: from strawberry.scalar import Base16, Base32, Base64, JSON
@strawberry.type
class Example:
a: Base16
b: Base32
c: Base64
d: JSON Here's the preview release card for twitter: Here's the tweet text:
|
I went ahead and did the same for the Base64 example -- Turns out the PR is now far from a one-line documentation fix |
Hi 👋 You can find a preview of the docs here: |
Codecov Report
@@ Coverage Diff @@
## main #1647 +/- ##
==========================================
- Coverage 98.16% 98.14% -0.02%
==========================================
Files 129 129
Lines 4532 4540 +8
Branches 781 783 +2
==========================================
+ Hits 4449 4456 +7
Misses 43 43
- Partials 40 41 +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I've updated the release notes, I've removed the mention of the docs since they are only used for the changelog 😊
<Note> | ||
|
||
The `Base16`, `Base32` and `Base64` scalar types are available in `strawberry.scalars` | ||
|
||
```python | ||
from strawberry.scalars import Base16, Base32, Base64 | ||
``` | ||
|
||
</Note> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we add an example/reason for when to use them?
Co-authored-by: Patrick Arminio <[email protected]>
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting change requests 👍
Co-authored-by: ignormies <[email protected]>
Co-authored-by: ignormies <[email protected]>
Co-authored-by: ignormies <[email protected]>
All changes addressed 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for this! 😊
There was a bug in the JSONScalar example:
parse_value
takes a data structure (dicts/lists/primitives) instead of a JSON string, thereforejson.loads
is not necessary.This PR started as a simple fix to the documentation, however @patrick91 suggested that we also added it into strawberry sources and tests, which I have done.
While at it, I did the same for the
Base64
example -- Which I unfolded intoBase16
,Base32
andBase64
Finally, I also added support for the
specified_by_url
in scalarsTypes of Changes
Checklist