fix(choice fields): no locally minted option for external URI placeholders - #677
Merged
Merged
Conversation
…lders A guided choice or agent field offers a typed plain name as an identifier to be minted (issue #652). When the placeholder is also an nt:ExternalUriPlaceholder, the value has to refer to something that exists outside the nanopublication, so the validator rejects such a name with "Not an external IRI" -- the option was only there to fail on submit. Skip the suggestion for external URI placeholders, and stop marking a bare word held for such a field as "(mint locally)". URIs and ORCIDs stay on offer; nothing changes for placeholders without the tag. Closes #676 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UToMqDvcVRgpwHojAx69t1
Contributor
|
🎉 This PR is included in version 5.13.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #676.
The problem
Guided choice and agent fields offer a typed plain name as an identifier to be minted, shown as
local:john (mint locally)(from #652). When the placeholder is also annt:ExternalUriPlaceholder, the value has to refer to something that already exists outside the nanopublication — the validator rejects such a name with "Not an external IRI", so the option was only ever there to fail on submit.The change
Everything is gated on
Template.isExternalUriPlaceholder, which also coversnt:TrustyUriPlaceholder(equally unmintable).TemplateContext.isToBeMintedreturns false for an external URI placeholder, so a bare word held for such a field is no longer labelled "(mint locally)".GuidedChoiceItemskips the plain-name suggestion for them.AgentChoiceItemdoes the same, keeping URI and ORCID suggestions intact.Placeholders without the tag are unaffected.
Tests
Both component test classes gained an
externalvariant of their template builder plus three cases each: no plain name offered, URIs/ORCIDs still offered, no "mint locally" label.mvn test -Dtest=AgentChoiceItemTest,GuidedChoiceItemTest→ 21 tests, 0 failures.Not in this PR
The issue's second half — "templates, like view display declarations should then be changed to include ExternalPlaceholder tag" — means superseding published template nanopubs, which is a separate, non-code step.
🤖 Generated with Claude Code
https://claude.ai/code/session_01UToMqDvcVRgpwHojAx69t1