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.

Type declaration for a union type #530

@antoniogarrote

Description

@antoniogarrote

Hi.

I'm working on a particular use case: generating stand-alone type declarations not using any user introduced type names.
This is useful in situations where you cannot keep the name-to-declaration mapping information and I think it makes the specification more consistent.

For other types this can be easily achieved just replacing the name of the type by its declaration in a recursive way.
However, if I understand the spec correctly, union types can only be introduced using type expressions involving type names.

I would like to express the same union type with a normal type declaration.

A possible syntax could be:

type: union
of: 
  - TypeA
  # ...
  - TypeN

In this way I could express this RAML type 'schema':

types:
  TypeA:
    type: object
    properties:
      a:
        type: string
  TypeB:
    type: object
    properties:
      b:
        type: string
  TypeUnion: TypeA | TypeB

In this stand-alone inline type declaration:

#%RAML 1.0
type: union
of:
  - type: object
    properties:
      a:
        type: string
  - type: object
    properties:
      b:
        type: string

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions