|
| 1 | +swagger: '2.0' |
| 2 | +schemes: |
| 3 | + - http |
| 4 | + - https |
| 5 | +host: barcelonapm.github.io # Replace with your hostname. You can also specify port e.g. example.com:777 |
| 6 | +basePath: / |
| 7 | +info: |
| 8 | + description: Project-X Swagger Specification |
| 9 | + version: '0.0.1' |
| 10 | + # It can be any string but it is better to use semantic versioning: http://semver.org/ |
| 11 | + # Warning: OpenAPI require version to be string, but without quotation YAML can recognize it as number. |
| 12 | + title: Barcelona PM - project-X |
| 13 | + termsOfService: 'http://barcelona.pm.org/#bugs' |
| 14 | + contact: |
| 15 | + email: barcelona-pm@pm.org |
| 16 | + url: 'https://www.meetup.com/barcelonapm/' |
| 17 | + license: |
| 18 | + name: Dummy 2.0 |
| 19 | + url: 'http://barcelona.pm.org/' |
| 20 | + x-logo: |
| 21 | + url: 'https://secure.meetupstatic.com/photos/event/5/b/1/2/600_456143314.jpeg' |
| 22 | +externalDocs: |
| 23 | + description: Our Cool Project |
| 24 | + url: 'https://github.com/barcelonapm/project-X' |
| 25 | +produces: |
| 26 | + # List of mime types your API endpoins can return. |
| 27 | + # This is a global default. You can OVERWRITE it in each specific operation. |
| 28 | + # Remove the ones not used in your API |
| 29 | + - application/json |
| 30 | + - application/xml |
| 31 | + # you can add any mime type your API produces to the list |
| 32 | +consumes: |
| 33 | + # List of mime types your API endpoins consumes. |
| 34 | + # This is a global default. You can OVERWRITE it in each specific operation. |
| 35 | + # Remove the ones not supported by your API |
| 36 | + - application/json |
| 37 | + - application/xml |
| 38 | + # you can add any mime type your API consumes to the list |
| 39 | + |
| 40 | +# A list of tags used by the specification with additional metadata. |
| 41 | +# The order of the tags can be used to reflect on their order by the parsing tools. |
| 42 | +tags: |
| 43 | + - name: Dates |
| 44 | + description: Operations about dates |
| 45 | + - name: Enroll |
| 46 | + description: Operations about Enrolling |
| 47 | + - name: Price |
| 48 | + description: Operations about Price |
| 49 | + - name: Schedule |
| 50 | + description: Operations about Schedule |
| 51 | + - name: Speakers |
| 52 | + description: Operations about Speaker |
| 53 | + - name: Title |
| 54 | + description: Operations about Talk Titles |
| 55 | +# Security scheme definitions that can be used across the specification. |
| 56 | +securityDefinitions: |
| 57 | + main_auth: # security definition name (you can name it as you want) |
| 58 | + type: oauth2 # authorization type, one of: oauth2, basic, apiKey |
| 59 | + # the following options are specific to oauth2 type |
| 60 | + authorizationUrl: 'http://example.com/api/oauth/dialog' |
| 61 | + flow: implicit |
| 62 | + scopes: |
| 63 | + 'read:speaker': read speakers info |
| 64 | + 'write:speaker': modify speakers |
| 65 | + 'create:speaker': create speakers |
| 66 | + 'delete:speaker': delete speakers |
| 67 | + api_key: # security definition name (you can name it as you want) |
| 68 | + type: apiKey |
| 69 | + # The following options are specific to apiKey type |
| 70 | + in: header # Where API key will be passed: header or query |
| 71 | + name: api_key # API key paramteer name |
| 72 | +# basic_auth: # security definition name (you can name it as you want) |
| 73 | +# type: basic |
| 74 | + |
| 75 | +# Holds the relative paths to the individual endpoints. The path is appended to the |
| 76 | +# basePath in order to construct the full URL. |
| 77 | +paths: |
| 78 | + '/speakers/{speakerId}': # path parameter in curly braces |
| 79 | + # parameters list that are used with each operation for this path |
| 80 | + parameters: |
| 81 | + - $ref: '#/parameters/pretty' |
| 82 | + get: |
| 83 | + tags: |
| 84 | + - Speakers |
| 85 | + # summary is up to 120 symbold but we recommend to be shortest as possible |
| 86 | + summary: Get Speaker by Id. |
| 87 | + description: Retrieve the Speaker identified by its Id Code. |
| 88 | + # operationId should be unique across the whole specification |
| 89 | + operationId: getSpeakerById |
| 90 | + # list of parameters for the operation |
| 91 | + parameters: |
| 92 | + - $ref: '#/parameters/speakerId' |
| 93 | + # security schemas applied to this operation |
| 94 | + security: |
| 95 | + - main_auth: |
| 96 | + - 'read:speaker' # for auth2 provide list of scopes here |
| 97 | + - api_key: [] |
| 98 | + # overwriting default global produces |
| 99 | + produces: |
| 100 | + - application/json |
| 101 | + responses: # list of responses |
| 102 | + '200': |
| 103 | + description: Success |
| 104 | + schema: # response schema can be specified for each response |
| 105 | + $ref: '#/definitions/Speaker' |
| 106 | + '403': |
| 107 | + description: Forbidden |
| 108 | + '404': |
| 109 | + description: Speaker not found |
| 110 | + # documentation for PUT operation for this path |
| 111 | + post: |
| 112 | + tags: |
| 113 | + - Speakers |
| 114 | + summary: Create Speaker |
| 115 | + description: This can only be done by the logged in user. |
| 116 | + operationId: createSpeaker |
| 117 | + produces: |
| 118 | + - application/json |
| 119 | + parameters: |
| 120 | + - $ref: '#/parameters/speakerId' |
| 121 | + - $ref: '#/parameters/speakerBody' |
| 122 | + security: |
| 123 | + - main_auth: |
| 124 | + - 'create:speaker' |
| 125 | + responses: |
| 126 | + '200': |
| 127 | + description: OK |
| 128 | + '400': |
| 129 | + description: Invalid Speaker supplied |
| 130 | + '404': |
| 131 | + description: Speaker not found |
| 132 | + # documentation for PUT operation for this path |
| 133 | + put: |
| 134 | + tags: |
| 135 | + - Speakers |
| 136 | + summary: Updated Speaker |
| 137 | + description: This can only be done by the logged in user. |
| 138 | + operationId: updateSpeaker |
| 139 | + produces: |
| 140 | + - application/json |
| 141 | + parameters: |
| 142 | + - $ref: '#/parameters/speakerId' |
| 143 | + - $ref: '#/parameters/speakerBody' |
| 144 | + security: |
| 145 | + - main_auth: |
| 146 | + - 'write:speaker' |
| 147 | + responses: |
| 148 | + '200': |
| 149 | + description: OK |
| 150 | + '400': |
| 151 | + description: Invalid Speaker supplied |
| 152 | + '404': |
| 153 | + description: Speaker not found |
| 154 | + delete: |
| 155 | + tags: |
| 156 | + - Speakers |
| 157 | + summary: Delete Speaker by Id. |
| 158 | + description: Delete the Speaker identified by its Id Code. |
| 159 | + operationId: deleteSpeakerById |
| 160 | + parameters: |
| 161 | + - $ref: '#/parameters/speakerId' |
| 162 | + security: |
| 163 | + - main_auth: |
| 164 | + - 'delete:speaker' # for auth2 provide list of scopes here |
| 165 | + - api_key: [] |
| 166 | + produces: |
| 167 | + - application/json |
| 168 | + responses: # list of responses |
| 169 | + '200': |
| 170 | + description: Success |
| 171 | + '403': |
| 172 | + description: Forbidden |
| 173 | + '404': |
| 174 | + description: Speaker not found |
| 175 | +parameters: |
| 176 | + pretty: |
| 177 | + name: pretty |
| 178 | + in: query # place where paramter is passed: path, header, query or body, formData |
| 179 | + description: Pretty print response |
| 180 | + # type of the paramter: string, number, integer, boolean, array |
| 181 | + type: boolean |
| 182 | + speakerId: |
| 183 | + name: speakerId |
| 184 | + in: path |
| 185 | + description: Speaker Identifier |
| 186 | + required: true |
| 187 | + type: integer |
| 188 | + format: int64 |
| 189 | + speakerBody: |
| 190 | + name: speakerBody |
| 191 | + in: body |
| 192 | + description: Body Definition for Speaker Object. |
| 193 | + required: true |
| 194 | + schema: |
| 195 | + $ref: '#/definitions/Speaker' |
| 196 | +# An object to hold data types that can be consumed and produced by operations. |
| 197 | +# These data types can be primitives, arrays or models. |
| 198 | +definitions: |
| 199 | + Email: |
| 200 | + description: User email address |
| 201 | + type: string |
| 202 | + format: email |
| 203 | + example: john.smith@example.com |
| 204 | + Speaker: |
| 205 | + type: object |
| 206 | + properties: |
| 207 | + speakerId: |
| 208 | + description: Speaker Identifier |
| 209 | + type: integer |
| 210 | + format: int64 |
| 211 | + minLength: 1 |
| 212 | + example: 1 |
| 213 | + firstName: |
| 214 | + description: User first name |
| 215 | + type: string |
| 216 | + minLength: 1 |
| 217 | + example: John |
| 218 | + lastName: |
| 219 | + description: User last name |
| 220 | + type: string |
| 221 | + minLength: 1 |
| 222 | + example: Smith |
| 223 | + email: |
| 224 | + $ref: '#/definitions/Email' |
0 commit comments