Skip to content

Commit

Permalink
Remove inconsistent validation for TimeDimensionParameter (#1314)
Browse files Browse the repository at this point in the history
Two things:
- This error wasn't do what it was supposed to do, since it never
checked if `date_part` was passed. I don't think this ever got triggered
because MFS was parsing the grain from the `name` param and passing it
via the `grain` param instead.
- I ran into this error in the process of trying to create consistency
in the behavior of our Jinja params. Since most interfaces allow passing
grain via dundered syntax, this interface is inconsistent. If we
eventually want to retire the dunder syntax, we should deprecate it
everywhere at once to avoid creating confusion for our users in the
meantime.
  • Loading branch information
courtneyholcomb authored Jul 9, 2024
1 parent afcf480 commit 6447a05
Showing 1 changed file with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ def _implements_protocol(self) -> TimeDimensionQueryParameter:
grain: Optional[TimeGranularity] = None
date_part: Optional[DatePart] = None

def __post_init__(self) -> None: # noqa: D105
parsed_name = StructuredLinkableSpecName.from_name(self.name)
if parsed_name.time_granularity:
raise ValueError("Must use object syntax for `grain` parameter if `date_part` is requested.")

@property
def query_resolver_input(self) -> ResolverInputForGroupByItem: # noqa: D102
fields_to_compare = [
Expand Down

0 comments on commit 6447a05

Please sign in to comment.