Refer example from external file without validation in API workbench


I have examples of .json and .xml files and need to provide as the reference to the example for the responses in RAML. But would like them to be not validated against schema i.e not strict.

I had tried below options and faced problem as described below.

  1. // fails in API work bench validation
    example: !include examples/list.json
raml2html sample.raml > sample.html
{ [Error: Api contains errors.]
   [ { code: 11,
       message: 'object is expected',
       path: 'sample.raml',
       range: [Object],
       isWarning: false },
     { code: 11,
       message: 'Example does not conform to schema:Cannot assign to read only property \'$\' of 1',
       path: 'sample.raml',
       range: [Object],
       isWarning: false } ] }
  1. // file is not referenced and shown as "null" in RAML2HTML documentation.

example: strict: false value: !include examples/list.json

If I copy the contents to value, it would work, but I don’t want to copy the contents of the file to the value due to the file sizes of the examples are huge.

Is there any other way to make it work without validation from referencing external file ?


Maybe that’s a bug in the parser. Can you raise a ticket on the parser repo please. Don’t forget to post a reproducible example. I couldn’t reproduce it btw


Thanks Christian.
I think there was a bug before which did not validate the schema. But version API workbench 0.8.40 seems to validate properly. Which version are you using ?
If you look at example 2. Is it valid as per RAML schema to declare external file as value ? I think NOT hence parser complains. So I’m looking for a way to proper express this without copying the examples inline and no strict validation.