forked from zircote/swagger-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
using-interfaces.yaml
92 lines (92 loc) · 2.17 KB
/
using-interfaces.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
openapi: 3.0.0
info:
title: 'Example of using interfaces in swagger-php'
description: 'Using interfaces'
contact:
name: 'Swagger API Team'
version: 1.0.0
servers:
-
url: 'https://example.localhost'
description: 'API server'
paths:
'/products/{id}':
get:
tags:
- api
description: 'Get product in any colour for id'
operationId: fef5577fd78858297fd2e4291598d8d0
parameters:
-
name: id
in: path
description: 'ID of product to return'
required: true
schema:
type: string
responses:
'200':
description: 'successful operation'
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
'/products/green/{id}':
get:
tags:
- api
description: 'Get green products'
operationId: d6617b71407f39c923d01fe82bb4ed65
parameters:
-
name: id
in: path
description: 'ID of product to return'
required: true
schema:
type: string
responses:
'200':
description: 'successful operation'
content:
application/json:
schema:
$ref: '#/components/schemas/GreenProduct'
components:
schemas:
GreenProduct:
title: GreenProduct
type: object
allOf:
-
$ref: '#/components/schemas/Product'
-
properties:
color:
description: 'The product color.'
example: blue
type: object
Product:
title: 'Product model'
type: object
allOf:
-
$ref: '#/components/schemas/ProductInterface'
-
properties:
id:
description: 'The unique identifier of a product in our catalog.'
type: integer
format: int64
example: 1
type: object
ProductInterface:
properties:
name:
description: 'The product name.'
example: toaster
type: object
tags:
-
name: api
description: 'API operations'