Add bundler, test
This commit is contained in:
parent
9fa00f32a7
commit
910ce54055
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
cic.json
|
6
Makefile
Normal file
6
Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
all:
|
||||
python bundle.py > cic.json
|
||||
|
||||
|
||||
test: all
|
||||
check-jsonschema --schemafile cic.json test_valid.json
|
38
bundle.py
Normal file
38
bundle.py
Normal file
@ -0,0 +1,38 @@
|
||||
# standard imports
|
||||
import json
|
||||
import os
|
||||
|
||||
|
||||
fp = os.path.join('.', 'cic.in.json')
|
||||
f = open(fp, 'r')
|
||||
o = json.load(f)
|
||||
|
||||
fp = os.path.join('.', 'mime.in.json')
|
||||
f = open(fp, 'r')
|
||||
o_mime = json.load(f)
|
||||
o['mime'] = o_mime
|
||||
|
||||
|
||||
fp = os.path.join('.', 'opensea_part.in.json')
|
||||
f = open(fp, 'r')
|
||||
o_opensea = json.load(f)
|
||||
for k in o_opensea['properties'].keys():
|
||||
p = {}
|
||||
for v in o_opensea['properties'][k]:
|
||||
p[v] = o_opensea['properties'][k][v]
|
||||
o['properties'][k] = p
|
||||
o['required'] += o_opensea['required']
|
||||
o['oneOf'] = o_opensea['oneOf']
|
||||
|
||||
|
||||
fp = os.path.join('.', 'nft.in.json')
|
||||
f = open(fp, 'r')
|
||||
o_nft = json.load(f)
|
||||
for k in o_nft['properties'].keys():
|
||||
p = {}
|
||||
for v in o_nft['properties'][k]:
|
||||
p[v] = o_nft['properties'][k][v]
|
||||
o['properties'][k] = p
|
||||
|
||||
|
||||
print(json.dumps(o))
|
24
cic.in.json
Normal file
24
cic.in.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "sha256:",
|
||||
"title": "CIC core metadata container",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"targets": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^(0x)?[a-fA-F0-9]{40}"
|
||||
}
|
||||
|
||||
},
|
||||
"attachments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "/mime"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["targets", "attachments"]
|
||||
}
|
50
cic.json
50
cic.json
@ -1,50 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "sha256:",
|
||||
"title": "CIC core metadata container",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"targets": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^(0x)?[a-fA-F0-9]{40}"
|
||||
}
|
||||
|
||||
},
|
||||
"attachments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "/mime"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["targets", "attachments"],
|
||||
"jsonmime": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "/mime",
|
||||
"title": "A single generic attachment for documenting any asset",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"contentType": {
|
||||
"type": "string",
|
||||
"$comment": "valid mime type"
|
||||
},
|
||||
"contentTransferEncoding": {
|
||||
"type": "string",
|
||||
"enum": ["BASE64", "QUOTED-PRINTABLE", "8BIT", "7BIT"]
|
||||
},
|
||||
"subject": {
|
||||
"type": "string",
|
||||
"$comment": "utf-8"
|
||||
},
|
||||
"body": {
|
||||
"type": "string",
|
||||
"$comment": "uri including dataurl"
|
||||
}
|
||||
},
|
||||
"required": ["contentType", "body", "subject"]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user