Skip to content

Commit

Permalink
rm date/datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Dec 18, 2024
1 parent 4bad15b commit c06d43c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
26 changes: 0 additions & 26 deletions src/ga4gh/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from __future__ import annotations

from abc import ABC
from datetime import date as datetime_date
from datetime import datetime as datetime_datetime
from enum import Enum
from typing import Annotated, Any, Dict, List, Optional, Union

Expand Down Expand Up @@ -77,30 +75,6 @@ def ga4gh_serialize(self) -> str:
)


class date(RootModel):
"""A string is valid against this format if it represents a date in the following format: YYYY-MM-DD."""

root: datetime_date = Field(
...,
json_schema_extra={
"description": "A string is valid against this format if it represents a date in the following format: YYYY-MM-DD."
},
)


class datetime(RootModel):
"""A string is valid against this format if it represents a date-time in the
following format: YYYY:MM::DDThh:mm:ss.sTZD.
"""

root: datetime_datetime = Field(
...,
json_schema_extra={
"description": "A string is valid against this format if it represents a date-time in the following format: YYYY:MM::DDThh:mm:ss.sTZD."
},
)


#########################################
# Abstract core classes
#########################################
Expand Down
3 changes: 2 additions & 1 deletion tests/validation/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def test_schema_models_in_pydantic(gks_schema, pydantic_models):
for schema_model in (
mapping.base_classes | mapping.concrete_classes | mapping.primitives
):
assert getattr(pydantic_models, schema_model, False), schema_model
if schema_model not in {"date", "datetime"}: # since we leverage datetime module
assert getattr(pydantic_models, schema_model, False), schema_model


@pytest.mark.parametrize(
Expand Down

0 comments on commit c06d43c

Please sign in to comment.