Skip to content

fix: document date alignment rules and add INVALID_ARGUMENT error for misaligned dates - #107

Merged
cnzj-Gc merged 2 commits into
camaraproject:mainfrom
cnzj-Gc:main
Sep 30, 2026
Merged

cnzj-Gc merged 2 commits into
camaraproject:mainfrom
cnzj-Gc:main

Conversation

@cnzj-Gc

@cnzj-Gc cnzj-Gc commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • bug
  • correction
  • enhancement/feature
  • cleanup
  • documentation
  • repository management
  • tests

What this PR does / why we need it:

Closes #94.

The API description required startDate/endDate to align to day or hour boundaries depending on frequency, but nothing documented an error for misaligned values. The only OUT_OF_RANGE example covered endDate before startDate, which is a different condition.

Changes made:

  • info.description now explicitly documents that misaligned startDate/endDate values result in 400 INVALID_ARGUMENT
  • Added a GENERIC_400_INVALID_ARGUMENT_ALIGNMENT example to the Generic400 response
  • Added test scenarios covering misaligned startDate/endDate for both DAY and HOUR frequencies

Which issue(s) this PR fixes:

Fixes #94

Special notes for reviewers:

Following the review comment on this issue, we used INVALID_ARGUMENT rather than OUT_OF_RANGE for the misalignment case. Per the CAMARA API Design Guide's Syntax Exceptions table, OUT_OF_RANGE is scoped to "a given field has a pre-defined range or an invalid filter criteria combination is requested". A date value that is not aligned to the frequency's day/hour boundary is a format error on a query parameter, which maps to INVALID_ARGUMENT ("Generic Syntax Exception", explicitly covering query params).

The existing _03_out_of_range_scenario is left unchanged, as it correctly covers a genuine OUT_OF_RANGE case (endDate before startDate).

Changelog input

Document date alignment rules and return INVALID_ARGUMENT for misaligned startDate/endDate in Network Traffic Analysis

@cnzj-Gc
cnzj-Gc requested a review from heliu0 as a code owner September 30, 2026 09:14
@cnzj-Gc
cnzj-Gc merged commit fd2efab into camaraproject:main Sep 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misaligned startDate/endDate for the chosen frequency has no defined error

2 participants