mightstone.services.cardconjurer.models.Template
- pydantic model mightstone.services.cardconjurer.models.Template
A Template as described in Card Conjurer JSON
Show JSON schema
{ "title": "Template", "description": "A Template as described in Card Conjurer JSON", "type": "object", "properties": { "asset_root_url": { "default": "", "title": "Asset Root Url", "type": "string" }, "name": { "title": "Name", "type": "string" }, "context": { "$ref": "#/$defs/TemplateContext" }, "card": { "$ref": "#/$defs/Card" } }, "$defs": { "Bound": { "properties": { "x": { "title": "X", "type": "integer" }, "y": { "title": "Y", "type": "integer" }, "width": { "title": "Width", "type": "integer" }, "height": { "title": "Height", "type": "integer" }, "type": { "$ref": "#/$defs/BoundType" }, "horizontal": { "$ref": "#/$defs/HorizontalAlign" }, "vertical": { "$ref": "#/$defs/VerticalAlign" } }, "required": [ "x", "y", "width", "height", "type", "horizontal", "vertical" ], "title": "Bound", "type": "object" }, "BoundType": { "enum": [ "fit", "fill" ], "title": "BoundType", "type": "string" }, "Card": { "description": "A Card as described in Card Conjurer JSON", "properties": { "asset_root_url": { "default": "", "title": "Asset Root Url", "type": "string" }, "name": { "title": "Name", "type": "string" }, "width": { "title": "Width", "type": "integer" }, "height": { "title": "Height", "type": "integer" }, "corners": { "default": 0, "title": "Corners", "type": "integer" }, "marginX": { "default": 0, "title": "Marginx", "type": "integer" }, "marginY": { "default": 0, "title": "Marginy", "type": "integer" }, "dependencies": { "allOf": [ { "$ref": "#/$defs/Dependencies" } ], "default": { "extensions": [], "template": null } }, "data": { "allOf": [ { "$ref": "#/$defs/Group" } ], "default": { "type": "group", "name": null, "tags": null, "children": [] } } }, "required": [ "name", "width", "height" ], "title": "Card", "type": "object" }, "Dependencies": { "properties": { "extensions": { "default": [], "items": { "type": "string" }, "title": "Extensions", "type": "array" }, "template": { "anyOf": [ { "$ref": "#/$defs/TemplateRef" }, { "type": "null" } ], "default": null } }, "title": "Dependencies", "type": "object" }, "FilterOverlay": { "properties": { "type": { "const": "colorOverlay", "enum": [ "colorOverlay" ], "title": "Type", "type": "string" }, "color": { "format": "color", "title": "Color", "type": "string" } }, "required": [ "type", "color" ], "title": "FilterOverlay", "type": "object" }, "FilterShadow": { "properties": { "type": { "const": "shadow", "enum": [ "shadow" ], "title": "Type", "type": "string" }, "color": { "default": "black", "format": "color", "title": "Color", "type": "string" }, "x": { "title": "X", "type": "integer" }, "y": { "title": "Y", "type": "integer" } }, "required": [ "type", "x", "y" ], "title": "FilterShadow", "type": "object" }, "Group": { "description": "A layer composed of a list of other layers (One of the 3 possible layer types)", "properties": { "type": { "const": "group", "default": "group", "enum": [ "group" ], "title": "Type", "type": "string" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Name" }, "tags": { "anyOf": [ { "items": { "$ref": "#/$defs/Tags" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Tags" }, "children": { "default": [], "items": { "discriminator": { "mapping": { "group": "#/$defs/Group", "image": "#/$defs/Image", "text": "#/$defs/Text" }, "propertyName": "type" }, "oneOf": [ { "$ref": "#/$defs/Group" }, { "$ref": "#/$defs/Text" }, { "$ref": "#/$defs/Image" } ] }, "title": "Children", "type": "array" } }, "title": "Group", "type": "object" }, "HorizontalAlign": { "enum": [ "left", "right", "center" ], "title": "HorizontalAlign", "type": "string" }, "Image": { "description": "A layer composed of an image (One of the 3 possible layer types)", "properties": { "type": { "const": "image", "enum": [ "image" ], "title": "Type", "type": "string" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Name" }, "tags": { "anyOf": [ { "items": { "$ref": "#/$defs/Tags" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Tags" }, "src": { "title": "Src", "type": "string" }, "x": { "default": 0, "title": "X", "type": "integer" }, "y": { "default": 0, "title": "Y", "type": "integer" }, "z": { "default": 0, "title": "Z", "type": "integer" }, "width": { "default": 100, "title": "Width", "type": "integer" }, "height": { "default": 100, "title": "Height", "type": "integer" }, "thumb": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Thumb" }, "bounds": { "anyOf": [ { "$ref": "#/$defs/Bound" }, { "type": "null" } ], "default": null }, "masks": { "anyOf": [ { "items": { "$ref": "#/$defs/Mask" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Masks" }, "opacity": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Opacity" }, "filters": { "anyOf": [ { "items": { "discriminator": { "mapping": { "colorOverlay": "#/$defs/FilterOverlay", "shadow": "#/$defs/FilterShadow" }, "propertyName": "type" }, "oneOf": [ { "$ref": "#/$defs/FilterShadow" }, { "$ref": "#/$defs/FilterOverlay" } ] }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Filters" } }, "required": [ "type", "src" ], "title": "Image", "type": "object" }, "Mask": { "properties": { "type": { "const": "image", "enum": [ "image" ], "title": "Type", "type": "string" }, "name": { "title": "Name", "type": "string" }, "src": { "title": "Src", "type": "string" } }, "required": [ "type", "name", "src" ], "title": "Mask", "type": "object" }, "SymbolSet": { "properties": { "name": { "title": "Name", "type": "string" }, "symbols": { "items": { "$ref": "#/$defs/TemplateSymbol" }, "title": "Symbols", "type": "array" }, "prototype": { "title": "Prototype", "type": "object" }, "srcPrefix": { "title": "Srcprefix", "type": "string" } }, "required": [ "name", "symbols", "prototype", "srcPrefix" ], "title": "SymbolSet", "type": "object" }, "Tags": { "description": "Another important note is that many text and image layers have the tags \"editable\",\nand there are two groups tagged \"new-image-group\" and \"new-text-group\". These tags\ntell the UI which layers should be presented as editable, and which layer groups\nshould store newly-added layers.", "enum": [ "editable", "draggable", "new-image-group", "new-text-group", "name" ], "title": "Tags", "type": "string" }, "TemplateContext": { "description": "The Template Context is pretty large, but here are the main sections. We'll break\neach one down individually, in detail.", "properties": { "license": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "title": "License" }, "imageSets": { "default": [], "items": { "$ref": "#/$defs/TemplateContextImageSet" }, "title": "Imagesets", "type": "array" }, "fonts": { "default": [], "items": { "$ref": "#/$defs/TemplateFont" }, "title": "Fonts", "type": "array" }, "symbolSets": { "default": [], "items": { "$ref": "#/$defs/SymbolSet" }, "title": "Symbolsets", "type": "array" } }, "title": "TemplateContext", "type": "object" }, "TemplateContextImageSet": { "description": "The goal of an image set is to describe how to add an image layer for each\navailable image in your template. They can organize your images into distinct\ngroups that share common traits, and can remove certain duplicated information.", "properties": { "prototype": { "title": "Prototype", "type": "object" }, "variants": { "items": { "$ref": "#/$defs/Variant" }, "title": "Variants", "type": "array" }, "masks": { "anyOf": [ { "items": { "$ref": "#/$defs/Mask" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Masks" } }, "required": [ "prototype", "variants" ], "title": "TemplateContextImageSet", "type": "object" }, "TemplateFont": { "description": "Fonts are nice and simple. All you define here are the names and URLs of your\nfonts. You can also declare the \"weight\" and \"style\" if you have variants of\nfonts with the same name.", "properties": { "name": { "title": "Name", "type": "string" }, "src": { "title": "Src", "type": "string" }, "weight": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Weight" }, "style": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Style" } }, "required": [ "name", "src" ], "title": "TemplateFont", "type": "object" }, "TemplateRef": { "properties": { "url": { "title": "Url", "type": "string" } }, "required": [ "url" ], "title": "TemplateRef", "type": "object" }, "TemplateSymbol": { "properties": { "src": { "title": "Src", "type": "string" }, "name": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "string" } ], "title": "Name" } }, "required": [ "src", "name" ], "title": "TemplateSymbol", "type": "object" }, "Text": { "description": "A layer composed of a text (One of the 3 possible layer types)", "properties": { "type": { "const": "text", "enum": [ "text" ], "title": "Type", "type": "string" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Name" }, "tags": { "anyOf": [ { "items": { "$ref": "#/$defs/Tags" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Tags" }, "text": { "title": "Text", "type": "string" }, "font": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Font" }, "color": { "default": "white", "format": "color", "title": "Color", "type": "string" }, "oneLine": { "default": false, "title": "Oneline", "type": "boolean" }, "align": { "anyOf": [ { "$ref": "#/$defs/HorizontalAlign" }, { "type": "null" } ], "default": "left" }, "verticalAlign": { "anyOf": [ { "$ref": "#/$defs/VerticalAlign" }, { "type": "null" } ], "default": "center" }, "lineHeightScale": { "default": 1, "title": "Lineheightscale", "type": "number" }, "fontWeight": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Fontweight" }, "rotation": { "default": 0, "title": "Rotation", "type": "integer" }, "size": { "title": "Size", "type": "integer" }, "opacity": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Opacity" }, "x": { "title": "X", "type": "integer" }, "y": { "title": "Y", "type": "integer" }, "width": { "title": "Width", "type": "integer" }, "height": { "title": "Height", "type": "integer" }, "textCodesOnly": { "default": false, "title": "Textcodesonly", "type": "boolean" }, "filters": { "anyOf": [ { "items": { "anyOf": [ { "$ref": "#/$defs/FilterShadow" }, { "$ref": "#/$defs/FilterOverlay" } ] }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Filters" } }, "required": [ "type", "text", "size", "x", "y", "width", "height" ], "title": "Text", "type": "object" }, "Variant": { "properties": { "name": { "title": "Name", "type": "string" }, "src": { "title": "Src", "type": "string" }, "thumb": { "title": "Thumb", "type": "string" }, "x": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "X" } }, "required": [ "name", "src", "thumb" ], "title": "Variant", "type": "object" }, "VerticalAlign": { "enum": [ "top", "center", "bottom" ], "title": "VerticalAlign", "type": "string" } }, "required": [ "name", "context", "card" ] }
- Fields:
- field asset_root_url: str = ''
Not part of CardConjurer model This allow to re-contextualize relative path and build proper urls
- field context: TemplateContext [Required]
- field name: str [Required]
- classmethod dummy()
- Returns:
A dummy template, with nothing in it