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.

Change Key for Schema Errors

See original GitHub issue

Hi, thanks for the great library!

I just have a couple of quick questions that I can’t find in the documentation. Would really appreciate your help with this. Here I go…

I don’t understand why the key in the errors dictionary for schema level errors is "_schema". What exactly is the purpose of the _? I know that this a naming convention for pseudo private variables in python, but I fail to understand how the key is “private” as Marshmallow docs say it can be used by the client code.

Additionally, is there any way to change that to something else on my side? Preferably, I’d just like to have "schema" as the key instead of "_schema". However, I am not aware of the side effects or the unintended consequences this might have on the code. I also have no clue how to go about doing this. So… how exactly can I implement this and are there any side effects? Is changing the default not recommended by your developers? Why?

Thanks again for your time and your help. Really love this library!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lafrechcommented, Mar 9, 2019

This key lies in the same namespace as field names.

We chose _schema to avoid name collision with a field called schema.

0reactions
lafrechcommented, Jun 27, 2022

Field errors use field name as key. _schema is used only for schema-level errors. Those, by nature, don’t have a field name.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding schema errors | HESA
The schema is defined by the XSD. Schema errors occur where there is a problem with the structure or order of the file,...
Read more >
Handling Validation Errors - python-jsonschema
An instance was invalid under a provided schema. A human readable message explaining the error. The name of the failed keyword. The associated...
Read more >
Joi validator conditional schema - Stack Overflow
This is throwing me an error Error: "switch" can not be used with a schema condition . I'm using hapi/joi version 16.1. ·...
Read more >
Schema Validation on Confluent Server
Value schema and key schema validation are independent of each other; ... To change topic validation configuration on an existing topic (in this...
Read more >
Ajv options - Ajv JSON schema validator
For example, to report all validation errors (rather than failing on the first ... It does not change any validation results, but it...
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