Optionally skip normalize schema during marshal#323
Open
illusional wants to merge 4 commits intomasterfrom
Open
Optionally skip normalize schema during marshal#323illusional wants to merge 4 commits intomasterfrom
illusional wants to merge 4 commits intomasterfrom
Conversation
3d1a0f1 to
2266c96
Compare
gtmanfred
reviewed
Jul 8, 2025
a00c6e2 to
533d01c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey! I think we're duplicating normalize_schema work when parsing data from requests and sending the response. We normalize all the relevant schemas on url handler creation:
flask-rebar/flask_rebar/rebar.py
Lines 535 to 546 in 3229874
it looks like calls through the URL handlers are:
marshal:flask-rebar/flask_rebar/utils/request_utils.py
Lines 99 to 108 in 3229874
_get_data_or_400:flask-rebar/flask_rebar/utils/request_utils.py
Lines 223 to 228 in 3229874
There is only one internal usage of marshal in our codebase so in my opinion should be safe to remove, but understand that others might be relying on it.Some other options include:marshal_without_normalizeshould_normalize_schema: bool = Trueflag to marshal to preserve that existing functionality.I think removing normalize_schema from the _get_data_or_400 is safer, but happy to consider other options too!
Edit: Running some future testing, it looks like normalizing already normalized schema is fairly quick.