diff --git a/datamodel_code_generator/parser/jsonschema.py b/datamodel_code_generator/parser/jsonschema.py index 6a20fd016..16b64a40a 100644 --- a/datamodel_code_generator/parser/jsonschema.py +++ b/datamodel_code_generator/parser/jsonschema.py @@ -270,6 +270,8 @@ class Config: def __init__(self, **data: Any) -> None: super().__init__(**data) self.extras = {k: v for k, v in data.items() if k not in EXCLUDE_FIELD_KEYS} + if 'const' in data.get(self.__extra_key__, {}): + self.extras['const'] = data[self.__extra_key__]['const'] @cached_property def is_object(self) -> bool: