Files
SystemSimulationApp/schemas/component-catalog-v1.schema.json

458 lines
9.2 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://systemsimulation.local/schemas/component-catalog-v1.schema.json",
"title": "SystemSimulation Component Catalog v1",
"type": "object",
"additionalProperties": false,
"required": [
"schemaVersion",
"libraries"
],
"properties": {
"schemaVersion": {
"const": 1
},
"libraries": {
"type": "array",
"items": {
"$ref": "#/$defs/library"
}
}
},
"$defs": {
"machineId": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]*$"
},
"version": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
},
"category": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"label",
"order"
],
"properties": {
"id": {
"$ref": "#/$defs/machineId"
},
"label": {
"type": "string",
"minLength": 1
},
"order": {
"type": "integer"
}
}
},
"portVariable": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"role",
"connectionRule",
"label",
"quantity",
"unit",
"resultVisible",
"order"
],
"properties": {
"name": {
"type": "string",
"pattern": "^[A-Za-z][A-Za-z0-9_]*$"
},
"role": {
"enum": [
"effort",
"flow",
"stream",
"signal"
]
},
"connectionRule": {
"enum": [
"equal",
"sumToZero",
"streamMix",
"directed"
]
},
"label": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "string",
"minLength": 1
},
"unit": {
"type": "string"
},
"resultVisible": {
"type": "boolean"
},
"order": {
"type": "integer"
}
}
},
"port": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"kind",
"domain",
"nominalRole",
"positiveFlowDirection",
"variables",
"side",
"order"
],
"properties": {
"name": {
"$ref": "#/$defs/machineId"
},
"kind": {
"enum": [
"physical",
"signal"
]
},
"domain": {
"$ref": "#/$defs/machineId"
},
"nominalRole": {
"enum": [
"inlet",
"outlet",
"bidirectional",
"input",
"output"
]
},
"positiveFlowDirection": {
"enum": [
"intoComponent",
null
]
},
"variables": {
"type": "array",
"items": {
"$ref": "#/$defs/portVariable"
}
},
"side": {
"enum": [
"left",
"right"
]
},
"order": {
"type": "integer"
}
}
},
"parameterOption": {
"type": "object",
"additionalProperties": false,
"required": [
"value",
"label"
],
"properties": {
"value": {
"type": "number"
},
"label": {
"type": "string",
"minLength": 1
}
}
},
"parameterCondition": {
"type": "object",
"additionalProperties": false,
"required": [
"parameter",
"values"
],
"properties": {
"parameter": {
"type": "string",
"pattern": "^[A-Za-z][A-Za-z0-9_]*$"
},
"values": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "number"
}
}
}
},
"parameterGroup": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"label",
"parameters",
"order",
"defaultExpanded"
],
"properties": {
"id": {
"$ref": "#/$defs/machineId"
},
"label": {
"type": "string",
"minLength": 1
},
"parameters": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "string",
"pattern": "^[A-Za-z][A-Za-z0-9_]*$"
}
},
"order": {
"type": "integer"
},
"defaultExpanded": {
"type": "boolean"
}
}
},
"parameter": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"label",
"quantity",
"unit",
"default",
"minimumExclusive"
],
"properties": {
"name": {
"type": "string",
"pattern": "^[A-Za-z][A-Za-z0-9_]*$"
},
"label": {
"type": "string",
"minLength": 1
},
"description": {
"type": "string",
"minLength": 1
},
"quantity": {
"type": "string",
"minLength": 1
},
"unit": {
"type": "string"
},
"default": {
"type": "number"
},
"minimum": {
"type": "number"
},
"maximum": {
"type": "number"
},
"minimumExclusive": {
"type": "boolean"
},
"editor": {
"enum": [
"amesimGasReference",
"amesimGasPropertyModel",
"choice"
]
},
"options": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/parameterOption"
}
},
"visibleWhen": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/parameterCondition"
}
}
},
"allOf": [
{
"if": {
"required": [
"editor"
],
"properties": {
"editor": {
"enum": [
"amesimGasPropertyModel",
"choice"
]
}
}
},
"then": {
"required": [
"options"
]
}
},
{
"if": {
"required": [
"options"
]
},
"then": {
"required": [
"editor"
],
"properties": {
"editor": {
"enum": [
"amesimGasPropertyModel",
"choice"
]
}
}
}
}
]
},
"component": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"modelType",
"modelVersion",
"label",
"symbol",
"order",
"category",
"ports",
"parameters"
],
"properties": {
"type": {
"$ref": "#/$defs/machineId"
},
"modelType": {
"$ref": "#/$defs/machineId"
},
"modelVersion": {
"$ref": "#/$defs/version"
},
"label": {
"type": "string",
"minLength": 1
},
"symbol": {
"$ref": "#/$defs/machineId"
},
"order": {
"type": "integer"
},
"role": {
"enum": [
"amesimGasMediumDefinition"
]
},
"category": {
"$ref": "#/$defs/category"
},
"ports": {
"type": "array",
"items": {
"$ref": "#/$defs/port"
}
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/$defs/parameter"
}
},
"parameterGroups": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/parameterGroup"
}
}
}
},
"library": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"label",
"version",
"sourcePackage",
"temporary",
"order",
"categories",
"components"
],
"properties": {
"id": {
"$ref": "#/$defs/machineId"
},
"label": {
"type": "string",
"minLength": 1
},
"version": {
"$ref": "#/$defs/version"
},
"sourcePackage": {
"type": "string",
"minLength": 1
},
"temporary": {
"type": "boolean"
},
"order": {
"type": "integer"
},
"categories": {
"type": "array",
"items": {
"$ref": "#/$defs/category"
}
},
"components": {
"type": "array",
"items": {
"$ref": "#/$defs/component"
}
}
}
}
}
}