Skip to content

Commit 5d4e210

Browse files
committed
feat: introduce schemas
1 parent 58a84d9 commit 5d4e210

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1899
-41
lines changed

docs/api/README.md

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,108 @@ To perform this operation, you must be authenticated by means of one of the foll
310310
Authorization ( Scopes: ledger:write )
311311
</aside>
312312

313+
## Insert or update a schema for a ledger
314+
315+
<a id="opIdv2InsertSchema"></a>
316+
317+
> Code samples
318+
319+
```http
320+
POST http://localhost:8080/v2/{ledger}/schema/{version} HTTP/1.1
321+
Host: localhost:8080
322+
Content-Type: application/json
323+
Accept: application/json
324+
325+
```
326+
327+
`POST /v2/{ledger}/schema/{version}`
328+
329+
> Body parameter
330+
331+
```json
332+
{}
333+
```
334+
335+
<h3 id="insert-or-update-a-schema-for-a-ledger-parameters">Parameters</h3>
336+
337+
|Name|In|Type|Required|Description|
338+
|---|---|---|---|---|
339+
|body|body|[V2SchemaData](#schemav2schemadata)|true|none|
340+
|ledger|path|string|true|Name of the ledger.|
341+
|version|path|string|true|Schema version.|
342+
343+
> Example responses
344+
345+
> default Response
346+
347+
```json
348+
{
349+
"errorCode": "VALIDATION",
350+
"errorMessage": "[VALIDATION] invalid 'cursor' query param",
351+
"details": "https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9"
352+
}
353+
```
354+
355+
<h3 id="insert-or-update-a-schema-for-a-ledger-responses">Responses</h3>
356+
357+
|Status|Meaning|Description|Schema|
358+
|---|---|---|---|
359+
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|Schema inserted successfully|None|
360+
|default|Default|Error|[V2ErrorResponse](#schemav2errorresponse)|
361+
362+
<aside class="warning">
363+
To perform this operation, you must be authenticated by means of one of the following methods:
364+
Authorization ( Scopes: ledger:write )
365+
</aside>
366+
367+
## Get a schema for a ledger by version
368+
369+
<a id="opIdv2GetSchema"></a>
370+
371+
> Code samples
372+
373+
```http
374+
GET http://localhost:8080/v2/{ledger}/schema/{version} HTTP/1.1
375+
Host: localhost:8080
376+
Accept: application/json
377+
378+
```
379+
380+
`GET /v2/{ledger}/schema/{version}`
381+
382+
<h3 id="get-a-schema-for-a-ledger-by-version-parameters">Parameters</h3>
383+
384+
|Name|In|Type|Required|Description|
385+
|---|---|---|---|---|
386+
|ledger|path|string|true|Name of the ledger.|
387+
|version|path|string|true|Schema version.|
388+
389+
> Example responses
390+
391+
> 200 Response
392+
393+
```json
394+
{
395+
"data": {
396+
"version": "v1.0.0",
397+
"createdAt": "2023-01-01T00:00:00Z",
398+
"data": {}
399+
}
400+
}
401+
```
402+
403+
<h3 id="get-a-schema-for-a-ledger-by-version-responses">Responses</h3>
404+
405+
|Status|Meaning|Description|Schema|
406+
|---|---|---|---|
407+
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Schema retrieved successfully|[V2SchemaResponse](#schemav2schemaresponse)|
408+
|default|Default|Error|[V2ErrorResponse](#schemav2errorresponse)|
409+
410+
<aside class="warning">
411+
To perform this operation, you must be authenticated by means of one of the following methods:
412+
Authorization ( Scopes: ledger:read )
413+
</aside>
414+
313415
## Update ledger metadata
314416

315417
<a id="opIdv2UpdateLedgerMetadata"></a>
@@ -5235,6 +5337,74 @@ and
52355337
|» errorDescription|string|true|none|none|
52365338
|» errorDetails|string|false|none|none|
52375339

5340+
<h2 id="tocS_V2SchemaData">V2SchemaData</h2>
5341+
<!-- backwards compatibility -->
5342+
<a id="schemav2schemadata"></a>
5343+
<a id="schema_V2SchemaData"></a>
5344+
<a id="tocSv2schemadata"></a>
5345+
<a id="tocsv2schemadata"></a>
5346+
5347+
```json
5348+
{}
5349+
5350+
```
5351+
5352+
Schema data structure for ledger schemas
5353+
5354+
### Properties
5355+
5356+
*None*
5357+
5358+
<h2 id="tocS_V2Schema">V2Schema</h2>
5359+
<!-- backwards compatibility -->
5360+
<a id="schemav2schema"></a>
5361+
<a id="schema_V2Schema"></a>
5362+
<a id="tocSv2schema"></a>
5363+
<a id="tocsv2schema"></a>
5364+
5365+
```json
5366+
{
5367+
"version": "v1.0.0",
5368+
"createdAt": "2023-01-01T00:00:00Z",
5369+
"data": {}
5370+
}
5371+
5372+
```
5373+
5374+
Complete schema structure with metadata
5375+
5376+
### Properties
5377+
5378+
|Name|Type|Required|Restrictions|Description|
5379+
|---|---|---|---|---|
5380+
|version|string|true|none|Schema version|
5381+
|createdAt|string(date-time)|true|none|Schema creation timestamp|
5382+
|data|[V2SchemaData](#schemav2schemadata)|true|none|Schema data structure for ledger schemas|
5383+
5384+
<h2 id="tocS_V2SchemaResponse">V2SchemaResponse</h2>
5385+
<!-- backwards compatibility -->
5386+
<a id="schemav2schemaresponse"></a>
5387+
<a id="schema_V2SchemaResponse"></a>
5388+
<a id="tocSv2schemaresponse"></a>
5389+
<a id="tocsv2schemaresponse"></a>
5390+
5391+
```json
5392+
{
5393+
"data": {
5394+
"version": "v1.0.0",
5395+
"createdAt": "2023-01-01T00:00:00Z",
5396+
"data": {}
5397+
}
5398+
}
5399+
5400+
```
5401+
5402+
### Properties
5403+
5404+
|Name|Type|Required|Restrictions|Description|
5405+
|---|---|---|---|---|
5406+
|data|[V2Schema](#schemav2schema)|true|none|Complete schema structure with metadata|
5407+
52385408
<h2 id="tocS_V2CreateLedgerRequest">V2CreateLedgerRequest</h2>
52395409
<!-- backwards compatibility -->
52405410
<a id="schemav2createledgerrequest"></a>

0 commit comments

Comments
 (0)