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

feature/mx-1555_remove_datetime_validation_format #78

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changes

### Deprecated

### Removed

### Fixed

### Security

## [0.19.4] - 2024-02-15

### Added

### Changes

- update cruft and minor dependencies

### Deprecated

### Removed

- date-time format validation for mapping model generation

### Fixed

### Security
Expand Down
1 change: 0 additions & 1 deletion mex/common/types/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ def __get_pydantic_json_schema__(
"""Modify the schema to add the class name as title and examples."""
json_schema = handler(core_schema_)
json_schema["title"] = cls.__name__
json_schema["format"] = "date-time"
json_schema["examples"] = [
"2011",
"2019-03",
Expand Down
52 changes: 26 additions & 26 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mex-common"
version = "0.19.3"
version = "0.19.4"
description = "Common library for MEx python projects."
authors = ["RKI MEx Team <[email protected]>"]
readme = "README.md"
Expand Down
6 changes: 5 additions & 1 deletion tests/models/test_model_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from mex.common.models import EXTRACTED_MODEL_CLASSES_BY_NAME
from mex.common.transform import dromedary_to_kebab
from mex.common.types.identifier import MEX_ID_PATTERN
from mex.common.types.timestamp import TIMESTAMP_REGEX

SPECIFIED_SCHEMA_PATH = files("mex.model").joinpath("entities")

Expand Down Expand Up @@ -121,7 +122,10 @@ def prepare_field(field: str, obj: list[Any] | dict[str, Any]) -> None:
# ignore differences between dates and datetimes
# (we only have `Timestamp` as a date-time implementation, but no type for `date`,
# but we might/should add that in the future)
if obj.get("format") in ("date", "date-time"):
if (
obj.get("format") in ("date", "date-time")
or obj.get("pattern") == TIMESTAMP_REGEX
):
obj.pop("examples", None)
obj.pop("pattern", None)
obj["format"] = "date-time"
Expand Down
Loading