Bugfix/make sure excluded fields are excluded#1
Open
om-henners wants to merge 6 commits into
Open
Conversation
added 6 commits
September 12, 2024 14:04
From the [docs](https://docs.pydantic.dev/latest/concepts/fields/#exclude): > The `exclude` parameter can be used to control which fields should > be excluded from the model when exporting the model. At the moment the values are excluded as expected, but the headers are not correctly filtered. This is worse than we expect because it also breaks the order of the fields rather than leaving the field blank.
This involves switching to a dict writer, and making user whether to use aliases is passed through to the write method.
8758b42 to
334f400
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.
Ran into this issue when dumping from a model with excluded fields and those fields showed up. Basically the
excludeattribute on a field is standard and filters the field entirely from output when dumping viaitem.model_dump(). But we weren't filtering field names at the same time which led to broken output. This fixes the issue by filtering out those fields from the fieldnames as well.