Skip to content

Align to the official specification#27

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

Align to the official specification#27
gabor-lbl merged 22 commits intodoe-iri:mainfrom
doe-iri-esnet:main

Conversation

@juztas
Copy link
Contributor

@juztas juztas commented Jan 23, 2026

This includes:
API compliant with the official spec;
Github Validation with schemanthesis (API is fully compliant)
Enable/disable opentelemetry
Force py version to be 3.14
Many validation fixes and changes to remain close to the official spec

resource_type: models.ResourceType = Query(default=None),
_forbid = Depends(iri_router.forbidExtraQueryParams("name", "description", "group", "offset", "limit", "modified_since", "resource_type")),
current_status: models.Status = Query(default=None),
capability: List[AllocationUnit] = Query(default=None, min_length=1),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the param name be "capabilities"? How does it match a resource? If all the queried caps apply or also if only some apply?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The name matches the spec (capability) unless we change the spec. According to the spec, the user is able to specify:

/api/v1/status/resources?capability=bytes
/api/v1/status/resources?capability=bytes&capability=node_hours

It can match resources that have at least one capability whose units satisfy the filter, and when multiple units are provided, they are treated as AND / OR (???) semantics. Based on the spec description, I would treat it as AND. (would be great to document this better)

        - name: capability
          in: query
          description: Return only resources with this capability.
          required: false
          schema:
            type: array
            items:
              type: string

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, this works for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's ask @jmacauley @pmrich. How should the Facility interpret multiple values? AND or OR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Two things:

  1. When I implemented the capability query parameter on /status/resources I used the URN as the parameter to match the exact entity. I guess I could have used id as well uuid. What are you using to match?
  1. I used the list format /status/resources?capability=uri_1,uri_2,uri_3, which evaluated as OR resulting in resources being returned if they contained any of the three capabilities.

Copy link

Choose a reason for hiding this comment

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

As for how we would want this to behave, I think AND makes more sense to me. Though I suppose you can get the same effect by applying OR and the the user has to filter the result for the specific resources they need. It seems that returning the OR would cover both the AND and OR cases reasonably, even if I expect AND to be more common.

juztas and others added 18 commits February 4, 2026 04:44
…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:
@gabor-lbl gabor-lbl merged commit 57592f1 into doe-iri:main Feb 6, 2026
1 check failed
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.

4 participants