-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
63 lines (63 loc) · 2.16 KB
/
openapi.yaml
File metadata and controls
63 lines (63 loc) · 2.16 KB
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
openapi: 3.0.0
info:
title: Score Calculation API
description: API for calculating scores in a card game
version: 1.0.0
servers:
- url: https://cribbage.azurewebsites.net/
paths:
/score_hand_show:
post:
summary: Calculate score
operationId: score_hand_show
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
starter:
type: string
description: The starter card, e.g. '5H' for 5 of hearts
hand:
type: array
items:
type: string
description: A card in the hand, e.g. and array with cards like '5H' for 5 of hearts
isCrib:
type: boolean
description: Whether the hand is a crib
required:
- starter
- hand
- isCrib
example:
starter: "5H"
hand: ["5D", "5S", "JC", "KH"]
isCrib: false
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
type:
type: string
description: The type of response
score:
type: integer
description: The calculated score
message:
type: string
description: A message about the score calculation
example:
type: "score"
score: 20
message: "Three of a kind: 5s (6pts)|Made 15 from [(5, 'D'), (11, 'C')] (2pts)|Made 15 from [(5, 'D'), (13, 'H')] (2pts)|Made 15 from [(5, 'S'), (11, 'C')] (2pts)|Made 15 from [(5, 'S'), (13, 'H')] (2pts)|Made 15 from [(11, 'C'), (5, 'H')] (2pts)|Made 15 from [(13, 'H'), (5, 'H')] (2pts)|Made 15 from [(5, 'D'), (5, 'S'), (5, 'H')] (2pts)"
'400':
description: Bad Request
'500':
description: Internal Server Error