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

[pydantic > 2] xAPI extensions cannot hold empty strings #553

Open
2 tasks
Leobouloc opened this issue Jan 17, 2024 · 0 comments
Open
2 tasks

[pydantic > 2] xAPI extensions cannot hold empty strings #553

Leobouloc opened this issue Jan 17, 2024 · 0 comments

Comments

@Leobouloc
Copy link
Contributor

Leobouloc commented Jan 17, 2024

Bug Report

The migration to pydantic v2 will introduce a regression with respect to the xAPI specification. Following the migration, xAPI statements cannot contain empty string values even in an "extensions" field. This behavior is contrary to the specification and must be reverted.

The reason for the regression is that model_config has str_min_length=1, which previously (pydantic <2) did not apply to values defined as dicts (when setting an extension) but now (pydantic >2) does.

One solution could be to create a custom class (RootModel[Dict] ?) for extensions with a custom config.

TODO:

  • Check that LanguageMap = Dict[LanguageTag, NonEmptyStrictStr] is not used in extensions (as it forces a non empty string
  • Add "" to values in test_models_xapi_base_statement_with_valid_null_values
@Leobouloc Leobouloc changed the title [Pydantic > 2] xAPI extensions cannot hold empty strings [pydantic > 2] xAPI extensions cannot hold empty strings Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant