Skip to content
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

Feature request: make "context in exceptions" optional #187

Open
vanschelven opened this issue Sep 19, 2024 · 0 comments
Open

Feature request: make "context in exceptions" optional #187

vanschelven opened this issue Sep 19, 2024 · 0 comments

Comments

@vanschelven
Copy link

I'm using fjs to generate python code that does the validation (i.e. compile_to_code)

I'm working around #72 by just falling back to good (bad) old jsonschema and best_guess in the case I have a validationerror.

That means I don't use any of the information that's present in the JsonSchemaValueException. Looking at that code, I noticed that ~75% (out of a whopping 2.5MB) is used by the definition parts of the generated exceptions. When you have deeply nested definitions, that is to be expected, since the relevant part of the definition (for some part) is repeated throughout the tree.

Since I don't use that information, generating it (and loading it) seems wasteful. It would be nice if compile_to_code had a parameter that controlled the behavior of the generated raise JsonSchemaValueException, basically making (the relevant parts of) this commit conditional.

I managed to work around this a bit by hacking around in def exc but that doesn't "quite feel right".

@vanschelven vanschelven changed the title Feature request: definition arg (and possibly more) of JsonSchemaValueException optionally generated Feature request: make "context in exceptions" optional Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant