activerecord_json_validator | validate JSON attributes against a JSON schema | JSON Processing library
kandi X-RAY | activerecord_json_validator Summary
kandi X-RAY | activerecord_json_validator Summary
ActiveRecord::JSONValidator makes it easy to validate JSON attributes against a JSON schema.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of activerecord_json_validator
activerecord_json_validator Key Features
activerecord_json_validator Examples and Code Snippets
Community Discussions
Trending Discussions on activerecord_json_validator
QUESTION
I'm doing a rails setup with Single Table Inheritance, where each class has all of it's attributes stored on a JSON blob, the structure of which is defined in a json schema file unique to that class.
I want to run validations on each class against its json schema but the logic is the same for every class minus the path to the schema itself which depends on the name of the STI class and the sub class.
This setup relies on the gem 'activerecord_json_validator' which specifies a format for the validation schema files and some helpers for validation
So the desired setup is something like
/app/models/data_generating_module
(the abstract STI base class which is never instantiated)
ANSWER
Answered 2019-Nov-22 at 02:10putting this inside an inherited hook and then class evaling inside of the subclass got this working:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install activerecord_json_validator
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page