question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field names in validation errors are different from schema

See original GitHub issue

I have a form which has a python field raw_description which ends up in schema as rawDescription. However if field doesn’t have a valid value I get a validation error for field raw_description which is not in schema.

class UpdateEventModelForm(forms.ModelForm):
    raw_description = forms.CharField()
    class Meta:
        model = EventModel
        fields = ('name', 'from_date', 'to_date')
mutation updateEvent($input: UpdateEventInput!) {
  updateEvent(input: $input) {
    errors {
      field
      messages
    }
  }
}

{
    "input": {
      "id": 123,
      "rawDescription": ""
    }
}

Response

{
  "data": {
    "updateEvent": {
      "errors": [
        {
          "field": "raw_description",
          "messages": [
            "This field is required."
          ]
        }
      ],
      "event": null
    }
  }
}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jkimbocommented, Oct 27, 2020

@igo I’m assuming you’re using graphene-django here? Have you tried the CAMELCASE_ERRORS setting? https://docs.graphene-python.org/projects/django/en/latest/settings/#camelcase-errors

0reactions
igocommented, Oct 26, 2020

Issue stale is not

– Yoda

Read more comments on GitHub >

github_iconTop Results From Across the Web

Raising validation errors for multiple field names in schema ...
I could raise a number of ValidationError via a list, but I can't assign these errors to different field names.
Read more >
Understanding schema errors | HESA
Understanding schema errors ; Field. A field is an attribute (data item) of an entity. This refers to the short field name as...
Read more >
How to Fix Schema Validation Errors
The most common schema validation error is "either "offers", "review", or "aggregate rating" should be specified." Here's how to fix it.
Read more >
Is possible to include property name in the error-message ...
I have noticed that the field name is not included as part of the var://service/error-message variable when a schema validation error occurs for...
Read more >
Handling Validation Errors - python-jsonschema
The full schema that this error came from. This is potentially a subschema from within the schema that was passed in originally, or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found