From cb2a1f93c8c3e8cb040e4c05a14c00c3b0305948 Mon Sep 17 00:00:00 2001 From: Younes Khoudli Date: Fri, 6 Dec 2024 08:35:25 +0100 Subject: [PATCH] schemas: allow extensions to be specified but None Editoast serialize *all* extensions, even when not present. The pydantic validation should thus allow None Signed-off-by: Younes Khoudli --- python/osrd_schemas/osrd_schemas/infra.py | 2 +- python/osrd_schemas/pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/osrd_schemas/osrd_schemas/infra.py b/python/osrd_schemas/osrd_schemas/infra.py index 62dfb0b4f7b..ff2712aa354 100755 --- a/python/osrd_schemas/osrd_schemas/infra.py +++ b/python/osrd_schemas/osrd_schemas/infra.py @@ -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 diff --git a/python/osrd_schemas/pyproject.toml b/python/osrd_schemas/pyproject.toml index 7a6758a66de..b81bd72d898 100644 --- a/python/osrd_schemas/pyproject.toml +++ b/python/osrd_schemas/pyproject.toml @@ -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 "]