fix: keep literal placeholder values with datatypes other than date/dateTime - #565
Merged
Conversation
…ateTime A nt:LiteralPlaceholder with a datatype like xsd:gYear silently dropped the entered value in TemplateContext.processValue, because the datatyped branch only handled xsd:dateTime and xsd:date. Non-optional statements then failed on publish with "Field of statement not set." even though the field was filled in. Other datatypes now take the textfield path and produce a typed literal. Fixes #564 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #564.
Problem
A
nt:LiteralPlaceholderwith a datatype other thanxsd:date/xsd:dateTime(e.g.nt:hasDatatype xsd:gYear) always failed on publish/preview with "Field of statement not set.", even with the field filled in: the datatyped branch ofTemplateContext.processValue()only handledxsd:dateTimeandxsd:dateand leftprocessedValueasnullfor everything else, soStatementItem.hasEmptyElements()treated the filled field as unset.Fix
Restructured the
isLiteralPlaceholderbranch soxsd:dateTimeandxsd:datekeep their special component-model handling, and every other case (including other datatypes) falls through to the textfield path. The previously deadif (datatype != null)there now becomes live and producesvf.createLiteral(tfObject, datatype).Tests
New
LiteralPlaceholderDatatypeTestcoversxsd:gYearandxsd:integertyped literals, plain literals, language-tagged literals, and the empty-value case. Full suite passes (799 tests, 0 failures).🤖 Generated with Claude Code