Guidance on Programmatic JSON Schema Validation via Custom Python Rules in iRODS

26 views
Skip to first unread message

Laura Lo Gerfo

unread,
Oct 14, 2025, 7:37:00 AMOct 14
to iRODS-Chat

Dear iRODS Development Team,

I am reaching out for guidance on implementing custom Python rules and invoking them correctly from the Python iRODS client.

We are currently developing a metadata schema management system that uses JSON Schema Draft 2020-12 for metadata validation. As part of our architecture, we have:

  • A web portal responsible for collecting and retrieving metadata schemas, as well as enabling data and metadata search and exploration
  • An iRODS 5.0.1 deployment, where we aim to enforce schema validation by calling a dedicated validation service that exposes REST APIs

Within our data portal, metadata validation is straightforward. However, we also need to enforce this validation programmatically within iRODS. Our goal is to trigger a custom iRODS Rule Engine rule that:

  • Accepts a populated JSON metadata object from the Python client
  • Sends this JSON object to our external validation service (via REST API)
  • Validates the metadata against the corresponding JSON Schema (Draft 2020-12)
  • Proceeds to register the metadata in iRODS or approve ingestion if validation succeeds

Before proceeding further, we would appreciate your feedback on whether this approach makes sense — or if there is a more direct or recommended way to achieve the same goal within the iRODS framework.

At the moment, we are encountering difficulties when passing JSON data from the Python iRODS client (python-irodsclient==3.1.1) to a custom rule. Specifically, we are unsure how to properly instantiate and invoke a Rule object from the Python client that accepts JSON payload parameters.

The available documentation and GitHub (https://github.com/irods/python-irodsclient) examples mostly cover simple use cases without parameters, so we may be missing some key implementation details (or perhaps our approach needs adjustment).

Any guidance, best practices, or examples you could share would be greatly appreciated.

Kind regards,
Laura Lo Gerfo

Terrell Russell

unread,
Oct 14, 2025, 1:56:11 PMOct 14
to irod...@googlegroups.com
Hi Laura,

Your plan might be overkill - or it might prove just right...
Passing larger payloads to a Python rule is not something we've done much of, there is a limit on the payload size going into a rule.

KU Leuven and RENCI have been working on examples of this type of thing for a few years...

Leuven's talk from 2025 is here...
Metadata schemas updates: JSON schemas and storage in iRODS
slides - https://irods.org/uploads/2025/Montes-KULeuven-Metadata_schemas_updates_JSON_schemas_and_storage_in_iRODS-slides.pdf
video - https://www.youtube.com/watch?v=R2InyJo-ZgE&list=PL29FhEN41mZNGY9cCOoukDDx4xpF4HN0v



These examples should allow you to manage your schemas wherever you want but do the validation within iRODS itself.

Terrell




--
--
The Integrated Rule-Oriented Data System (iRODS) - https://irods.org
 
iROD-Chat: http://groups.google.com/group/iROD-Chat
---
You received this message because you are subscribed to the Google Groups "iRODS-Chat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to irod-chat+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/irod-chat/6278f33a-8a19-4d80-b17b-e4856722871dn%40googlegroups.com.

Laura Lo Gerfo

unread,
Oct 17, 2025, 2:59:35 AM (12 days ago) Oct 17
to irod...@googlegroups.com

Hi Terrell,

Thank you very much for your helpful pointers and the references — those examples are indeed very useful.

Based on your feedback about the payload size limits when invoking Python rules, we are considering a slightly different approach:
instead of passing the JSON metadata object directly as a parameter (payload) to the rule, we could first upload the JSON as a file and then have a custom rule read it and perform the validation by calling our external REST API service.

Would this be a more appropriate or robust way to handle metadata validation within iRODS, in your opinion?

Also, just for curiosity — when you mention a “limit on the payload size,” is there a known or recommended maximum size for rule input parameters?

Many thanks again for your time and guidance,
Kind regards,

Laura

Terrell Russell

unread,
Oct 17, 2025, 10:07:13 AM (11 days ago) Oct 17
to irod...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages