JSON schema

json2ciw uses ProcessModel to validate the structure of a model before it is converted into a ciw network.

If you want to inspect the expected schema directly, you can generate it from the Pydantic model:

import json

from rich import print

from json2ciw.schema import ProcessModel

print(json.dumps(ProcessModel.model_json_schema(), indent=2))
{
  "$defs": {
    "Activity": {
      "description": "Define an activity in the process model.\n\nAttributes\n----------\nname : str\n    Activity 
name.\ntype : str\n    Activity type.\nresource : Resource\n    Resource used by the 
activity.\nservice_distribution : Distribution\n    Service-time distribution.\narrival_distribution : Distribution
or None\n    Arrival distribution for entry activities.\nrenege_distribution : Distribution or None\n    Reneging 
distribution for the activity.",
      "properties": {
        "name": {
          "title": "Name",
          "type": "string"
        },
        "type": {
          "title": "Type",
          "type": "string"
        },
        "resource": {
          "$ref": "#/$defs/Resource"
        },
        "service_distribution": {
          "$ref": "#/$defs/Distribution"
        },
        "arrival_distribution": {
          "anyOf": [
            {
              "$ref": "#/$defs/Distribution"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "renege_distribution": {
          "anyOf": [
            {
              "$ref": "#/$defs/Distribution"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        }
      },
      "required": [
        "name",
        "type",
        "resource",
        "service_distribution"
      ],
      "title": "Activity",
      "type": "object"
    },
    "Distribution": {
      "description": "Define a probability distribution specification.\n\nAttributes\n----------\ntype : Literal\n 
Distribution type.\nparameters : dict of str to float\n    Distribution parameters.",
      "properties": {
        "type": {
          "enum": [
            "exponential",
            "triangular",
            "uniform",
            "deterministic",
            "lognormal",
            "gamma",
            "normal"
          ],
          "title": "Type",
          "type": "string"
        },
        "parameters": {
          "additionalProperties": {
            "type": "number"
          },
          "title": "Parameters",
          "type": "object"
        }
      },
      "required": [
        "type",
        "parameters"
      ],
      "title": "Distribution",
      "type": "object"
    },
    "Resource": {
      "description": "Define a resource used by an activity.\n\nAttributes\n----------\nname : str\n    Resource 
name.\ncapacity : int\n    Resource capacity.",
      "properties": {
        "name": {
          "title": "Name",
          "type": "string"
        },
        "capacity": {
          "exclusiveMinimum": 0,
          "title": "Capacity",
          "type": "integer"
        }
      },
      "required": [
        "name",
        "capacity"
      ],
      "title": "Resource",
      "type": "object"
    },
    "Transition": {
      "description": "Define a transition between activities.\n\nAttributes\n----------\nsource : str\n    Source 
activity name.\ntarget : str\n    Target activity name or `\"Exit\"`.\nprobability : float\n    Transition 
probability.",
      "properties": {
        "from": {
          "title": "From",
          "type": "string"
        },
        "to": {
          "title": "To",
          "type": "string"
        },
        "probability": {
          "maximum": 1.0,
          "minimum": 0.0,
          "title": "Probability",
          "type": "number"
        }
      },
      "required": [
        "from",
        "to",
        "probability"
      ],
      "title": "Transition",
      "type": "object"
    }
  },
  "description": "Define a validated queueing network process model.\n\nAttributes\n----------\nname : str\n    
Model name.\ndescription : str or None\n    Model description.\nactivities : list of Activity\n    Activities in 
the model.\ntransitions : list of Transition\n    Directed transitions between activities.",
  "properties": {
    "name": {
      "title": "Name",
      "type": "string"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Description"
    },
    "activities": {
      "items": {
        "$ref": "#/$defs/Activity"
      },
      "title": "Activities",
      "type": "array"
    },
    "transitions": {
      "items": {
        "$ref": "#/$defs/Transition"
      },
      "title": "Transitions",
      "type": "array"
    }
  },
  "required": [
    "name",
    "activities",
    "transitions"
  ],
  "title": "ProcessModel",
  "type": "object"
}