This repository has been archived by the owner on Jan 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 235
/
complex.raml
60 lines (60 loc) · 1.89 KB
/
complex.raml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#%RAML 1.0
title: My API with Types
mediaType: application/json
types:
Org:
type: object
properties:
onCall: Alertable # inherits all properties from type `Alertable`
Head: Manager # inherits all properties from type `Manager`
Person:
type: object
discriminator: kind # reference to the `kind` property of `Person`
properties:
firstname: string
lastname: string
title?: string
kind: string # may be used to differenciate between classes that extend from `Person`
Phone:
type: string
pattern: "^[0-9|-]+$" # defines pattern for the content of type `Phone`
Manager:
type: Person # inherits all properties from type `Person`
properties:
reports: Person[] # inherits all properties from type `Person`; array type where `[]` is a shortcut
phone: Phone
Admin:
type: Person # inherits all properties from type `Person`
properties:
clearanceLevel:
enum: [ low, high ]
AlertableAdmin:
type: Admin # inherits all properties from type `Admin`
properties:
phone: Phone # inherits all properties from type `Phone`; uses shortcut syntax
Alertable: Manager | AlertableAdmin # union type; either a `Manager` or `AlertableAdmin`
/orgs/{orgId}:
get:
responses:
200:
body:
application/json:
type: Org # reference to global type definition
example:
onCall:
firstname: nico
lastname: ark
kind: AlertableAdmin
clearanceLevel: low
phone: "12321"
Head:
firstname: nico
lastname: ark
kind: Manager
reports:
-
firstname: nico
lastname: ark
kind: Admin
clearanceLevel: low
phone: "123-23"