8000 Ambiguous/wrong example of union in Query String section · Issue #767 · raml-org/raml-spec · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 17, 2024. It is now read-only.
This repository was archived by the owner on Feb 17, 2024. It is now read-only.
Ambiguous/wrong example of union in Query String section #767
Open
@looseale

Description

@looseale

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0