Skip to content

Pass metadataId to schematron#9418

Open
tylerjmchugh wants to merge 3 commits into
geonetwork:mainfrom
tylerjmchugh:metadataId-for-schematron
Open

Pass metadataId to schematron#9418
tylerjmchugh wants to merge 3 commits into
geonetwork:mainfrom
tylerjmchugh:metadataId-for-schematron

Conversation

@tylerjmchugh

@tylerjmchugh tylerjmchugh commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Schematron validations currently receive a limited set of parameters from the validation pipeline. Custom schematron rules may require additional metadata context to perform validation reliably, but the metadata ID is not currently available to them.

This PR aims to fix this issue by passing metadataId from AbstractSchematronValidator to the generated schematron XSLT as a parameter.

This provides schematron implementations with a reliable way to identify the exact metadata record being validated and supports custom validation use cases that need access to record-specific context. In our case, this is used to distinguish between approved metadata and working copies when validating associated resources.

Checklist

  • I have read the contribution guidelines
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests
  • User documentation provided for new features or enhancements in manual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

@tylerjmchugh
tylerjmchugh marked this pull request as ready for review July 15, 2026 12:37

@jodygarnett jodygarnett 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.

So I can see the test, and metadataId being used in is xsl.

Q: Do any of the built-in schemas need to make use of metadataId?

Q: Or is this a change required for a regional schema plugin? If so perhaps we can link to a metadata101 issue

@fxprunayre fxprunayre added this to the 4.4.13 milestone Jul 16, 2026
@tylerjmchugh

Copy link
Copy Markdown
Contributor Author

So I can see the test, and metadataId being used in is xsl.

Q: Do any of the built-in schemas need to make use of metadataId?

Q: Or is this a change required for a regional schema plugin? If so perhaps we can link to a metadata101 issue

I don't think any of the built-in or plugin schemas require it currently. We have a custom schematron added to iso19139.ca.HNAP which does some validations on the resources but I am not aware of any existing schematrons that do similar.

@josegar74 josegar74 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changes look fine. Maybe to document in the manual the case for external validation, where -1 value is passed for metadata id and trying to use it will return an empty metadata:

runSchematron(lang, schemaDir, validations, schemaTronXmlOut, -1, md, applicable);

@tylerjmchugh

Copy link
Copy Markdown
Contributor Author

Changes look fine. Maybe to document in the manual the case for external validation, where -1 value is passed for metadata id and trying to use it will return an empty metadata:

runSchematron(lang, schemaDir, validations, schemaTronXmlOut, -1, md, applicable);

@josegar74 Added a comment and documentation in the latest push

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.

4 participants