|
| 1 | +#%RAML 1.0 |
| 2 | +title: My Company API |
| 3 | +baseUri: http://my-company.com/{version} |
| 4 | +version: v1 |
| 5 | +mediaType: application/vnd.api+json |
| 6 | +description: My Company API description RAML templates |
| 7 | +uses: |
| 8 | + file: raml/templates.raml |
| 9 | +types: |
| 10 | + ID: |
| 11 | + type: integer |
| 12 | + required: true |
| 13 | + maximum: 20 |
| 14 | + SID: |
| 15 | + type: string |
| 16 | + required: true |
| 17 | + maxLength: 128 |
| 18 | + Type: |
| 19 | + type: string |
| 20 | + required: true |
| 21 | + minLength: 1 |
| 22 | + maxLength: 255 |
| 23 | + DataObject: |
| 24 | + type: object |
| 25 | + required: true |
| 26 | + DataArray: |
| 27 | + type: array |
| 28 | + required: true |
| 29 | + RelationshipsDataItem: |
| 30 | + type: object |
| 31 | + properties: |
| 32 | + id: ID |
| 33 | + type: Type |
| 34 | + RelationshipsDataItemSID: |
| 35 | + type: object |
| 36 | + properties: |
| 37 | + id: SID |
| 38 | + type: Type |
| 39 | + Redis: |
| 40 | + type: object |
| 41 | + TagRelationships: |
| 42 | + description: Tag relationship description |
| 43 | + type: object |
| 44 | + properties: |
| 45 | + data: |
| 46 | + type: DataArray |
| 47 | + items: |
| 48 | + type: RelationshipsDataItem |
| 49 | + TagAttributes: |
| 50 | + description: Always set attributes for object |
| 51 | + type: object |
| 52 | + properties: |
| 53 | + title: |
| 54 | + type: string |
| 55 | + required: true |
| 56 | + minLength: 3 |
| 57 | + Tag: |
| 58 | + type: object |
| 59 | + properties: |
| 60 | + type: Type |
| 61 | + id: ID |
| 62 | + attributes: TagAttributes |
| 63 | + relationships: |
| 64 | + type: ArticleRelationships[] |
| 65 | + cache: |
| 66 | + type: Redis |
| 67 | + properties: |
| 68 | + stampede_xfetch: |
| 69 | + type: boolean |
| 70 | + default: true |
| 71 | + stampede_beta: |
| 72 | + type: number |
| 73 | + default: 1.1 |
| 74 | + ttl: |
| 75 | + type: integer |
| 76 | + default: 3600 |
| 77 | + ArticleRelationships: |
| 78 | + type: object |
| 79 | + properties: |
| 80 | + data: |
| 81 | + type: DataArray |
| 82 | + items: |
| 83 | + type: RelationshipsDataItem |
| 84 | + ArticleAttributes: |
| 85 | + description: Article attributes description |
| 86 | + type: object |
| 87 | + properties: |
| 88 | + title: |
| 89 | + required: true |
| 90 | + type: string |
| 91 | + minLength: 16 |
| 92 | + maxLength: 256 |
| 93 | + facets: |
| 94 | + index: |
| 95 | + idx_title: index |
| 96 | + description: |
| 97 | + required: true |
| 98 | + type: string |
| 99 | + minLength: 32 |
| 100 | + maxLength: 1024 |
| 101 | + facets: |
| 102 | + spell_check: true |
| 103 | + spell_language: en |
| 104 | + url: |
| 105 | + required: false |
| 106 | + type: string |
| 107 | + minLength: 16 |
| 108 | + maxLength: 255 |
| 109 | + facets: |
| 110 | + index: |
| 111 | + idx_url: unique |
| 112 | + show_in_top: |
| 113 | + description: Show at the top of main page |
| 114 | + required: false |
| 115 | + type: boolean |
| 116 | + status: |
| 117 | + description: The state of an article |
| 118 | + enum: ["draft", "published", "postponed", "archived"] |
| 119 | + facets: |
| 120 | + state_machine: |
| 121 | + initial: ['draft'] |
| 122 | + draft: ['published'] |
| 123 | + published: ['archived', 'postponed'] |
| 124 | + postponed: ['published', 'archived'] |
| 125 | + archived: [] |
| 126 | + topic_id: |
| 127 | + description: ManyToOne Topic relationship |
| 128 | + required: true |
| 129 | + type: integer |
| 130 | + minimum: 1 |
| 131 | + maximum: 6 |
| 132 | + facets: |
| 133 | + index: |
| 134 | + idx_fk_topic_id: foreign |
| 135 | + references: id |
| 136 | + on: topic |
| 137 | + onDelete: cascade |
| 138 | + onUpdate: cascade |
| 139 | + rate: |
| 140 | + type: number |
| 141 | + minimum: 3 |
| 142 | + maximum: 9 |
| 143 | + format: double |
| 144 | + date_posted: |
| 145 | + type: date-only |
| 146 | + time_to_live: |
| 147 | + type: time-only |
| 148 | + deleted_at: |
| 149 | + type: datetime |
| 150 | + Article: |
| 151 | + type: object |
| 152 | + properties: |
| 153 | + type: Type |
| 154 | + id: SID |
| 155 | + attributes: ArticleAttributes |
| 156 | + relationships: |
| 157 | + type: TagRelationships[] | TopicRelationships |
| 158 | + cache: |
| 159 | + type: Redis |
| 160 | + properties: |
| 161 | + stampede_xfetch: |
| 162 | + type: boolean |
| 163 | + default: true |
| 164 | + stampede_beta: |
| 165 | + type: number |
| 166 | + default: 1.5 |
| 167 | + ttl: |
| 168 | + type: integer |
| 169 | + default: 300 |
| 170 | + TopicRelationships: |
| 171 | + type: object |
| 172 | + properties: |
| 173 | + data: |
| 174 | + type: DataArray |
| 175 | + items: |
| 176 | + type: RelationshipsDataItem |
| 177 | + QueryParams: |
| 178 | + type: object |
| 179 | + properties: |
| 180 | + page: |
| 181 | + type: integer |
| 182 | + required: false |
| 183 | + description: page number |
| 184 | + limit: |
| 185 | + type: integer |
| 186 | + required: false |
| 187 | + default: 15 |
| 188 | + example: 15 |
| 189 | + description: elements per page |
| 190 | + sort: |
| 191 | + type: string |
| 192 | + required: false |
| 193 | + pattern: "asc|desc" |
| 194 | + default: "desc" |
| 195 | + access_token: |
| 196 | + type: string |
| 197 | + required: true |
| 198 | + example: db7329d5a3f381875ea6ce7e28fe1ea536d0acaf |
| 199 | + description: sha1 example |
| 200 | + default: db7329d5a3f381875ea6ce7e28fe1ea536d0acaf |
| 201 | + UserAttributes: |
| 202 | + type: object |
| 203 | + properties: |
| 204 | + first_name: |
| 205 | + required: true |
| 206 | + type: string |
| 207 | + minLength: 16 |
| 208 | + maxLength: 256 |
| 209 | + last_name: |
| 210 | + required: false |
| 211 | + type: string |
| 212 | + minLength: 16 |
| 213 | + maxLength: 256 |
| 214 | + facets: |
| 215 | + composite_index: |
| 216 | + index: ['first_name', 'last_name'] # can be unique, primary |
| 217 | + password: |
| 218 | + description: user password to refresh JWT (encrypted with password_hash) |
| 219 | + required: true |
| 220 | + type: string |
| 221 | + maxLength: 255 |
| 222 | + jwt: |
| 223 | + description: Special field to run JWT Auth via requests |
| 224 | + required: true |
| 225 | + type: string |
| 226 | + maxLength: 512 |
| 227 | + default: ' ' |
| 228 | + permissions: |
| 229 | + type: integer |
| 230 | + required: false |
| 231 | + maximum: 20 |
| 232 | + facets: |
| 233 | + bit_mask: |
| 234 | + publisher: 1 |
| 235 | + editor: 2 |
| 236 | + manager: 4 |
| 237 | + photo_reporter: 8 |
| 238 | + admin: 16 |
| 239 | + User: |
| 240 | + type: object |
| 241 | + properties: |
| 242 | + type: Type |
| 243 | + id: ID |
| 244 | + attributes: UserAttributes |
| 245 | + Trees: |
| 246 | + type: object |
| 247 | + properties: |
| 248 | + menu: |
| 249 | + type: boolean |
| 250 | + default: true |
| 251 | + MenuAttributes: |
| 252 | + type: object |
| 253 | + properties: |
| 254 | + title: |
| 255 | + required: true |
| 256 | + type: string |
| 257 | + rfc: |
| 258 | + type: string |
| 259 | + default: / |
| 260 | + parent_id: |
| 261 | + description: mandatory field for building trees |
| 262 | + type: integer |
| 263 | + maximum: 10 |
| 264 | + default: 0 |
| 265 | + Menu: |
| 266 | + type: object |
| 267 | + properties: |
| 268 | + type: Type |
| 269 | + id: ID |
| 270 | + attributes: MenuAttributes |
| 271 | +/article: |
| 272 | + get: |
| 273 | + queryParameters: QueryParams |
| 274 | + responses: |
| 275 | + 200: |
| 276 | + body: |
| 277 | + application/json.vnd+json: |
| 278 | + type: Article[] |
| 279 | + post: |
| 280 | + body: |
| 281 | + application/json.vnd+json: |
| 282 | + type: Article |
| 283 | + responses: |
| 284 | + 200: |
| 285 | + body: |
| 286 | + application/json.vnd+json: |
| 287 | + type: Article |
| 288 | + /{id}: |
| 289 | + get: |
| 290 | + responses: |
| 291 | + 200: |
| 292 | + body: |
| 293 | + application/json.vnd+json: |
| 294 | + type: Article |
| 295 | + patch: |
| 296 | + body: |
| 297 | + application/json.vnd+json: |
| 298 | + type: Article |
| 299 | + responses: |
| 300 | + 200: |
| 301 | + body: |
| 302 | + application/json.vnd+json: |
| 303 | + type: Article |
| 304 | + delete: |
| 305 | + responses: |
| 306 | + 204: |
| 307 | + /relationships/tag: |
| 308 | + get: |
| 309 | + responses: |
| 310 | + 200: |
| 311 | + body: |
| 312 | + application/json.vnd+json: |
| 313 | + type: TagRelationships |
| 314 | + post: |
| 315 | + body: |
| 316 | + application/json.vnd+json: |
| 317 | + type: TagRelationships |
| 318 | + responses: |
| 319 | + 201: |
| 320 | + body: |
| 321 | + application/json.vnd+json: |
| 322 | + type: TagRelationships |
| 323 | + patch: |
| 324 | + body: |
| 325 | + application/json.vnd+json: |
| 326 | + type: TagRelationships |
| 327 | + responses: |
| 328 | + 200: |
| 329 | + body: |
| 330 | + application/json.vnd+json: |
| 331 | + type: TagRelationships |
| 332 | + delete: |
| 333 | + responses: |
| 334 | + 204: |
| 335 | + /tag: |
| 336 | + get: |
| 337 | + responses: |
| 338 | + 200: |
| 339 | + body: |
| 340 | + application/json.vnd+json: |
| 341 | + type: Tag[] |
0 commit comments