forked from beckn/beckn-onix
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: enforce the schema packs on resourceAttributes, and rename the capability plugins #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
manjudr
merged 10 commits into
feat/41-oan-adapter-plugins
from
feat/16-capability-schema-conformance
Sep 8, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a4337f3
fix(schemav2validator): keep the JSON-LD keys a schema declares [#16]
ameersohel45 e524cf7
refactor(plugins): name the capability plugins after their capabiliti…
ameersohel45 586ed23
feat(config): validate resource attributes against their schema packs…
ameersohel45 4fdf394
refactor(config): resolve capability schemas from the payload's @cont…
ameersohel45 4d18317
refactor: name the registry and binding packages for what they are [#16]
ameersohel45 78d42b9
docs(config): drop the network name from the reference config's comme…
ameersohel45 64a1de2
fix(schemav2validator): read only http and https for a payload-chosen…
ameersohel45 9a1594f
fix(schemav2validator): read the list form of @type, and reject what …
ameersohel45 5132832
fix(schemav2validator): enforce the host allowlist on every schema re…
ameersohel45 cca7ff2
docs(MandiPrice): follow the rename in a cross-reference [#16]
ameersohel45 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling this rejects the repo's own verbatim captured
/selectpayloads.WeatherObservation/mappings_test.go:45is labelled "the verbatim /select captured from the OAN network". ItsresourceAttributes:{ "@context": "https://schemas.openagrinet.global/schema/WeatherObservation/v0.1/context.jsonld", "@type": "openagrinet:WeatherObservation", "subjectCategories": ["Weather"], "location": { "type": "Point", "coordinates": [73.7898, 19.9975] }, "validity": { "startsAt": "2026-08-26", "endsAt": "2026-08-30" } }Two independent failures against
AgricultureResource/v0.1/attributes.yaml:informationModeis missing.attributes.yaml:17putsrequired: [informationMode]on the root object — not under athen, so the if/then/else gap this block honestly documents at lines 141-145 does not excuse it.validity.startsAt/endsAtare bare dates.attributes.yaml:138and:143declareformat: date-time, and the validator is configured withEnableFormatValidation()."2026-08-26"is not a date-time.The mandi capture fails the same way.
What makes this worse than an ordinary bug:
mappings_test.gocalls the mapping step directly and never traversesschemav2validator, so CI stays green while the deployed adapter refuses the exact payload those tests assert it serves. Worth adding a test that pushes one capture through the full validator so this can't regress silently.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both failures are real. I verified each against the pack rather than the description, because "not under a
then" is the whole load-bearing part of your first point:informationMode—required: [informationMode]sits at the root ofAgricultureResource, confirmed by walking the schema and printing everyrequiredwith its path. Root, not underif/then. So the if/then gap does not excuse it, exactly as you say.validity.startsAt/endsAt—format: date-timeat pack lines 138 and 143, andEnableFormatValidation()is on atextended_schema.go:625."2026-08-26"fails it.Your point about why this is worse than an ordinary bug is the one I would most want kept:
mappings_test.gocalls the mapping step directly and never traversesschemav2validator, so CI stays green while the deployed adapter refuses the exact payload those tests assert it serves. That is a test suite that cannot see the failure it is meant to catch.Not fixing it in this PR, and leaving this thread open. Payload and mapping changes are being batched separately from code fixes, and the end-to-end test you suggest belongs with them — a test pushing a capture through the full validator would fail today, so it lands with the payload fix or not at all.
One thing to settle before that batch, since it changes what the fix should be. Adding
informationModesatisfies the required field, but the only permitted values areOnDemandandDirect, andOnDemand'sthenforbidslocation,marketandvalidity— the exact fields a select must carry. SoinformationMode: "OnDemand"passes only becauseif/thenis never evaluated, trading a visible non-conformance for an invisible one that a conformant validator would reject. The packs have no query mode; that gap is raised on PR #13 and is a spec change rather than ours.Neither the pack nor the mappings are on a pinned version yet — the pack is a branch ref and
MAPPING_URLpoints at a branch — so both are expected to move, and this gets revisited when they settle.