#ifndef COMDEL_VALIDATOR_H #define COMDEL_VALIDATOR_H #include "instance.h" #include "schema.h" namespace domain { struct ValidationError { Instance *instance; InstanceAttribute *attribute; Action::ActionType type; std::string message; }; struct ValidationContext { Instance *instance; InstanceAttribute *attribute; std::map addressSpaces; std::map attributes; }; class ComdelValidator { public: std::vector validateSchema(Schema& schema, ValidationContext context); std::vector validateComponent(ComponentInstance *instance, ValidationContext context); std::vector validateAttribute(InstanceAttribute *attribute, ValidationContext context); std::optional validateRule(Rule rule, ValidationContext context); ComdelValidator(std::map callbacks): callbacks(callbacks) {} private: std::map callbacks; std::string populateMessage(string basicString, ValidationContext context); string replacePlaceholder(string basicString, const string basicString1, Value value); }; } #endif //COMDEL_VALIDATOR_H