|
| 1 | +openapi: 3.1.0 |
| 2 | +info: |
| 3 | + title: Customer Service |
| 4 | + version: 1.0.0 |
| 5 | +servers: |
| 6 | +- url: http://localhost:9081/customer-service |
| 7 | +paths: |
| 8 | + /customers: |
| 9 | + get: |
| 10 | + operationId: getCustomers |
| 11 | + responses: |
| 12 | + "200": |
| 13 | + description: All customers, if they are less than ten |
| 14 | + content: |
| 15 | + application/json: |
| 16 | + schema: |
| 17 | + $ref: '#/components/schemas/CustomerCollection' |
| 18 | + post: |
| 19 | + operationId: createCustomer |
| 20 | + requestBody: |
| 21 | + content: |
| 22 | + application/json: |
| 23 | + schema: |
| 24 | + $ref: '#/components/schemas/Customer' |
| 25 | + required: true |
| 26 | + responses: |
| 27 | + "201": |
| 28 | + description: Customer is created |
| 29 | + headers: |
| 30 | + Location: |
| 31 | + description: The url of the created customer |
| 32 | + explode: false |
| 33 | + schema: |
| 34 | + pattern: "http\\://[a-z-]+[\\:[0-9]+]/orders/[0-9]+" |
| 35 | + type: string |
| 36 | + style: simple |
| 37 | + /customers/{customer_number}: |
| 38 | + get: |
| 39 | + operationId: getCustomerDetails |
| 40 | + parameters: |
| 41 | + - explode: false |
| 42 | + in: path |
| 43 | + name: customer_number |
| 44 | + required: true |
| 45 | + schema: |
| 46 | + type: string |
| 47 | + responses: |
| 48 | + "200": |
| 49 | + description: The details of one customer |
| 50 | + content: |
| 51 | + application/json: |
| 52 | + schema: |
| 53 | + $ref: '#/components/schemas/Customer' |
| 54 | + /customers/{customer_number}/addresses: |
| 55 | + get: |
| 56 | + operationId: getAddressesOfCustomer |
| 57 | + parameters: |
| 58 | + - explode: false |
| 59 | + in: path |
| 60 | + name: customer_number |
| 61 | + required: true |
| 62 | + schema: |
| 63 | + type: string |
| 64 | + responses: |
| 65 | + "200": |
| 66 | + description: The addresses of one customer |
| 67 | + content: |
| 68 | + application/json: |
| 69 | + schema: |
| 70 | + $ref: '#/components/schemas/AddressCollection' |
| 71 | + /customers/{customer_number}/addresses/{address_type}: |
| 72 | + get: |
| 73 | + operationId: getAddressOfType |
| 74 | + parameters: |
| 75 | + - explode: false |
| 76 | + in: path |
| 77 | + name: customer_number |
| 78 | + required: true |
| 79 | + schema: |
| 80 | + type: string |
| 81 | + - explode: false |
| 82 | + in: path |
| 83 | + name: address_type |
| 84 | + required: true |
| 85 | + schema: |
| 86 | + $ref: '#/components/schemas/AddressType' |
| 87 | + responses: |
| 88 | + "200": |
| 89 | + description: The addresses of one customer |
| 90 | + content: |
| 91 | + application/json: |
| 92 | + schema: |
| 93 | + $ref: '#/components/schemas/Address' |
| 94 | + put: |
| 95 | + operationId: setAddressOfType |
| 96 | + parameters: |
| 97 | + - explode: false |
| 98 | + in: path |
| 99 | + name: customer_number |
| 100 | + required: true |
| 101 | + schema: |
| 102 | + type: string |
| 103 | + - explode: false |
| 104 | + in: path |
| 105 | + name: address_type |
| 106 | + required: true |
| 107 | + schema: |
| 108 | + type: string |
| 109 | + requestBody: |
| 110 | + content: |
| 111 | + application/json: |
| 112 | + schema: |
| 113 | + $ref: '#/components/schemas/Address' |
| 114 | + responses: |
| 115 | + "204": |
| 116 | + description: Address was changed |
| 117 | +components: |
| 118 | + schemas: |
| 119 | + Customer: |
| 120 | + example: |
| 121 | + customer_umber: "0815" |
| 122 | + name: "Max Mustermann" |
| 123 | + properties: |
| 124 | + customer_number: |
| 125 | + pattern: \d+ |
| 126 | + type: string |
| 127 | + readOnly: true |
| 128 | + name: |
| 129 | + type: string |
| 130 | + required: |
| 131 | + - customer_number |
| 132 | + - name |
| 133 | + CustomerCollection: |
| 134 | + type: array |
| 135 | + description: An array of customers |
| 136 | + items: |
| 137 | + $ref: '#/components/schemas/Customer' |
| 138 | + minItems: 0 |
| 139 | + maxItems: 10 |
| 140 | + Address: |
| 141 | + example: |
| 142 | + type: "billing" |
| 143 | + street: "Poststr." |
| 144 | + house_number: "1" |
| 145 | + zip_code: "26122" |
| 146 | + city: "Oldenburg" |
| 147 | + properties: |
| 148 | + type: |
| 149 | + ref$: '#/components/schemas/AddressType' |
| 150 | + street: |
| 151 | + minLength: 2 |
| 152 | + type: string |
| 153 | + house_number: |
| 154 | + minLength: 1 |
| 155 | + type: string |
| 156 | + zip_code: |
| 157 | + pattern: "\\d{5}" |
| 158 | + type: string |
| 159 | + city: |
| 160 | + minLength: 1 |
| 161 | + type: string |
| 162 | + required: |
| 163 | + - city |
| 164 | + - street |
| 165 | + - zip_code |
| 166 | + AddressType: |
| 167 | + type: string |
| 168 | + x-extensible-enum: |
| 169 | + - billing |
| 170 | + - delivery |
| 171 | + AddressCollection: |
| 172 | + type: array |
| 173 | + description: An array of addresses |
| 174 | + items: |
| 175 | + $ref: '#/components/schemas/Address' |
| 176 | + minItems: 0 |
| 177 | + maxItems: 10 |
0 commit comments