Skip to content

Conversation

@Fokko
Copy link
Contributor

@Fokko Fokko commented Jun 6, 2022

https://github.com/samuelcolvin/pydantic provides data validation and settings management using Python type-hints.

Fast and extensible, pydantic plays nicely with your linters/IDE/brain. Define how data should be in pure, canonical Python 3.7+; validate it with pydantic.

I took the basis from @samredai's PR in #3677

It allows us to easily (de)serialize the TableMetadata including all the nested fields (schema, fields and types). While working on this, I've also noticed some discrepancies with the spec. For example:

  • Python uses is_optional, while the spec talks about required
  • The map.key is a field in Python, while in the spec, this is a type.
  • For the list, the element is a field in Python, while in the spec it is a type.

In this PR I also correct some of these discrapencies to avoid confusion among the different implementations. This PR comes with a lot of test to check proper (de)serialization of the tablemetadata, schema and types.

#3677

@github-actions github-actions bot added the python label Jun 6, 2022
@Fokko Fokko closed this Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants