JSON Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "/schemas",
  "description": "Nuanced Graph Schema",
  "type": "object",
  "patternProperties": { "^.+$": { "$ref": "#/$defs/node" } },
  "additionalProperties": false,
  "$defs": {
    "node": {
      "properties": {
        "filepath": { "type": "string" },
        "lineno": { "type": "integer" },
        "end_lineno": { "type": "integer" },
        "callees": { "type": "array", "items": { "type": "string" }  },
        "signature": { "type": "string" },
        "inferred_return_types": {
          "type": "array",
          "items": { "type": "string" }
        },
        "args": { "$ref": "#/$defs/functionDefArgs" }
      },
      "required": ["filepath", "callees", "lineno", "end_lineno"]
    },
    "functionDefArgs": {
      "properties": {
        "args": { "$ref": "#/$defs/functionDefArgArray" },
        "posonlyargs": { "$ref": "#/$defs/functionDefArgArray" },
        "kwonlyargs": { "$ref": "#/$defs/functionDefArgArray" },
        "vararg": { "$ref": "#/$defs/functionDefArg" },
        "kwarg": { "$ref": "#/$defs/functionDefArg" }
      },
      "required": ["args", "posonlyargs", "kwonlyargs", "vararg", "kwarg"]
    },
    "functionDefArgArray": {
      "type": "array",
      "items": { "$ref": "#/$defs/functionDefArg" }
    },
    "functionDefArg": {
      "properties": {
        "name": { "type": "string" },
        "inferred_types": { "type": "array", "items": { "type": "string" } }
      },
      "required": ["name"]
    }
  }
}

Example JSON

{
  "nuanced.code_graph.CodeGraph.__init__": {
    "filepath": "/Users/user/Source/nuanced/nuanced-python/src/nuanced/code_graph.py",
    "callees": [],
    "lineno": 93,
    "end_lineno": 94,
    "signature": "def __init__(self, graph: dict | None) -> None:",
    "inferred_return_types": [
      "None"
    ],
    "args": {
      "args": [
        {
          "name": "self",
          "inferred_types": []
        },
        {
          "name": "graph",
          "inferred_types": [
            "dict",
            "None"
          ]
        }
      ],
      "posonlyargs": [],
      "kwonlyargs": [],
      "vararg": null,
      "kwarg": null
    }
  }
}