Skip to content

Explicit parameter names, split common to own types, site_id under resource#29

Merged
gabor-lbl merged 47 commits intodoe-iri:mainfrom
doe-iri-esnet:main
Feb 7, 2026
Merged

Explicit parameter names, split common to own types, site_id under resource#29
gabor-lbl merged 47 commits intodoe-iri:mainfrom
doe-iri-esnet:main

Conversation

@juztas
Copy link
Contributor

@juztas juztas commented Feb 7, 2026

This pull request includes:

  • explicit parameter names. Reason: It makes the call self-explanatory and avoids bugs if the parameter order changes by mistake (named arguments don’t care about the order). It plays much nicer with Visual Studio and autocomplete
  • split common.py into it's own types (scalar, base, http, models). As requested by Gabor
  • Add site_id under Resource (required). As requested by Gabor
  • Fix Schemathesis run by catching FastAPI exception and returning problem JSON response in IRI format.

Other small changes:

  • Use isort to sort and fix import orders;
  • Change id, type (these are built-in in python) to id_, type_
  • Inside tasks - it uses tasks, cmd, command. Normalized variable to the task.

Some TODOs/Discussion points:

  • modified_since (ISO8601) and If-Modified-Since (RFC1123) is not currently used together. Only modified_since (query param) is used. These are really 2 different things: modified_since - is a query parameter, and if not found, should return 200 and empty. While If-Modified-Since, if not modified since that date, 204. Need to discuss how we proceed. (It does not break pull request, just something could be done/fixed/clarified in the future.
  • response_model_exclude_none=True - should we include this everywhere?

juztas and others added 30 commits January 17, 2026 10:48
…scovery endpoint

This pull requests includes:

- Implement /api/v1 to list metadata;
- Implement /facility api (most fields are optional, and implemented based on the specification)
- Capabilities, project include forbidExtraQueryParams to make validation happy.
- Parse Raw query_string (catch duplicate keys)
- Add HTTP 304 handling and return correct header
…scovery endpoint

This pull requests includes:

- Implement /api/v1 to list metadata;
- Implement /facility api (most fields are optional, and implemented based on the specification)
- Capabilities, project include forbidExtraQueryParams to make validation happy.
- Parse Raw query_string (catch duplicate keys)
- Add HTTP 304 handling and return correct header
Move common validators and base models into routers/dependencies and update imports across routers and schemas to use the new shared location.

This keeps API behavior unchanged. No functional API changes — purely structural and validation hygiene:
…scovery endpoint

This pull requests includes:

- Implement /api/v1 to list metadata;
- Implement /facility api (most fields are optional, and implemented based on the specification)
- Capabilities, project include forbidExtraQueryParams to make validation happy.
- Parse Raw query_string (catch duplicate keys)
- Add HTTP 304 handling and return correct header
…scovery endpoint

This pull requests includes:

- Implement /api/v1 to list metadata;
- Implement /facility api (most fields are optional, and implemented based on the specification)
- Capabilities, project include forbidExtraQueryParams to make validation happy.
- Parse Raw query_string (catch duplicate keys)
- Add HTTP 304 handling and return correct header
Move common validators and base models into routers/dependencies and update imports across routers and schemas to use the new shared location.

This keeps API behavior unchanged. No functional API changes — purely structural and validation hygiene:
juztas added 17 commits February 4, 2026 04:56
…normalization

This pull request introduces:
- Use and add **kwargs to all adapter interfaces (with a shared warning function for unused parameters). This enables facilities to implement on their own pace, while continue to be compatible.
- Use explicit keyword args
- Add common pagination helper and expand filtering based on input values;
- Unify datetime handling, normalize to UTC and use it in find;
This includes:
- application/problem+json for error responses
- Generate URL-safe instance values
- Normalize non-string validation error into strings (fastapi validation can give list/dict)
- Exclude None/empty fields from locations/capabilities reponses
- Capability (according to spec) should use NamedObject, but overrides last_modified as optional.
Make adapter forward compatible. add filtering, pagination, datetime …

capability_ids: list[str] = Field(exclude=True)
# NOTE (TBR): If site_id is required, then located_at_uri should be also required. This can be easily identified by Site.self_uri
# Is there a specific Resource, that has no Site?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would imagine every IRI implementation has at least 1 site.

Re. localted_at_uri, that's something that could go into a client lib.

@gabor-lbl gabor-lbl merged commit 4d11d60 into doe-iri:main Feb 7, 2026
1 check 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.

2 participants