Skip to content

Commit

Permalink
schemas: allow extensions to be specified but None
Browse files Browse the repository at this point in the history
Editoast serialize *all* extensions, even when not present. The pydantic
validation should thus allow None

Signed-off-by: Younes Khoudli <[email protected]>
  • Loading branch information
Khoyo committed Dec 6, 2024
1 parent eec04ff commit cb2a1f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/osrd_schemas/osrd_schemas/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def register_extension(extension):
raise RuntimeError(f"Extension '{name}' already registered for {object.__name__}")

extensions_field.annotation.model_fields[name] = FieldInfo(
annotation=extension,
annotation=Optional[extension],
default=None,
)
return extension
Expand Down
4 changes: 2 additions & 2 deletions python/osrd_schemas/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[project]
name = "osrd_schemas"
version = "0.8.13"
version = "0.8.14"

[tool.poetry]
name = "osrd_schemas"
version = "0.8.13"
version = "0.8.14"
description = ""
authors = ["OSRD <[email protected]>"]

Expand Down

0 comments on commit cb2a1f9

Please sign in to comment.