Skip to content

Commit 0cebf7d

Browse files
committed
Merge pull request #21 from fehguy/master
added model sample with sample values
2 parents f5de2b0 + 2fe376c commit 0cebf7d

File tree

4 files changed

+153
-0
lines changed

4 files changed

+153
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"models": {
3+
"Employee": {
4+
"description": "A representation of an employee",
5+
"properties": {
6+
"firstName": {
7+
"type": "string",
8+
"example": "Phil"
9+
},
10+
"lastName": {
11+
"type": "string",
12+
"example": "Dirt"
13+
},
14+
"address": {
15+
"type": "Address",
16+
"description": "The employees primary address"
17+
}
18+
},
19+
"required": [ "firstName", "lastName", "address" ]
20+
},
21+
"Address": {
22+
"description": "An address",
23+
"properties": {
24+
"street1": {
25+
"type": "string"
26+
},
27+
"street2": {
28+
"type": "string"
29+
},
30+
"city": {
31+
"type": "string"
32+
},
33+
"state": {
34+
"type": "string"
35+
},
36+
"postalCode": {
37+
"type": "string"
38+
}
39+
},
40+
"required": [
41+
"street1", "city", "state", "postalCode"
42+
],
43+
"examples": [
44+
{
45+
"application/json": {
46+
"street1": "12345 El Monte Blvd",
47+
"city": "Los Altos Hills",
48+
"state": "CA",
49+
"postalCode": "94110"
50+
},
51+
"application/xml": {
52+
"$ref": "http://foo/bar/examples/definitions/address/xml"
53+
}
54+
}
55+
]
56+
}
57+
}
58+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"models": {
3+
"StringToIntegerMap": {
4+
"additionalProperties": {
5+
"type": "integer",
6+
"format": "int32"
7+
}
8+
},
9+
"StringToStringMap": {
10+
"additionalProperties": {
11+
"type": "string"
12+
}
13+
},
14+
"StringToDateMap": {
15+
"additionalProperties": {
16+
"type": "string",
17+
"format": "date-time"
18+
}
19+
},
20+
"NestedMap": {
21+
"additionalProperties": {
22+
"$ref": "StringToDateMap"
23+
}
24+
}
25+
}
26+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"models": {
3+
"Person": {
4+
"description": "A representation of a person",
5+
"required": [
6+
"id",
7+
"birthDate"
8+
],
9+
"properties": {
10+
"id": {
11+
"type": "integer",
12+
"format": "int64",
13+
"description": "the ID of the user",
14+
"readOnly": true,
15+
"xmlFormat": "attribute"
16+
},
17+
"firstName": {
18+
"type": "string"
19+
},
20+
"middleInitial": {
21+
"type": "string"
22+
},
23+
"lastName": {
24+
"type": "string"
25+
},
26+
"notes": {
27+
"type": "string",
28+
"xmlFormat": "text"
29+
},
30+
"age": {
31+
"type": "integer",
32+
"format": "int32",
33+
"min": 0,
34+
"readOnly": true
35+
},
36+
"birthDate": {
37+
"type": "string",
38+
"format": "date-time"
39+
},
40+
"address": {
41+
"$ref": "Address",
42+
"xmlNamespace": "abc"
43+
}
44+
}
45+
}
46+
}
47+
}

samples/v2.0/json/09-responses.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"responses": {
3+
"200": {
4+
"description": "Returns an array of pets",
5+
"type": "array",
6+
"items": {
7+
"$ref": "Pet"
8+
}
9+
},
10+
"400": {
11+
"description": "Invalid ID supplied <= this is purely for documentation",
12+
"type": "ErrorModel"
13+
},
14+
"404": {
15+
"description": "Pet not found"
16+
},
17+
"default": {
18+
"description": "Some other terrible error",
19+
"type": "ErrorModel"
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)