This repository was archived by the owner on Feb 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 848
Ambiguous/wrong example of union in Query String section #767
Copy link
Copy link
Open
Description
Hi.
I'm reporting an error in an example in the spec of RAML 1.0.
In the section The Query String as a Whole there is an example API which comments and examples are showing that an union elements must be validated exclusively (like a JSON Schema oneOf).
#%RAML 1.0
title: Illustrate query parameter variations
types:
lat-long: # lat & long required; mutually exclusive with location
properties:
lat: number
long: number
loc: # location required; mutually exclusive with lat & long
properties:
location:
paging: # each is optional, not exclusive with anything
properties:
start?: number
page-size?: number
/locations:
get:
queryString:
type: [paging, lat-long | loc ]
examples:
first:
value:
start: 2
lat: 12
long: 13
second:
value:
start: 2
page-size: 20
location: 1,2
third: # not valid
value:
lat: 12
location: 2
strict: false # because it's not valid
But, in the section Union Type, the text express clearly that they could be inclusive (like a JSON Schema anyOf): An instance of a union type SHALL be considered valid if and only if it meets all restrictions associated with at least one of the super types. It also give an example very similar to the one in Query String section, multiple inheritance mixed with unions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels