Skip to content

Commit 6fd289c

Browse files
Kevin Gilmoredavidmorley
authored andcommitted
Added RAML files for first two articles
1 parent b83c04e commit 6fd289c

File tree

23 files changed

+632
-0
lines changed

23 files changed

+632
-0
lines changed

raml/introduction/0.8/api.raml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#%RAML 0.8
2+
title: Baeldung Foo REST Services API
3+
version: v1
4+
protocols: [ HTTPS ]
5+
baseUri: http://rest-api.baeldung.com/api/{version}
6+
mediaType: application/json
7+
securitySchemes:
8+
- basicAuth:
9+
description: Each request must contain the headers necessary for
10+
basic authentication
11+
type: Basic Authentication
12+
describedBy:
13+
headers:
14+
Authorization:
15+
description: Used to send the Base64 encoded "username:password"
16+
credentials
17+
type: string
18+
responses:
19+
401:
20+
description: |
21+
Unauthorized. Either the provided username and password
22+
combination is invalid, or the user is not allowed to access
23+
the content provided by the requested URL.
24+
25+
schemas:
26+
- foo: !include foo.json
27+
- foos: !include foos.json
28+
- error: !include error.json
29+
30+
/foos:
31+
get:
32+
description: List all Foos matching query criteria, if provided;
33+
otherwise list all Foos
34+
queryParameters:
35+
name:
36+
type: string
37+
required: false
38+
ownerName:
39+
type: string
40+
required: false
41+
responses:
42+
200:
43+
body:
44+
application/json:
45+
schema: foos
46+
example: !include foos-example.json
47+
post:
48+
description: Create a new Foo
49+
body:
50+
application/json:
51+
schema: foo
52+
example: foo-example.json
53+
responses:
54+
201:
55+
body:
56+
application/json:
57+
schema: foo
58+
example: foo-example.json
59+
/{id}:
60+
get:
61+
description: Get a Foo by id
62+
responses:
63+
200:
64+
body:
65+
application/json:
66+
schema: foo
67+
404:
68+
body:
69+
application/json:
70+
schema: error
71+
put:
72+
description: Update a Foo by id
73+
body:
74+
application/json:
75+
schema: foo
76+
example: foo-example.json
77+
responses:
78+
200:
79+
body:
80+
application/json:
81+
schema: foo
82+
404:
83+
body:
84+
application/json:
85+
schema: error
86+
delete:
87+
description: Delete a Foo by id
88+
responses:
89+
204:
90+
404:
91+
body:
92+
application/json:
93+
schema: error
94+
/name/{name}:
95+
get:
96+
description: List all Foos with a certain name
97+
responses:
98+
200:
99+
body:
100+
application/json:
101+
schema: foos
102+
example: !include foos-example.json
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"message" : "Not found",
3+
"code" : 1001
4+
}

raml/introduction/0.8/error.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ "$schema": "http://json-schema.org/schema",
2+
"type": "object",
3+
"description": "Error message",
4+
"properties": {
5+
"message": { "type": "string" },
6+
"code": { "type": integer }
7+
},
8+
"required": [
9+
"message",
10+
"code"
11+
]
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"id" : 1,
3+
"name" : "First Foo"
4+
}

raml/introduction/0.8/foo.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{ "$schema": "http://json-schema.org/schema",
2+
"type": "object",
3+
"description": "Foo details",
4+
"properties": {
5+
"id": { "type": integer },
6+
"name": { "type": "string" },
7+
"ownerName": { "type": "string" }
8+
},
9+
"required": [
10+
"id",
11+
"name"
12+
]
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"id" : 1,
4+
"name" : "First Foo"
5+
},
6+
{
7+
"id" : 2,
8+
"name" : "Second Foo"
9+
}
10+
]

raml/introduction/0.8/foos.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{ "$schema": "http://json-schema.org/schema",
2+
"type": "array",
3+
"items": { "$ref": "foo" }
4+
"description": "Collection of Foos"
5+
}

raml/introduction/1.0/api.raml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#%RAML 1.0
2+
title: Baeldung Foo REST Services API
3+
version: v1
4+
protocols: [ HTTPS ]
5+
baseUri: http://rest-api.baeldung.com/api/{version}
6+
mediaType: application/json
7+
securedBy: basicAuth
8+
securitySchemes:
9+
- basicAuth:
10+
description: Each request must contain the headers necessary for
11+
basic authentication
12+
type: Basic Authentication
13+
describedBy:
14+
headers:
15+
Authorization:
16+
description: Used to send the Base64 encoded "username:password"
17+
credentials
18+
type: string
19+
responses:
20+
401:
21+
description: |
22+
Unauthorized. Either the provided username and password
23+
combination is invalid, or the user is not allowed to access
24+
the content provided by the requested URL.
25+
types:
26+
Foo: !include types/Foo.raml
27+
Error: !include types/Error.raml
28+
/foos:
29+
get:
30+
description: List all Foos matching query criteria, if provided;
31+
otherwise list all Foos
32+
queryParameters:
33+
name?: string
34+
ownerName?: string
35+
responses:
36+
200:
37+
body:
38+
application/json:
39+
type: Foo[]
40+
example: !include examples/Foos.json
41+
post:
42+
description: Create a new Foo
43+
body:
44+
application/json:
45+
type: Foo
46+
example: !include examples/Foo.json
47+
responses:
48+
201:
49+
body:
50+
application/json:
51+
type: Foo
52+
example: !include examples/Foo.json
53+
/{id}:
54+
get:
55+
description: Get a Foo by id
56+
responses:
57+
200:
58+
body:
59+
application/json:
60+
type: Foo
61+
example: !include examples/Foo.json
62+
404:
63+
body:
64+
application/json:
65+
type: Error
66+
example: !include examples/Error.json
67+
put:
68+
description: Update a Foo by id
69+
body:
70+
application/json:
71+
type: Foo
72+
example: !include examples/Foo.json
73+
responses:
74+
200:
75+
body:
76+
application/json:
77+
type: Foo
78+
example: !include examples/Foo.json
79+
404:
80+
body:
81+
application/json:
82+
type: Error
83+
example: !include examples/Error.json
84+
delete:
85+
description: Delete a Foo by id
86+
responses:
87+
204:
88+
404:
89+
body:
90+
application/json:
91+
type: Error
92+
example: !include examples/Error.json
93+
/name/{name}:
94+
get:
95+
description: List all Foos with a certain name
96+
responses:
97+
200:
98+
body:
99+
application/json:
100+
type: Foo[]
101+
example: !include examples/Foos.json
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"message" : "Not found",
3+
"code" : 1001
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"id" : 1,
3+
"name" : "First Foo"
4+
}

0 commit comments

Comments
 (0)