Skip to content

Commit 79045b5

Browse files
committed
[new_feature] added any-of and one-of functionality
1 parent bda84a9 commit 79045b5

File tree

10 files changed

+1119
-91
lines changed

10 files changed

+1119
-91
lines changed

.eslintrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/examples/anyof.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!doctype html>
2+
<head>
3+
<!-- Global site tag (gtag.js) - Google Analytics -->
4+
<script async src='https://www.googletagmanager.com/gtag/js?id=UA-132775238-1'></script>
5+
<script>
6+
window.dataLayer = window.dataLayer || [];
7+
function gtag(){dataLayer.push(arguments);}
8+
gtag('js', new Date());
9+
gtag('config', 'UA-132775238-1');
10+
</script>
11+
<meta charset='utf-8'>
12+
<meta name='viewport' content='width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes'>
13+
<link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet'>
14+
<script type='text/javascript' src='../rapidoc-min.js'></script>
15+
</head>
16+
<body>
17+
<rapi-doc id='thedoc' spec-url='./specs/anyof.json' > </rapi-doc>
18+
</body>
19+
</html>

docs/examples/specs/anyof.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
"/api/employee": {
1010
"get": {
1111
"tags": [ "Employee Details"],
12-
"summary": "summary",
12+
"summary": "List of employees",
1313
"operationId": "empDetails",
1414
"responses": {
1515
"200": {
1616
"description": "description",
1717
"schema": {
1818
"type": "array",
1919
"items": {
20-
"$ref": "#/definitions/Type0"
20+
"$ref": "#/definitions/employee"
2121
}
2222
}
2323
}
@@ -26,37 +26,36 @@
2626
}
2727
},
2828
"definitions": {
29-
"Type0": {
29+
"employee": {
3030
"type": "object",
3131
"additionalProperties": false,
3232
"properties": {
3333
"Id": { "type": "string", "description": "Employee ID"},
3434
"Employee": {
35-
"description": "Employee Details (Nested)",
36-
"anyOf": [
37-
{ "$ref": "#/definitions/Type1"},
38-
{ "$ref": "#/definitions/Type2"}
35+
"description": "Employee Details (Worker or Manager)",
36+
"oneOf": [
37+
{ "$ref": "#/definitions/manager"},
38+
{ "$ref": "#/definitions/worker"}
3939
]
4040
}
4141
}
4242
},
43-
"Type1": {
43+
"manager": {
4444
"type": "object",
4545
"additionalProperties": false,
4646
"properties": {
47-
"name": { "type": "string", "description": "Name of a Person" },
48-
"age": { "type": "number", "description": "Age in Years" }
47+
"name": { "type": "string", "description": "Name of employee" },
48+
"directReports": { "type": "number", "description": "Count of direct reports" }
4949
}
5050
},
51-
"Type2": {
51+
"worker": {
5252
"type": "object",
5353
"additionalProperties": false,
5454
"properties": {
55-
"department": { "type": "string", "description": "Department of the person" },
56-
"salary": { "type": "number", "description": "Yearly Salary" }
55+
"name": { "type": "string", "description": "Name of employee" },
56+
"managerName": { "type": "string", "description": "Name of manager" }
5757
}
58-
}
59-
58+
}
6059
},
6160
"tags": [
6261
{ "name": "Employee Details", "description": "Employee Details" }

0 commit comments

Comments
 (0)