Example strict validation in API workbench


#1

Hi,
If I understand as per spec, the strict specified inside the example meaning the example is validated against the type. But If I specify a schema and corresponding XML, although the sample XML is valid the workbench complains of

Example does not conform to schema: Cannot create property '$' on boolean 'true'

Also what is the use of value inside example ? i.e for the below raml, both are accepted. but which is more appropriate to use? when to use value. The API definition seems to be not clear to me.

    example:
      strict: true
      value: !include examples/list.xml

      example:  !include examples/list.xml

#2

Both syntax are completely valid. You use value only if you want to add additional facets or annotations such as strict. I think the problem you are seeing might be related to https://github.com/raml-org/raml-js-parser-2/issues/485 which should have been fixed. Can you try to include it explicitely to see if the problem persists?


#3

Thanks for the response.

If I understand when you mean explicitly is like below, then there is no validation happening.

  example:  !include examples/list.xml

I gave some unknown elements in example XML and workbench did not complain. where as if specify “strict” it complains even if the XML is valid. The version of API workbench installed in Atom is “0.8.38” which seems latest.


#4

What I mean by explicitly is instead of using !include just copy and paste the content into example like:

example: |
  <node>test</node>

#5

no, it does not validate. It is green “No issues” in the api work bench.


#6

Thanks! Can you raise an issue on the workbench github repo and explain your situation as well as including your code.