zcbot/software-contracts/origin.plot.v2.json

288 lines
8.9 KiB
JSON

{
"capability": "origin.plot@v2",
"display_name": "Origin 科研绘图",
"default_enrollment": true,
"output_namespace": "origin",
"input_policy": {
"suffixes": [".csv", ".xlsx", ".json"],
"max_count": 16,
"max_bytes": 104857600,
"max_total_bytes": 536870912
},
"outputs": {
"project": {
"filename": "project.opju",
"media_type": "application/x-origin-project",
"relative_path": "project.opju",
"publish": true,
"required": false
},
"figure_png": {
"filename": "figure.png",
"media_type": "image/png",
"relative_path": "figure.png",
"publish": true,
"required": false
},
"figure_svg": {
"filename": "figure.svg",
"media_type": "image/svg+xml",
"relative_path": "figure.svg",
"publish": true,
"required": false
},
"figure_pdf": {
"filename": "figure.pdf",
"media_type": "application/pdf",
"relative_path": "figure.pdf",
"publish": true,
"required": false
},
"plot_spec": {
"filename": "plot-spec.json",
"media_type": "application/json",
"relative_path": ".meta/plot-spec.json",
"publish": false,
"required": true
},
"provenance": {
"filename": "provenance.json",
"media_type": "application/json",
"relative_path": ".meta/provenance.json",
"publish": false,
"required": true
}
},
"feature_path": ["operation", "plot", "type"],
"features": {
"line": "0.3.0",
"scatter": "0.3.0",
"line_scatter": "0.3.0",
"column": "0.4.0",
"bar": "0.4.0",
"grouped_column": "0.4.0",
"y_error": "0.4.0",
"contour": "0.4.0",
"surface_3d": "0.4.0",
"ternary": "0.4.0",
"heatmap": "0.4.0"
},
"summary": {
"title_path": ["operation", "plot", "title"]
},
"legacy_runtime": {
"detail_path": ["origin"],
"slots_path": ["available_slots"],
"assumed_adapter_version": "0.3.0"
},
"request_schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"x-maxBytes": 262144,
"required": ["schema_version", "inputs", "operation", "outputs"],
"additionalProperties": false,
"properties": {
"schema_version": {"const": 2},
"inputs": {
"type": "array",
"minItems": 1,
"maxItems": 16,
"items": {
"type": "object",
"required": ["key", "artifact_id"],
"additionalProperties": false,
"properties": {
"key": {"type": "string", "pattern": "^[a-z][a-z0-9_]{0,31}$"},
"artifact_id": {"type": "string", "format": "uuid"},
"selector": {
"type": "object",
"required": ["sheet"],
"additionalProperties": false,
"properties": {
"sheet": {"type": "string", "minLength": 1, "maxLength": 128}
}
}
}
}
},
"operation": {
"type": "object",
"required": ["plot"],
"additionalProperties": false,
"properties": {
"plot": {
"type": "object",
"required": ["type", "series"],
"additionalProperties": false,
"properties": {
"type": {
"enum": [
"line", "scatter", "line_scatter", "column", "bar",
"grouped_column", "y_error", "contour", "surface_3d",
"ternary", "heatmap"
]
},
"series": {
"type": "array",
"minItems": 1,
"maxItems": 16,
"uniqueItems": true,
"items": {
"type": "object",
"required": ["input"],
"additionalProperties": false,
"properties": {
"input": {"type": "string", "pattern": "^[a-z][a-z0-9_]{0,31}$"},
"x": {"type": "string", "minLength": 1, "maxLength": 128},
"y": {"type": "string", "minLength": 1, "maxLength": 128},
"z": {"type": "string", "minLength": 1, "maxLength": 128},
"y_error": {"type": "string", "minLength": 1, "maxLength": 128},
"label": {"type": "string", "minLength": 1, "maxLength": 200}
}
}
},
"template": {"const": "publication_double_column"},
"title": {"type": "string", "maxLength": 500},
"x_axis": {"$ref": "#/$defs/axis"},
"y_axis": {"$ref": "#/$defs/axis"},
"z_axis": {"$ref": "#/$defs/axis"},
"legend": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {"const": true},
"position": {"const": "top_right"}
}
},
"error_bars": {"type": "null"}
},
"allOf": [
{
"if": {"properties": {"type": {"enum": ["contour", "surface_3d", "ternary", "heatmap"]}}},
"then": {
"properties": {
"series": {
"maxItems": 1,
"items": {
"required": ["input", "x", "y", "z"],
"not": {"required": ["y_error"]}
}
}
}
}
},
{
"if": {"properties": {"type": {"const": "y_error"}}},
"then": {
"properties": {
"series": {
"items": {
"required": ["input", "x", "y", "y_error"],
"not": {"required": ["z"]}
}
}
}
}
},
{
"if": {"properties": {"type": {"const": "grouped_column"}}},
"then": {
"properties": {
"series": {
"minItems": 2,
"items": {
"required": ["input", "x", "y"],
"not": {"anyOf": [{"required": ["z"]}, {"required": ["y_error"]}]}
}
}
}
}
},
{
"if": {"properties": {"type": {"enum": ["line", "scatter", "line_scatter", "column", "bar"]}}},
"then": {
"properties": {
"series": {
"items": {
"required": ["input", "x", "y"],
"not": {"anyOf": [{"required": ["z"]}, {"required": ["y_error"]}]}
}
}
}
}
}
]
}
}
},
"outputs": {
"type": "array",
"minItems": 1,
"maxItems": 4,
"uniqueItems": true,
"items": {
"oneOf": [
{
"type": "object",
"required": ["key", "type", "format"],
"additionalProperties": false,
"properties": {
"key": {"const": "project"},
"type": {"const": "project"},
"format": {"const": "opju"}
}
},
{
"type": "object",
"required": ["key", "type", "format"],
"additionalProperties": false,
"properties": {
"key": {"const": "figure_png"},
"type": {"const": "figure"},
"format": {"const": "png"},
"options": {
"type": "object",
"required": ["dpi"],
"additionalProperties": false,
"properties": {"dpi": {"type": "integer", "minimum": 72, "maximum": 1200}}
}
}
},
{
"type": "object",
"required": ["key", "type", "format"],
"additionalProperties": false,
"properties": {
"key": {"const": "figure_svg"},
"type": {"const": "figure"},
"format": {"const": "svg"}
}
},
{
"type": "object",
"required": ["key", "type", "format"],
"additionalProperties": false,
"properties": {
"key": {"const": "figure_pdf"},
"type": {"const": "figure"},
"format": {"const": "pdf"}
}
}
]
}
}
},
"$defs": {
"axis": {
"type": "object",
"additionalProperties": false,
"properties": {
"title": {"type": "string"},
"unit": {"type": "string"},
"scale": {"const": "linear"}
}
}
}
}
}