Comments (8)
I'm an idiot. 😄
from graphene-django-extras.
Thanks for notifying, could you explain better what this bug consists of? Thank you
from graphene-django-extras.
Thank you for merging this!
The bug is from the downstream dependency graphql-core, a dependency of graphql-python. The problem is every Enum that has a blank value in the database errors in responses:
"errors": [
{
"message": "Expected a value of type \"RoomAreaUnitsEnum\" but received: ",
"path": [
"room_create",
"rooms",
0,
"area_units"
]
},
{
"message": "Expected a value of type \"RoomAreaUnitsEnum\" but received: ",
"path": [
"room_create",
"rooms",
1,
"area_units"
]
},
{
"message": "Expected a value of type \"RoomAreaUnitsEnum\" but received: ",
"path": [
"room_create",
"rooms",
2,
"area_units"
]
},
{
"message": "Expected a value of type \"RoomAreaUnitsEnum\" but received: ",
"path": [
"room_create",
"rooms",
3,
"area_units"
]
},
{
"message": "Expected a value of type \"RoomAreaUnitsEnum\" but received: ",
"path": [
"room_create",
"rooms",
4,
"area_units"
]
}
],
"data": {
"room_create": {
"rooms": [
{
"id": "513c098c-0935-453d-8ae6-b0abb9283d05",
"area": 200,
"area_units": null,
"departments": [],
"level": {
"id": "dbff6c55-f7d5-467b-9bc5-47c3aa63b9d9",
"name": "Level 1"
},
"name": "Room creation (1)",
"number": "",
"need_by": "2019-01-01",
"signage": ""
},
{
"id": "dfdb4a5e-8c29-4b0e-a7a6-83f2fc5d2b2e",
"area": 200,
"area_units": null,
"departments": [],
"level": {
"id": "dbff6c55-f7d5-467b-9bc5-47c3aa63b9d9",
"name": "Level 1"
},
"name": "Room creation (2)",
"number": "",
"need_by": "2019-01-01",
"signage": ""
},
{
"id": "3f25332a-f160-4671-bbb6-d94e627843b4",
"area": 200,
"area_units": null,
"departments": [],
"level": {
"id": "dbff6c55-f7d5-467b-9bc5-47c3aa63b9d9",
"name": "Level 1"
},
"name": "Room creation (3)",
"number": "",
"need_by": "2019-01-01",
"signage": ""
},
{
"id": "9366e27d-f5f9-4776-9969-b7bd7112af37",
"area": 200,
"area_units": null,
"departments": [],
"level": {
"id": "dbff6c55-f7d5-467b-9bc5-47c3aa63b9d9",
"name": "Level 1"
},
"name": "Room creation (4)",
"number": "",
"need_by": "2019-01-01",
"signage": ""
},
{
"id": "cbebdc1b-2582-4aa7-9f3f-c6e1d9646203",
"area": 200,
"area_units": null,
"departments": [],
"level": {
"id": "dbff6c55-f7d5-467b-9bc5-47c3aa63b9d9",
"name": "Level 1"
},
"name": "Room creation (5)",
"number": "",
"need_by": "2019-01-01",
"signage": ""
}
],
"ok": true,
"errors": null
}
}
}
So for each resource that has a blank area_units, it has an error. We can still get data back but our frontend looks for the errors and displays them for us, and it's noise - before Monday of last week, the blank values were not a problem. With area_units we can create a default, but there are other enums that we want to have as blank values.
from graphene-django-extras.
So, this pinning the packages did not actually fix the problem as expected. Not sure exactly what to do about it now. I will think on this.
from graphene-django-extras.
I'm sorry I made a mistake. My branch I did a PR with was my half-done testing branch with examples, not the freeze packages PR I meant to send in.
I am creating another PR with the real changes that need to be made.
Oops!
Will continue the testing branch soon, but in the meantime, I will post a freeze-packages PR soon.
from graphene-django-extras.
Hello @atomboulian, thanks again for writing, I've been absent a few days, but I plan today or tomorrow to start working on a big new version, which will contain great improvements and new features, as well as the fix of all pending bugs reported, including this one too
from graphene-django-extras.
Wow! Please keep me posted. If there's anything that I can help with that's small, I would love love love the chance to contribute.
Specifically, we would like to do more with DRF serialization for serializers other than the ModelSerializer (and not require the model in Meta).
Thanks for writing! and thank you for the open dialogue. I would like to continue this.
from graphene-django-extras.
I'm having the exact same issue and wasn't able to fix it with many provided solutions.
This happens with any CharField with choices where graphene generates Enum for them.
However, in this case a blank/empty string will cause this error, but null
values don't.
My solution was to just to set all the blank values in database to NULL
.
To be honest it makes sense for a field that accepts a limited amount of options/choice to either have one of the options or save as NULL
, a blank is also an string, an empty one.
Anyway, such issue I think can be handled in 2 ways:
- If a a choice field has blank field, just return
None
(it can lead to confusion for sure.) - silent graphene when seeing a Field.blank=True while being a choice-field/enum. (much better route to solve the issue.)
from graphene-django-extras.
Related Issues (20)
- Dynamic Schema generation
- Travis rewrite to GitHub Actions HOT 2
- TODO
- Tried installing graphene-django-extras, but get errors about incompatibility HOT 3
- ImportError: cannot import name 'force_text' from 'django.utils.encoding' HOT 1
- Regarding UnionTypes
- Pagination Total Count HOT 7
- When using a model with a UUID Field as ID the update method does not provide a UUID Field HOT 1
- No type registered for model: <model>
- Getting duplicate results on a filter across multiple fields. Cannot add distinct.
- still maintained? HOT 5
- python error: can only concatenate list (not "tuple") to list in __init__.py
- Updates removing other fields if not supplied: Might not be specific to graphene-django-extras
- ImportError: cannot import name 'JSONField' from 'graphene_django.compat'
- AssertionError: Page value for PageGraphqlPagination must be a non-zero value
- Filtering on enum fields returns all results HOT 1
- Logs received not informative
- DjangoListObjectType BigInt Error
- Filter error HOT 2
- Pagination Total Count in DjangoFilterPaginateListField
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphene-django-extras.