juice-shop
/
swagger.yml
52 строки · 2.2 Кб
1openapi: 3.0.0
2servers:
3-
4url: /b2b/v2
5info:
6version: 2.0.0
7title: 'NextGen B2B API'
8description: 'New & secure JSON-based API for our enterprise customers. (Deprecates previously offered XML-based endpoints)'
9license:
10name: MIT
11url: 'https://opensource.org/licenses/MIT'
12contact:
13name: B2B API Support
14tags:
15-
16name: Order
17description: 'API for customer orders'
18paths:
19/orders:
20post:
21operationId: createCustomerOrder
22tags: [Order]
23description: 'Create new customer order'
24responses: { '200': { description: 'New customer order is created', content: { application/json: { schema: { $ref: '#/components/schemas/OrderConfirmation' } } } } }
25requestBody: { content: { application/json: { schema: { $ref: '#/components/schemas/Order' } } }, description: 'Customer order to be placed' }
26components:
27securitySchemes:
28bearerAuth:
29type: http
30scheme: bearer
31bearerFormat: JWT
32schemas:
33Order:
34required: [cid]
35properties: { cid: { type: string, uniqueItems: true, example: JS0815DE }, orderLines: { $ref: '#/components/schemas/OrderLines' }, orderLinesData: { $ref: '#/components/schemas/OrderLinesData' } }
36OrderConfirmation:
37required: [cid, orderNo, paymentDue]
38properties: { cid: { type: string, uniqueItems: true, example: JS0815DE }, orderNo: { type: string, uniqueItems: true, example: 3d06ac5e1bdf39d26392f8100f124742 }, paymentDue: { description: 'All payments are due 14 days after order placement', type: string, format: date, example: '2018-01-19' } }
39OrderLine:
40description: 'Order line in default JSON format'
41required: [productId, quantity]
42properties: { productId: { type: integer, example: 8 }, quantity: { type: integer, minimum: 1, example: 500 }, customerReference: { type: string, example: PO0000001 } }
43OrderLines:
44type: array
45items: { $ref: '#/components/schemas/OrderLine' }
46OrderLinesData:
47description: 'Order line(s) in customer specific JSON format'
48type: string
49example: '[{"productId": 12,"quantity": 10000,"customerReference": ["PO0000001.2", "SM20180105|042"],"couponCode": "pes[Bh.u*t"},{"productId": 13,"quantity": 2000,"customerReference": "PO0000003.4"}]'
50security:
51-
52bearerAuth: []
53