Skip to content

URN Implementation - #93

Merged
pmrich merged 7 commits into
doe-iri:mainfrom
juztas:urn
Jul 2, 2026
Merged

URN Implementation#93
pmrich merged 7 commits into
doe-iri:mainfrom
juztas:urn

Conversation

@juztas

@juztas juztas commented May 18, 2026

Copy link
Copy Markdown
Contributor

This is based on John's URN doc. Need to review it and solve conflicts

Comment thread app/types/scalars.py
# AllocationUnit: an enum for allocation units
class AllocationUnit(enum.Enum):
"""Units for allocation"""
DOE_IRI_URN_PREFIX = "urn:doe-iri:"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why all this complexity? How about just new enum(str)-s of the urls?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Which part? Regex? I don't think there is an easier way to achieve the correct result without enforcing the validation contract. It could easily accept everything, but we will end up drifting from an RFC and diff naming: compute vs Compute. Enums will not work if we want to allow facilities to define their own names, like urn:doe-iri:something:fancy. I see this where we want to put trust in the output? On Facilities, to always know what to define and trust them, or enforce it at this level and validate what facility sets?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, I meant all the validation logic. What if we only allow facilities under a prefix like urn:doe-iri:facility:...?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Validation needs to stay, based on John's RFC (see section 2: https://github.com/doe-iri/iri-facility-api-docs/blob/main/rfc/rfc-iri-urn-structure-and-registry.md). I prefer to break it early on code, rather than identifying it later as a mistake in length, _-, etc.
Enums will not work, as it would limit our capabilities (and always require defining it)
For urn:doe-iri:facility:... see section 4, the facility code can be at any level

urn:doe-iri:<facility-code>:pdu:breaker
urn:doe-iri:resource:<facility-code>:dpu
urn:doe-iri:resource:compute:<facility-code>:fpga

So validation accepts it all, and the main thing is that it validates syntax and rejects malformed inputs. If you see an easier way, would you be able to take the code base and propose an easier solution?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, I'm good then - thanks for the explanation.

@pmrich pmrich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Gabor's questions have been addressed.

@pmrich
pmrich merged commit 7c06e2b into doe-iri:main Jul 2, 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.

3 participants