-
Notifications
You must be signed in to change notification settings - Fork 121
Validation of example is trying to parse a date value as XML or JSON #665
Comments
It now checks to see if it parses, otherwise, it treats as a string....
The way I can do this is attempt to actually parse the example as either XML or JSON and upon failing that, not treat it as a XML or JSON document. This makes invalid JSON examples error messages more obscure:
used to say: "Error validating JSON. Error: Unexpected character ('x' (code 120)): was expecting double-quote to start field name" Honestly, I don't think it's worth the change. I'll try to find a better solution, but there's not many variations. |
It now checks to see if it parses, otherwise, it treats as a string....
It now checks to see if it parses, otherwise, it treats as a string....
On a semi-related note: be aware that in RAML, examples do not have to be defined in the same syntax as the media type(s) of the parent resource. There are two reasons for this:
|
The issue comes from the fact that there is "pre-processing" validation happening when an example defined on ANY type starts with either @juanchib: make sense? |
@jstoiko yes it makes total sense to me. Thanks |
* Best attempt at fixing #665 It now checks to see if it parses, otherwise, it treats as a string.... * Best attempt at fixing #665 It now checks to see if it parses, otherwise, it treats as a string.... * Best attempt at fixing #665 It now checks to see if it parses, otherwise, it treats as a string.... * Better first part of a solution. * This works, I think. * Simpler approach.
* Best attempt at fixing raml-org#665 It now checks to see if it parses, otherwise, it treats as a string.... * Best attempt at fixing raml-org#665 It now checks to see if it parses, otherwise, it treats as a string.... * Best attempt at fixing raml-org#665 It now checks to see if it parses, otherwise, it treats as a string.... * Better first part of a solution. * This works, I think. * Simpler approach.
Validation of the example is throwing
- Error validating XML. Error: The markup in the document preceding the root element must be well-formed. [line=11, col=17]
when the expected error message isProvided value <2019-09-09> is not compliant with the format date_only provided in rfc3339
Same happen when the example value starts with
{
the example is treated as JSON.The text was updated successfully, but these errors were encountered: