The following example, written in RAML 1.0, defines two types of objects in Urland File, then creates another object Itemthat requires UrlOR Filein ext. If you change the attached examples (which are currently being tested), you will see that they fail if the property does not match one or the other definition. Hope this helps! LMK, if you have other questions, and I will do my best.
[EDIT: hmm I think I see your problem now, the last example I just added, with a name should_fail(which has one of each type together in the example) still checks, and you want to make it a failure.]
[: . . maxProperties: 1 , , . , .]
types:
Url:
properties:
url:
type: string
example: http://www.cats.com/kittens.jpg
description: |
The url to ingest.
File:
properties:
filename:
type: string
example: kittens.jpg
description: |
Name of the file that will be uploaded.
Item:
description: |
An example of a allowing multiple types yet requiring
one AND ONLY one of two possible types using RAML 1.0
properties:
ext:
maxProperties: 1
type: File | Url
examples:
file_example:
content:
ext:
filename: video.mp4
url_example:
content:
ext:
url: http://heres.a.url.com/asset.jpg
should_fail:
content:
ext:
url: http://heres.a.url.com/asset.jpg
filename: video.mp4