Forum Discussion
IRule to validate JSON "schema" (similar to XML validation)
I was very disappointed to learn that ASM can only validate the if a JSON is well-formed or not, but cannot validate the actual paylod, like check for mandatory parameters, permitted values, parameter types (Int,String,Array,etc.)
F5 support confirmed this is a missing functionality and opened an RFE, but there is no telling when this will be added, if at all.
I was thinking if this would be possible to achieve with IRules using regex matching of the payload. I know there will be a performance impact for this, but I need to check this route since this is a mandatory requirement.
Can someone please suggest a way this can be accomplished with IRules? Of course, if there are other ideas - I'm open to any suggestion.
Cheers,
Avshalom.
4 Replies
- kev_245_28249
Nimbostratus
any update on the RFE? - Kevin_Davies_40
Nacreous
iRule authors write stuff like this all the time as the need arises. The sheer number of iRules in circulation inside F5 alone is staggering but most of it is very customer specific and commercial in confidence. I am sure if you post some anonymised examples of json payload and explain what you want to do some kind soul may well help you with how to do it. We are helpful where we can :-) - some small things are possible, but a full xml parser in an irule, that is quite some work which people wont do for simple fun i fear.
- Colin_Walker_12Historic F5 Account
You could absolutely write this for your specific use case in an iRule. Frankly, with enough time and know-how, you could likely write a more generic version that used variables that could be tweaked as needed. That's more of an undertaking of course, but possible.
The question really becomes - how granular are you looking to go, and are you willing to invest the time or resources to get there?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com