Upgrade to Pydantic 1.9 to Support Delimiter Exclusion Via Model Config
dixonwhitmire opened this issue · comments
The upcoming Pydantic release, 1.9, will support adding export exclusions to Model Configuration class - pydantic/pydantic#660. This new feature will allow us to exclude the x12 "delimiters" from a model export using a single config.
This is an improvement over current functionality as we would need to exclude the delimiters in each "export" function ( dict()
, json()
etc) invocation.
Insight on the upcoming pydantic release . The maintainer is an individual that's a bit time constrained at the moment.
pydantic/pydantic#3228
Pydantic 1.9 is now available
After reviewing the code it seems more appropriate to remove the delimiters from the X12Segment model, as they are metadata and not part of the data payload.
Changes include:
- Removing the delimiters field from the base segment model
- Adding a custom_delimiter parameter to the X12Segment.x12() method
- Updating the X12 segment group to support a delimiters attribute