-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
187 lines (182 loc) · 5.29 KB
/
swagger.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
swagger: '2.0'
info:
title: 'Schema-Compiler API'
description: 'IdentityChain Schema-Compiler API'
version: '0.0.1'
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/types:
get:
summary: "The types supported by the high-level schema language"
description: "The types supported by the high-level schema language"
responses:
200:
description: "All the names of the supported types by the schema-compiler"
schema:
type: array
items:
type: string
/schema:
post:
summary: "Typecheck high-level schemas and compile them down to Indy schemas"
description: "Typecheck high-level schemas and compile them down to Indy schemas"
parameters:
- in: body
name: data
description: "The inputted high-level schemas"
required: true
schema:
$ref: '#/definitions/high_schemas'
responses:
200:
description: "The generated low-level Indy schemas"
schema:
$ref: '#/definitions/indy_schemas'
400:
description: "Failed to typecheck or compile high-level schemas"
schema:
$ref: '#/definitions/compiler_errors'
/cred:
post:
summary: "Typecheck the credential and its accompanying schemas, and produce a final credential with derived values"
description: "Typecheck the credential and its accompanying schemas, and produce a final credential with derived values"
parameters:
- in: body
name: data
required: true
schema:
type: object
description: "The inputted semi-filled credential and a 'database' of high-level schemas to use for typechecking and value-deriving"
properties:
credential:
$ref: '#/definitions/credential_format'
schemas:
$ref: '#/definitions/high_schemas'
responses:
200:
description: "The credential filled-in with derived values"
schema:
$ref: '#/definitions/credential_format'
400:
description: "Failed to typecheck or generate derived credential"
schema:
$ref: '#/definitions/compiler_errors'
definitions:
indy_schemas:
type: array
items:
type: object
properties:
name:
type: string
version:
type: string
attr_names:
type: array
items:
type: string
example:
[{"name": "Degree"
,"version": "1.0"
,"attr_names": ["undergrad","last_name","first_name","postgrad","x","d","e","b","fullname"]}
,{"name": "EmptySchema"
,"version": "0.2"
,"attr_names": []}
]
high_schemas:
type: array
items:
type: object
required:
- attributes
- name
- version
properties:
name:
type: string
description: "A unique name for the new schema"
version:
type: string
description: "Schema version for the new schema"
parentSchemaName:
type: string
description: "Name of the parent schema"
parentSchemaVersion:
type: string
description: "Version of the parent schema"
attributes:
type: array
description: "List of attribute names put into the schema"
items:
required:
- name
- type
properties:
name:
type: string
description: "Name of the attribute (Key)"
type:
type: string
description: "A valid type for attributes, as requested using GET /types in schema compiler API"
example:
- name: "Passport"
version: "1.0"
parentSchemaName: "ID_NL"
parentSchemaVersion: "2.0"
attributes:
- name: "givenName"
type: string
- name: "ID_NL"
version: "2.0"
attributes:
- name: "nationality"
type: string
credential_format:
type: object
properties:
schema_id:
type: string
values:
type: object
additionalProperties:
type: object
properties:
raw:
type: string
encoded:
type: string
required:
- schema_id
- values
example:
{"schema_id":"4cU41vWW82ArfxJxHkzXPG:2:PhD_:0.2"
,"values":{"__issue_date__": {"raw": "2018-06-20T11:05:30.995Z", "encoded": "0"},
"first_name": {"raw": "hello", "encoded": "456"},
"last_name": {"raw": "world", "encoded": "3"},
"undergrad": {"raw": "true", "encoded": "0"},
"postgrad": {"raw": "false", "encoded": "123"}
}
}
compiler_errors:
type: array
items:
type: object
properties:
error:
type: object
properties:
msg:
type: string
description: "A human-readable string that describes the error message"
at:
type: string
description: "The source location where the error happened"
required:
- msg
required:
- error