mrml-ruby icon indicating copy to clipboard operation
mrml-ruby copied to clipboard

MRML validate

Open autonomous opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. When building mjml templates errors sometime sneak in. The templates are often large/complex, and a debugging what the root cause of the error is is difficult.

Describe the solution you'd like I'd like to pass a template string to a MRML validate method, and it returns a collection of the errors it has encountered. An output similar to what mjml-cli -v produces would be amazing:

$ mjml -v malformed.mjml
Line 8 of test.mjml (b) — Element b doesn't exist or is not registered

Command line error:
Validation failed

... for example:

errors = MRML.validate("...")
[
  "Line 8 (b) - Element b doesn't exist or is not registered",
  ...
]

Is this something you'd be open to?

autonomous avatar Dec 28 '23 15:12 autonomous

Hi @autonomous, thanks for the report. The mrml rust library does not provide a validate method. You can open an issue there and if it gets implemented I will add it to mrml-ruby.

jonian avatar Jan 09 '24 09:01 jonian