Skip to content

Commit d3c8561

Browse files
author
Ole Lensmar
committed
added initial yaml versions of the samples and removed description from externally ref:ed tag
1 parent 38bc48c commit d3c8561

File tree

6 files changed

+146
-1
lines changed

6 files changed

+146
-1
lines changed

guidelines/sample-server/files/models.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"format": "int64"
99
},
1010
"tag": {
11-
"description": "a complex, shared property. Note the absolute reference",
1211
"$ref": "https://my.company.com/definitions/models.json#/models/Tag"
1312
}
1413
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
Model:
2+
type: "object"
3+
description: "A simple model"
4+
properties:
5+
id:
6+
type: "integer"
7+
format: "int64"
8+
tag:
9+
$ref: "https://my.company.com/definitions/models.yaml#/models/Tag"
10+
Tag:
11+
type: "object"
12+
description: "A tag entity in the system"
13+
properties:
14+
name:
15+
type: "string"
16+
Health:
17+
type: "object"
18+
description: "An object representing the health of a server"
19+
required:
20+
- "liveThreadCount"
21+
- "peakThreadCount"
22+
- "startedThreadCount"
23+
- "daemonThreadCount"
24+
- "jvmMemory"
25+
properties:
26+
liveThreadCount:
27+
type: "integer"
28+
format: "int32"
29+
peakThreadCount:
30+
type: "integer"
31+
format: "int32"
32+
startedThreadCount:
33+
type: "integer"
34+
format: "int32"
35+
daemonThreadCount:
36+
type: "integer"
37+
format: "int32"
38+
jvmMemory:
39+
$ref: "http://localhost:8000/models.yaml#/JVMMemory"
40+
JVMMemory:
41+
type: "object"
42+
required:
43+
- "allocated"
44+
- "max"
45+
- "free"
46+
- "used"
47+
- "percentUsed"
48+
properties:
49+
allocated:
50+
type: "integer"
51+
format: "int64"
52+
max:
53+
type: "integer"
54+
format: "int64"
55+
free:
56+
type: "integer"
57+
format: "int64"
58+
used:
59+
type: "integer"
60+
format: "int64"
61+
percentUsed:
62+
type: "number"
63+
format: "double"
64+
ErrorMessage:
65+
type: "object"
66+
description: "A shared model for error message"
67+
required:
68+
- "errorCode"
69+
- "reason"
70+
properties:
71+
errorCode:
72+
type: "integer"
73+
format: "int64"
74+
reason:
75+
description: "the reason for this error"
76+
type: "string"
77+
description:
78+
description: "an optional longer description of this error message"
79+
type: "string"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
health:
2+
get:
3+
tags:
4+
- "admin"
5+
summary: "Returns server health information"
6+
operationId: "getHealth"
7+
produces:
8+
- "application/json"
9+
parameters: []
10+
responses:
11+
200:
12+
description: "Health information from the server"
13+
schema:
14+
$ref: "http://localhost:8000/models.yaml#/Health"
15+
404:
16+
$ref: "http://localhost:8000/responses.yaml#/NotFoundError"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
query:
2+
skip:
3+
name: "skip"
4+
in: "query"
5+
description: "Results to skip when paginating through a result set"
6+
required: false
7+
minimum: 0
8+
type: "integer"
9+
format: "int32"
10+
limit:
11+
name: "limit"
12+
in: "query"
13+
description: "Maximum number of results to return"
14+
required: false
15+
minimum: 0
16+
type: "integer"
17+
format: "int32"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NotFoundError:
2+
description: "Entity not found"
3+
schema:
4+
$ref: "http://localhost:8000/models.yaml#/ErrorMessage"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
swagger: "2.0"
2+
info:
3+
description: "Sample server to demonstrate object reuse"
4+
version: "1.0.0"
5+
title: "Swagger sample"
6+
paths:
7+
/health:
8+
$ref: "http://localhost:8000/operations.yaml#/health"
9+
/users:
10+
get:
11+
tags:
12+
- "users"
13+
summary: "Returns users in the system"
14+
operationId: "getUsers"
15+
produces:
16+
- "application/json"
17+
parameters:
18+
-
19+
$ref: "http://localhost:8000/parameters.yaml#/query/skip"
20+
-
21+
$ref: "http://localhost:8000/parameters.yaml#/query/limit"
22+
responses:
23+
200:
24+
description: "Users in the system"
25+
schema:
26+
type: "array"
27+
items:
28+
$ref: "http://localhost:8000/models.yaml#/Health"
29+
404:
30+
$ref: "http://localhost:8000/responses.yaml#/NotFoundError"

0 commit comments

Comments
 (0)