json schema for catcli.catalog
PAFlores opened this issue · 4 comments
Can you please post the json schema for the catcli.catalog file so that it can be read easily through an programming language ( such as java, C#, python, or etc.. ) as json library/modules ask for the schema to be able to read in and properly format the data. Schema generators get the maccess field type incorrect and in some instances insist that the data file (catcli.catalog) does not conform to the schema it attempts to generate based on the catcli.catalog file.
Thank you.
I'm sorry but I don't have a json schema. I can try to create one to match the format but since you used generators, could you provide me which one you used and what were the exact issue/error message?
BTW the maccess
field is retrieved from os.path.getmtime
(https://docs.python.org/3/library/os.path.html) and returns a floating point number giving the number of seconds since the epoch.
@PAFlores here's what I got using https://jsonformatter.org/json-to-jsonschema. Not sure it matches your needs though:
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/Welcome4",
"definitions": {
"Welcome4": {
"type": "object",
"additionalProperties": false,
"properties": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/Welcome4Child"
}
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"children",
"name",
"type"
],
"title": "Welcome4"
},
"Welcome4Child": {
"type": "object",
"additionalProperties": false,
"properties": {
"attr": {
"$ref": "#/definitions/AttrUnion"
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/ChildChild"
}
},
"free": {
"type": "integer"
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
},
"total": {
"type": "integer"
},
"ts": {
"type": "integer"
},
"type": {
"type": "string"
}
},
"required": [
"attr",
"name",
"type"
],
"title": "Welcome4Child"
},
"AttrClass": {
"type": "object",
"additionalProperties": false,
"properties": {
"access": {
"type": "integer"
},
"access_version": {
"type": "string"
},
"created": {
"type": "integer"
},
"created_version": {
"type": "string"
}
},
"required": [
"access",
"access_version",
"created",
"created_version"
],
"title": "AttrClass"
},
"ChildChild": {
"type": "object",
"additionalProperties": false,
"properties": {
"maccess": {
"type": "number"
},
"md5": {
"type": "null"
},
"name": {
"type": "string"
},
"relpath": {
"type": "string"
},
"size": {
"type": "integer"
},
"type": {
"type": "string"
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/ChildChild"
}
}
},
"required": [
"maccess",
"md5",
"name",
"relpath",
"size",
"type"
],
"title": "ChildChild"
},
"AttrUnion": {
"anyOf": [
{
"$ref": "#/definitions/AttrClass"
},
{
"type": "string"
}
],
"title": "AttrUnion"
}
}
}
Sure, happy it helped!