Skip to content

Commit b19c7b9

Browse files
vityamanKimiega
andauthored
#1 Add an initial version of services API (#5)
Co-authored-by: Kimiega <dmbelitmo@mail.ru>
1 parent ea02a4f commit b19c7b9

File tree

3 files changed

+744
-93
lines changed
  • doc
  • matchmaker/api/src/main/resources/static/openapi
  • people/api/src/main/resources/static/openapi

3 files changed

+744
-93
lines changed

doc/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Topic {
3939

4040
class Interest {
4141
Topic topic;
42-
int degree; // от 0 до 5
42+
int level; // от 1 до 5
4343
}
4444

4545
class Location {
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,176 @@
1-
---
2-
swagger: "2.0"
3-
info:
4-
version: "1.0.0"
5-
title: "Swagger Petstore: Matchmaker"
6-
description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification"
7-
termsOfService: "http://swagger.io/terms/"
8-
contact:
9-
name: "Swagger API Team"
10-
license:
11-
name: "MIT"
12-
host: "petstore.swagger.io"
13-
basePath: "/api"
14-
schemes:
15-
- "http"
16-
consumes:
17-
- "application/json"
18-
produces:
19-
- "application/json"
20-
paths:
21-
/pets:
22-
get:
23-
description: "Returns all pets from the system that the user has access to"
24-
produces:
25-
- "application/json"
26-
responses:
27-
"200":
28-
description: "A list of pets."
29-
schema:
30-
type: "array"
31-
items:
32-
$ref: "#/definitions/Pet"
33-
definitions:
34-
Pet:
35-
type: "object"
36-
required:
37-
- "id"
38-
- "name"
39-
properties:
40-
id:
41-
type: "integer"
42-
format: "int64"
43-
name:
44-
type: "string"
45-
tag:
46-
type: "string"
1+
openapi: 3.0.3
2+
info:
3+
title: ITMO Dating Matchmaker
4+
version: 0.0.1
5+
servers:
6+
- url: /api/v1
7+
security:
8+
- bearerAuth: [USER, ADMIN]
9+
paths:
10+
/monitoring/healthcheck:
11+
get:
12+
tags: [Monitoring]
13+
summary: Checks if service is alive
14+
description: Returns 'ok', if service is alive, else we will cry
15+
security: []
16+
responses:
17+
200:
18+
description: OK
19+
content:
20+
text/html:
21+
schema:
22+
type: string
23+
example: ok
24+
/suggestions:
25+
get:
26+
tags: [Suggestions]
27+
summary: Get suggestions
28+
description: Returns people suggested for a given person
29+
parameters:
30+
- name: limit
31+
in: query
32+
description: Maximum count of elements to return
33+
required: false
34+
schema:
35+
type: integer
36+
format: int64
37+
default: 20
38+
minimum: 1
39+
maximum: 50
40+
example: 8
41+
responses:
42+
200:
43+
description: OK
44+
content:
45+
application/json:
46+
schema:
47+
type: array
48+
items:
49+
$ref: "#/components/schemas/PersonId"
50+
uniqueItems: true
51+
401:
52+
description: No authentication
53+
content:
54+
application/josn:
55+
schema:
56+
$ref: "#/components/schemas/GeneralError"
57+
/people/{target_id}/attitudes:
58+
post:
59+
tags: [Suggestions]
60+
summary: Like or skip a suggestion
61+
description: Source id is taken from an auth token
62+
parameters:
63+
- name: target_id
64+
in: path
65+
required: true
66+
schema:
67+
$ref: "#/components/schemas/PersonId"
68+
requestBody:
69+
required: true
70+
content:
71+
application/json:
72+
schema:
73+
$ref: "#/components/schemas/Attitude"
74+
responses:
75+
204:
76+
description: Attitude was taken into account
77+
400:
78+
description: Source already posted an attitude to target
79+
content:
80+
application/json:
81+
schema:
82+
$ref: "#/components/schemas/GeneralError"
83+
401:
84+
description: No authentication
85+
content:
86+
application/json:
87+
schema:
88+
$ref: "#/components/schemas/GeneralError"
89+
404:
90+
description: Person is not found
91+
content:
92+
application/json:
93+
schema:
94+
$ref: "#/components/schemas/GeneralError"
95+
/people/{person_id}/matches:
96+
get:
97+
tags: [Suggestions]
98+
summary: Get person matches
99+
description: Returns people who mutually liked given person
100+
parameters:
101+
- name: person_id
102+
in: path
103+
required: true
104+
schema:
105+
$ref: "#/components/schemas/PersonId"
106+
responses:
107+
200:
108+
description: OK
109+
content:
110+
application/json:
111+
schema:
112+
type: array
113+
items:
114+
$ref: "#/components/schemas/PersonId"
115+
uniqueItems: true
116+
401:
117+
description: No authentication
118+
content:
119+
application/json:
120+
schema:
121+
$ref: "#/components/schemas/GeneralError"
122+
403:
123+
description: Forbidden
124+
content:
125+
application/json:
126+
schema:
127+
$ref: "#/components/schemas/GeneralError"
128+
404:
129+
description: Person is not found. Error is available only with admin rights
130+
content:
131+
application/json:
132+
schema:
133+
$ref: "#/components/schemas/GeneralError"
134+
components:
135+
securitySchemes:
136+
bearerAuth:
137+
type: http
138+
scheme: bearer
139+
bearerFormat: JWT
140+
schemas:
141+
PersonId:
142+
type: integer
143+
description: A unique key of a person, autogenerated
144+
format: int64
145+
minimum: 1
146+
example: 12345678
147+
Attitude:
148+
type: object
149+
properties:
150+
verdict:
151+
type: string
152+
enum:
153+
- like
154+
- skip
155+
required:
156+
- verdict
157+
GeneralError:
158+
type: object
159+
properties:
160+
code:
161+
type: integer
162+
format: int32
163+
description: HTTP Status Code
164+
example: 400
165+
status:
166+
type: string
167+
description: HTTP Status Description
168+
example: Bad Request
169+
message:
170+
type: string
171+
description: Detailed Message
172+
example: Username must contain only latin letter
173+
required:
174+
- code
175+
- status
176+
- message

0 commit comments

Comments
 (0)