Add voucher schema
This commit is contained in:
parent
ccec034d3a
commit
85c7940413
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
cic.json
|
||||
out
|
||||
|
3
Makefile
3
Makefile
@ -5,4 +5,5 @@ build:
|
||||
|
||||
|
||||
test: build
|
||||
check-jsonschema --schemafile cic.json test_valid.json
|
||||
check-jsonschema --schemafile out/cic.json test_valid.json
|
||||
check-jsonschema --schemafile out/voucher.json test_valid.json
|
||||
|
21
bundle.py
21
bundle.py
@ -35,4 +35,23 @@ for k in o_nft['properties'].keys():
|
||||
o['properties'][k] = p
|
||||
|
||||
|
||||
print(json.dumps(o))
|
||||
os.makedirs('out', exist_ok=True)
|
||||
|
||||
fp = os.path.join('out', 'cic.json')
|
||||
f = open(fp, 'w')
|
||||
json.dump(o, f)
|
||||
f.close()
|
||||
|
||||
fp = os.path.join('.', 'voucher.in.json')
|
||||
f = open(fp, 'r')
|
||||
o_voucher = json.load(f)
|
||||
for k in o_voucher['properties'].keys():
|
||||
p = {}
|
||||
for v in o_voucher['properties'][k]:
|
||||
p[v] = o_voucher['properties'][k][v]
|
||||
o['properties'][k] = p
|
||||
|
||||
fp = os.path.join('out', 'voucher.json')
|
||||
f = open(fp, 'w')
|
||||
json.dump(o, f)
|
||||
f.close()
|
||||
|
15
cic.in.json
15
cic.in.json
@ -1,10 +1,21 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "sha256:",
|
||||
"title": "CIC core metadata container",
|
||||
"$id": "/cic/core",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "integer"
|
||||
},
|
||||
"validFrom": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"validUntil": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"targets": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@ -27,5 +38,5 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["targets", "attachments", "txs"]
|
||||
"required": ["targets", "attachments", "txs", "validFrom"]
|
||||
}
|
||||
|
14
mime.in.json
14
mime.in.json
@ -20,7 +20,19 @@
|
||||
"body": {
|
||||
"type": "string",
|
||||
"$comment": "uri including dataurl"
|
||||
},
|
||||
"ref": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
}
|
||||
},
|
||||
"required": ["contentType", "body", "subject"]
|
||||
"required": ["contentType", "subject"],
|
||||
"oneOf": [
|
||||
{
|
||||
"required": ["body"]
|
||||
},
|
||||
{
|
||||
"required": ["ref"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -5,6 +5,10 @@
|
||||
"0xabcdef0123456789abcdef0123456789abcdef00",
|
||||
"abcdef0123456789abcdef0123456789abcdef00"
|
||||
],
|
||||
"validFrom": "2023-03-05T10:46:05+00:00",
|
||||
"validUntil": "2024-03-05T10:46:05+00:00",
|
||||
"unitOfAccount": "wampum",
|
||||
"issuerName": "John Doe",
|
||||
"txs": [
|
||||
"0xabcdef0123456789abcdef0123456789abcdef00abcdef0123456789abcdef00",
|
||||
"abcdef0123456789abcdef0123456789abcdef00abcdef0123456789abcdef00"
|
||||
@ -20,6 +24,12 @@
|
||||
"subject": "some text",
|
||||
"body": "fee fi fo fum"
|
||||
},
|
||||
{
|
||||
"contentType": "text/plain",
|
||||
"contentTransferEncoding": "7BIT",
|
||||
"subject": "some text",
|
||||
"ref": "sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"
|
||||
},
|
||||
{
|
||||
"contentType": "application/pdf",
|
||||
"contentTransferEncoding": "BASE64",
|
||||
|
19
voucher.in.json
Normal file
19
voucher.in.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "/cic/voucher",
|
||||
"title": "CIC voucher schema extensiom",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"unitOfAccount": {
|
||||
"type": "string"
|
||||
},
|
||||
"issuerName": {
|
||||
"type": "string"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"require": ["unitOfAccount", "issuerName"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user