|
| 1 | +#%RAML 1.0 |
| 2 | +title: API for REST Services used in the RAML tutorials on Baeldung.com |
| 3 | +documentation: |
| 4 | + - title: Overview |
| 5 | + content: | |
| 6 | + This document defines the interface for the REST services |
| 7 | + used in the popular RAML Tutorial series at Baeldung.com. |
| 8 | + - title: Disclaimer |
| 9 | + content: | |
| 10 | + All names used in this definition are purely fictional. |
| 11 | + Any similarities between the names used in this tutorial and those of real persons, whether living or dead, are merely coincidental. |
| 12 | + - title: Copyright |
| 13 | + content: Copyright 2016 by Baeldung.com. All rights reserved. |
| 14 | +uses: |
| 15 | + mySecuritySchemes: !include libraries/securitySchemes.raml |
| 16 | + myDataTypes: !include libraries/dataTypes.raml |
| 17 | + myTraits: !include libraries/traits.raml |
| 18 | + myResourceTypes: !include libraries/resourceTypes.raml |
| 19 | +version: v1 |
| 20 | +protocols: [ HTTPS ] |
| 21 | +baseUri: http://rest-api.baeldung.com/api/{version} |
| 22 | +mediaType: application/json |
| 23 | +securedBy: [ mySecuritySchemes.basicAuth ] |
| 24 | +annotationTypes: |
| 25 | + testCase: |
| 26 | + allowedTargets: [ Method ] |
| 27 | + allowMultiple: true |
| 28 | + usage: | |
| 29 | + Use this annotation to declare a test case |
| 30 | + within a testSuite declaration. |
| 31 | + You may apply this annotation multiple times |
| 32 | + within the target testSuite. |
| 33 | + properties: |
| 34 | + scenario: string |
| 35 | + setupScript?: string[] |
| 36 | + testScript: string[] |
| 37 | + expectedOutput?: string |
| 38 | + cleanupScript?: string[] |
| 39 | +/foos: |
| 40 | + type: myResourceTypes.collection |
| 41 | + get: |
| 42 | + queryParameters: |
| 43 | + name?: string |
| 44 | + ownerName?: string |
| 45 | + responses: |
| 46 | + 200: |
| 47 | + body: |
| 48 | + example: !include examples/Foos.json |
| 49 | + (testCase): |
| 50 | + scenario: No Foos |
| 51 | + setupScript: deleteAllFoosIfAny |
| 52 | + testScript: getAllFoos |
| 53 | + expectedOutput: "" |
| 54 | + (testCase): |
| 55 | + scenario: One Foo |
| 56 | + setupScript: [ deleteAllFoosIfAny, addInputFoos ] |
| 57 | + testScript: getAllFoos |
| 58 | + expectedOutput: '[ { "id": 999, "name": Joe } ]' |
| 59 | + cleanupScript: deleteInputFoos |
| 60 | + (testCase): |
| 61 | + scenario: Multiple Foos |
| 62 | + setupScript: [ deleteAllFoosIfAny, addInputFoos ] |
| 63 | + testScript: getAllFoos |
| 64 | + expectedOutput: '[ { "id": 998, "name": "Bob" }, { "id": 999, "name": "Joe", "ownerName": "Bob" } ]' |
| 65 | + cleanupScript: deleteInputFoos |
| 66 | + post: |
| 67 | + responses: |
| 68 | + 200: |
| 69 | + body: |
| 70 | + example: !include examples/Foo.json |
| 71 | + /{fooId}: |
| 72 | + type: myResourceTypes.item |
| 73 | + get: |
| 74 | + responses: |
| 75 | + 200: |
| 76 | + body: |
| 77 | + example: !include examples/Foo.json |
| 78 | + put: |
| 79 | + responses: |
| 80 | + 200: |
| 81 | + body: |
| 82 | + example: !include examples/Foo.json |
| 83 | +/foos/name/{name}: |
| 84 | + get: |
| 85 | + description: Get all Foos with the name {name} |
| 86 | + responses: |
| 87 | + 200: |
| 88 | + body: |
| 89 | + type: myDataTypes.Foo |
| 90 | + 404: |
| 91 | + body: |
| 92 | + type: myDataTypes.Error |
| 93 | +/foos/bar/{barId}: |
| 94 | + get: |
| 95 | + description: Get the Foo for the Bar with barId = {barId} |
| 96 | + responses: |
| 97 | + 200: |
| 98 | + body: |
| 99 | + example: !include examples/Foo.json |
| 100 | +/bars: |
| 101 | + type: myResourceTypes.collection |
| 102 | + get: |
| 103 | + queryParameters: |
| 104 | + name?: string |
| 105 | + ownerName?: string |
| 106 | + responses: |
| 107 | + 200: |
| 108 | + body: |
| 109 | + example: !include examples/Bars.json |
| 110 | + post: |
| 111 | + responses: |
| 112 | + 200: |
| 113 | + body: |
| 114 | + example: !include examples/Bar.json |
| 115 | + /{barId}: |
| 116 | + type: myResourceTypes.item |
| 117 | + get: |
| 118 | + responses: |
| 119 | + 200: |
| 120 | + body: |
| 121 | + example: !include examples/Bar.json |
| 122 | + put: |
| 123 | + responses: |
| 124 | + 200: |
| 125 | + body: |
| 126 | + example: !include examples/Bars.json |
0 commit comments