|
| 1 | +# Copyright (c) 2021 WSO2 Inc. (http:www.wso2.org) All Rights Reserved. |
| 2 | +# |
| 3 | +# WSO2 Inc. licenses this file to you under the Apache License, |
| 4 | +# Version 2.0 (the "License"); you may not use this file except |
| 5 | +# in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http:www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, |
| 11 | +# software distributed under the License is distributed on an |
| 12 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 13 | +# KIND, either express or implied. See the License for the |
| 14 | +# specific language governing permissions and limitations |
| 15 | +# under the License. |
| 16 | + |
| 17 | +openapi: 3.0.0 |
| 18 | +servers: |
| 19 | + - description: Localhost |
| 20 | + url: http://localhost:8080 |
| 21 | +info: |
| 22 | + description: This is a sample backend - products |
| 23 | + version: v1 |
| 24 | + title: Products |
| 25 | + contact: |
| 26 | + |
| 27 | +tags: |
| 28 | + - name: product |
| 29 | + description: Products of store |
| 30 | +x-wso2-production-endpoints: |
| 31 | + urls: |
| 32 | + - http://products |
| 33 | + type: http |
| 34 | +x-wso2-sandbox-endpoints: |
| 35 | + urls: |
| 36 | + - http://products |
| 37 | + type: http |
| 38 | +x-wso2-basePath: /products-api/v1 |
| 39 | +paths: |
| 40 | + /products: |
| 41 | + get: |
| 42 | + tags: |
| 43 | + - product |
| 44 | + summary: All Products |
| 45 | + description: All products of the store |
| 46 | + responses: |
| 47 | + 200: |
| 48 | + description: Successful operation |
| 49 | + content: |
| 50 | + application/json: |
| 51 | + schema: |
| 52 | + type: array |
| 53 | + items: |
| 54 | + $ref: "#/components/schemas/Product" |
| 55 | + post: |
| 56 | + tags: |
| 57 | + - product |
| 58 | + summary: Add Product |
| 59 | + description: Add new products to the store |
| 60 | + requestBody: |
| 61 | + content: |
| 62 | + applicatoin/json: |
| 63 | + schema: |
| 64 | + $ref: "#/components/schemas/Product" |
| 65 | + |
| 66 | + responses: |
| 67 | + 200: |
| 68 | + description: Successful operation |
| 69 | + content: |
| 70 | + application/json: |
| 71 | + schema: |
| 72 | + $ref: "#/components/schemas/Product" |
| 73 | + 400: |
| 74 | + description: Invalid Product |
| 75 | + /products/{id}: |
| 76 | + get: |
| 77 | + tags: |
| 78 | + - product |
| 79 | + summary: Find product by ID |
| 80 | + description: Returns a single product |
| 81 | + parameters: |
| 82 | + - name: id |
| 83 | + in: path |
| 84 | + description: ID of product to return |
| 85 | + required: true |
| 86 | + schema: |
| 87 | + type: integer |
| 88 | + format: int64 |
| 89 | + example: 3 |
| 90 | + responses: |
| 91 | + 200: |
| 92 | + description: successful operation |
| 93 | + content: |
| 94 | + application/json: |
| 95 | + schema: |
| 96 | + $ref: "#/components/schemas/Product" |
| 97 | + 400: |
| 98 | + description: Invalid ID supplied |
| 99 | + 404: |
| 100 | + description: Product not found |
| 101 | + put: |
| 102 | + tags: |
| 103 | + - product |
| 104 | + summary: Update product by ID |
| 105 | + description: Update a product |
| 106 | + parameters: |
| 107 | + - name: id |
| 108 | + in: path |
| 109 | + description: ID of product to update |
| 110 | + required: true |
| 111 | + schema: |
| 112 | + type: integer |
| 113 | + format: int64 |
| 114 | + example: 3 |
| 115 | + requestBody: |
| 116 | + content: |
| 117 | + applicatoin/json: |
| 118 | + schema: |
| 119 | + $ref: "#/components/schemas/Product" |
| 120 | + responses: |
| 121 | + 200: |
| 122 | + description: successful operation |
| 123 | + content: |
| 124 | + application/json: |
| 125 | + schema: |
| 126 | + $ref: "#/components/schemas/Product" |
| 127 | + 400: |
| 128 | + description: Invalid ID supplied |
| 129 | + 404: |
| 130 | + description: Product not found |
| 131 | + delete: |
| 132 | + tags: |
| 133 | + - product |
| 134 | + summary: Delete product by ID |
| 135 | + description: Delete a product |
| 136 | + parameters: |
| 137 | + - name: id |
| 138 | + in: path |
| 139 | + description: ID of product to delete |
| 140 | + required: true |
| 141 | + schema: |
| 142 | + type: integer |
| 143 | + format: int64 |
| 144 | + example: 3 |
| 145 | + responses: |
| 146 | + 200: |
| 147 | + description: successful operation |
| 148 | + content: |
| 149 | + application/json: |
| 150 | + schema: |
| 151 | + $ref: "#/components/schemas/Result" |
| 152 | + 400: |
| 153 | + description: Invalid ID supplied |
| 154 | + 404: |
| 155 | + description: Product not found |
| 156 | +components: |
| 157 | + schemas: |
| 158 | + Product: |
| 159 | + type: object |
| 160 | + required: |
| 161 | + - name |
| 162 | + - category |
| 163 | + - price |
| 164 | + properties: |
| 165 | + id: |
| 166 | + type: integer |
| 167 | + format: int64 |
| 168 | + example: 3 |
| 169 | + name: |
| 170 | + type: string |
| 171 | + example: ABC Smart TV |
| 172 | + category: |
| 173 | + type: string |
| 174 | + example: Electronics |
| 175 | + price: |
| 176 | + type: integer |
| 177 | + format: int64 |
| 178 | + example: 39999 |
| 179 | + Result: |
| 180 | + type: object |
| 181 | + properties: |
| 182 | + result: |
| 183 | + type: string |
| 184 | + example: success |
0 commit comments