Skip to content

Reject (pxf.required) with (pxf.default) at bind time - #53

Merged
trendvidia merged 3 commits into
mainfrom
fix/required-default-50
Oct 31, 2026
Merged

trendvidia merged 3 commits into
mainfrom
fix/required-default-50

Conversation

@bfrancojr

Copy link
Copy Markdown
Collaborator

A schema with (pxf.required) = true and (pxf.default) on one field now fails when it is bound, as draft -01 requires. Before, it bound here, and a document omitting the field got an error from this port even though the same schema could mean something else in another engine.

Fixes #50

Changes

  • ValidateFile reports the pair as a new ViolationKind::kRequiredOption. The check sits with the other field checks, so it covers the import closure, and Unmarshal and UnmarshalFull refuse the schema.
  • (pxf.required) = false beside a default stays accepted.
  • This port reads only the bracket options. It has no @required / @default carrier reader, so there is one spelling to check.

Also fixed

  • The bind-failure Status now starts PXF schema violations:, matching Go. It used to say reserved-name violations, which would be wrong for this rule and was already wrong for (pxf.key). Anything matching the old text needs updating.

Evidence

  • ctest --test-dir build --output-on-failure: 100% tests passed out of 301, including the three new PxfSchema tests. No existing test schema carried the pair, so none needed changing.
  • With the check removed from schema.cc, RequiredWithDefaultRejected and RequiredWithDefaultInImportReported fail (Which is: 0, wanted 2 and 1). RequiredFalseBesideDefaultAccepted passes either way, as it should.
  • clang-format --dry-run -Werror is clean on the changed sources, using version 23, not the 18 that CI uses.

Not covered

BindRow and DatasetReader::Scan skip every bind-time check, so this rule does not reach them, like the reserved-name and (pxf.key) rules. A probe showed it, and #51 tracks it because the fix needs a design choice. scripts/cross_security_check.sh is not evidence here: it does not exercise this rule.

bfrancojr and others added 3 commits October 30, 2026 18:49
Draft -01 forbids the pair on one field. A schema with both now fails in
ValidateFile, over the import closure, and so in Unmarshal and
UnmarshalFull, whether or not a document omits the field.
(pxf.required) = false beside a default stays accepted.

This port reads only the bracket options; it has no @required / @default
carrier reader, so there is one spelling to check.

The bind-failure Status now starts "PXF schema violations:", as in Go,
because it no longer lists only reserved names.

Fixes #50
@trendvidia
trendvidia merged commit 1ba4dfd into main Oct 31, 2026
10 checks passed
@trendvidia
trendvidia deleted the fix/required-default-50 branch October 31, 2026 08:48
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.

Reject pxf.required with pxf.default on one field at bind time

2 participants