|
9 | 9 | "/api/employee": {
|
10 | 10 | "get": {
|
11 | 11 | "tags": [ "Employee Details"],
|
12 |
| - "summary": "summary", |
| 12 | + "summary": "List of employees", |
13 | 13 | "operationId": "empDetails",
|
14 | 14 | "responses": {
|
15 | 15 | "200": {
|
16 | 16 | "description": "description",
|
17 | 17 | "schema": {
|
18 | 18 | "type": "array",
|
19 | 19 | "items": {
|
20 |
| - "$ref": "#/definitions/Type0" |
| 20 | + "$ref": "#/definitions/employee" |
21 | 21 | }
|
22 | 22 | }
|
23 | 23 | }
|
|
26 | 26 | }
|
27 | 27 | },
|
28 | 28 | "definitions": {
|
29 |
| - "Type0": { |
| 29 | + "employee": { |
30 | 30 | "type": "object",
|
31 | 31 | "additionalProperties": false,
|
32 | 32 | "properties": {
|
33 | 33 | "Id": { "type": "string", "description": "Employee ID"},
|
34 | 34 | "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"} |
39 | 39 | ]
|
40 | 40 | }
|
41 | 41 | }
|
42 | 42 | },
|
43 |
| - "Type1": { |
| 43 | + "manager": { |
44 | 44 | "type": "object",
|
45 | 45 | "additionalProperties": false,
|
46 | 46 | "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" } |
49 | 49 | }
|
50 | 50 | },
|
51 |
| - "Type2": { |
| 51 | + "worker": { |
52 | 52 | "type": "object",
|
53 | 53 | "additionalProperties": false,
|
54 | 54 | "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" } |
57 | 57 | }
|
58 |
| - } |
59 |
| - |
| 58 | + } |
60 | 59 | },
|
61 | 60 | "tags": [
|
62 | 61 | { "name": "Employee Details", "description": "Employee Details" }
|
|
0 commit comments