Skip to content

Commit b25c875

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

File tree

69 files changed

+3455
-61
lines changed

Some content is hidden

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

69 files changed

+3455
-61
lines changed

docs/api/README.md

Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,174 @@ 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+
415+
## List all schemas for a ledger
416+
417+
<a id="opIdv2ListSchemas"></a>
418+
419+
> Code samples
420+
421+
```http
422+
GET http://localhost:8080/v2/{ledger}/schema HTTP/1.1
423+
Host: localhost:8080
424+
Accept: application/json
425+
426+
```
427+
428+
`GET /v2/{ledger}/schema`
429+
430+
<h3 id="list-all-schemas-for-a-ledger-parameters">Parameters</h3>
431+
432+
|Name|In|Type|Required|Description|
433+
|---|---|---|---|---|
434+
|cursor|query|string|false|The pagination cursor value|
435+
|pageSize|query|integer|false|The maximum number of results to return per page|
436+
|sort|query|string|false|The field to sort by|
437+
|order|query|string|false|The sort order|
438+
|ledger|path|string|true|Name of the ledger.|
439+
440+
#### Enumerated Values
441+
442+
|Parameter|Value|
443+
|---|---|
444+
|sort|created_at|
445+
|order|asc|
446+
|order|desc|
447+
448+
> Example responses
449+
450+
> 200 Response
451+
452+
```json
453+
{
454+
"cursor": {
455+
"data": [
456+
{
457+
"version": "v1.0.0",
458+
"createdAt": "2023-01-01T00:00:00Z",
459+
"data": {}
460+
}
461+
],
462+
"hasMore": true,
463+
"next": "string",
464+
"pageSize": 0
465+
}
466+
}
467+
```
468+
469+
<h3 id="list-all-schemas-for-a-ledger-responses">Responses</h3>
470+
471+
|Status|Meaning|Description|Schema|
472+
|---|---|---|---|
473+
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Schemas retrieved successfully|[V2SchemasCursorResponse](#schemav2schemascursorresponse)|
474+
|default|Default|Error|[V2ErrorResponse](#schemav2errorresponse)|
475+
476+
<aside class="warning">
477+
To perform this operation, you must be authenticated by means of one of the following methods:
478+
Authorization ( Scopes: ledger:read )
479+
</aside>
480+
313481
## Update ledger metadata
314482

315483
<a id="opIdv2UpdateLedgerMetadata"></a>
@@ -5235,6 +5403,137 @@ and
52355403
|» errorDescription|string|true|none|none|
52365404
|» errorDetails|string|false|none|none|
52375405

5406+
<h2 id="tocS_V2SchemaData">V2SchemaData</h2>
5407+
<!-- backwards compatibility -->
5408+
<a id="schemav2schemadata"></a>
5409+
<a id="schema_V2SchemaData"></a>
5410+
<a id="tocSv2schemadata"></a>
5411+
<a id="tocsv2schemadata"></a>
5412+
5413+
```json
5414+
{}
5415+
5416+
```
5417+
5418+
Schema data structure for ledger schemas
5419+
5420+
### Properties
5421+
5422+
*None*
5423+
5424+
<h2 id="tocS_V2Schema">V2Schema</h2>
5425+
<!-- backwards compatibility -->
5426+
<a id="schemav2schema"></a>
5427+
<a id="schema_V2Schema"></a>
5428+
<a id="tocSv2schema"></a>
5429+
<a id="tocsv2schema"></a>
5430+
5431+
```json
5432+
{
5433+
"version": "v1.0.0",
5434+
"createdAt": "2023-01-01T00:00:00Z",
5435+
"data": {}
5436+
}
5437+
5438+
```
5439+
5440+
Complete schema structure with metadata
5441+
5442+
### Properties
5443+
5444+
|Name|Type|Required|Restrictions|Description|
5445+
|---|---|---|---|---|
5446+
|version|string|true|none|Schema version|
5447+
|createdAt|string(date-time)|true|none|Schema creation timestamp|
5448+
|data|[V2SchemaData](#schemav2schemadata)|true|none|Schema data structure for ledger schemas|
5449+
5450+
<h2 id="tocS_V2SchemaResponse">V2SchemaResponse</h2>
5451+
<!-- backwards compatibility -->
5452+
<a id="schemav2schemaresponse"></a>
5453+
<a id="schema_V2SchemaResponse"></a>
5454+
<a id="tocSv2schemaresponse"></a>
5455+
<a id="tocsv2schemaresponse"></a>
5456+
5457+
```json
5458+
{
5459+
"data": {
5460+
"version": "v1.0.0",
5461+
"createdAt": "2023-01-01T00:00:00Z",
5462+
"data": {}
5463+
}
5464+
}
5465+
5466+
```
5467+
5468+
### Properties
5469+
5470+
|Name|Type|Required|Restrictions|Description|
5471+
|---|---|---|---|---|
5472+
|data|[V2Schema](#schemav2schema)|true|none|Complete schema structure with metadata|
5473+
5474+
<h2 id="tocS_V2SchemasCursorResponse">V2SchemasCursorResponse</h2>
5475+
<!-- backwards compatibility -->
5476+
<a id="schemav2schemascursorresponse"></a>
5477+
<a id="schema_V2SchemasCursorResponse"></a>
5478+
<a id="tocSv2schemascursorresponse"></a>
5479+
<a id="tocsv2schemascursorresponse"></a>
5480+
5481+
```json
5482+
{
5483+
"cursor": {
5484+
"data": [
5485+
{
5486+
"version": "v1.0.0",
5487+
"createdAt": "2023-01-01T00:00:00Z",
5488+
"data": {}
5489+
}
5490+
],
5491+
"hasMore": true,
5492+
"next": "string",
5493+
"pageSize": 0
5494+
}
5495+
}
5496+
5497+
```
5498+
5499+
### Properties
5500+
5501+
|Name|Type|Required|Restrictions|Description|
5502+
|---|---|---|---|---|
5503+
|cursor|[V2SchemasCursor](#schemav2schemascursor)|true|none|none|
5504+
5505+
<h2 id="tocS_V2SchemasCursor">V2SchemasCursor</h2>
5506+
<!-- backwards compatibility -->
5507+
<a id="schemav2schemascursor"></a>
5508+
<a id="schema_V2SchemasCursor"></a>
5509+
<a id="tocSv2schemascursor"></a>
5510+
<a id="tocsv2schemascursor"></a>
5511+
5512+
```json
5513+
{
5514+
"data": [
5515+
{
5516+
"version": "v1.0.0",
5517+
"createdAt": "2023-01-01T00:00:00Z",
5518+
"data": {}
5519+
}
5520+
],
5521+
"hasMore": true,
5522+
"next": "string",
5523+
"pageSize": 0
5524+
}
5525+
5526+
```
5527+
5528+
### Properties
5529+
5530+
|Name|Type|Required|Restrictions|Description|
5531+
|---|---|---|---|---|
5532+
|data|[[V2Schema](#schemav2schema)]|true|none|[Complete schema structure with metadata]|
5533+
|hasMore|boolean|true|none|none|
5534+
|next|string|false|none|none|
5535+
|pageSize|integer|true|none|none|
5536+
52385537
<h2 id="tocS_V2CreateLedgerRequest">V2CreateLedgerRequest</h2>
52395538
<!-- backwards compatibility -->
52405539
<a id="schemav2createledgerrequest"></a>

0 commit comments

Comments
 (0)