code: def _metadata():
      json_root = []
      numpy = __import__("numpy")
      with numpy.errstate(all="ignore"):
          snippets = onnx.backend.test.case.collect_snippets()
      all_schemas_with_history = (
          onnx.defs.get_all_schemas_with_history()
      )
      for schema in all_schemas_with_history:
          json_schema = {}
          json_schema["name"] = schema.name
          json_schema["module"] = (
              schema.domain if schema.domain else "ai.onnx"
          )
          json_schema["version"] = schema.since_version
          if (
              schema.support_level
              != onnx.defs.OpSchema.SupportType.COMMON
          ):
              json_schema["status"] = schema.support_level.name.lower()
          json_schema["description"] = _format_description(
              schema.doc.lstrip()
          )
          if schema.attributes:
              _update_attributes(json_schema, schema)
          if schema.inputs:
              _update_inputs(json_schema, schema.inputs)
          json_schema["min_input"] = schema.min_input
          json_schema["max_input"] = schema.max_input
          if schema.outputs:
              _update_outputs(json_schema, schema.outputs)
          json_schema["min_output"] = schema.min_output
          json_schema["max_output"] = schema.max_output
          if schema.min_input != schema.max_input:
              json_schema["inputs_range"] = (
                  _format_range(schema.min_input)
                  + " - "
                  + _format_range(schema.max_input)
              )
          if schema.min_output != schema.max_output:
              json_schema["outputs_range"] = (
                  _format_range(schema.min_output)
                  + " - "
                  + _format_range(schema.max_output)
              )
          if schema.type_constraints:
              _update_type_constraints(
                  json_schema, schema.type_constraints
              )
          if schema.name in snippets:
              _update_snippets(json_schema, snippets[schema.name])
          if schema.name in categories:
              json_schema["category"] = categories[schema.name]
          json_root.append(json_schema)
      json_root = sorted(
          json_root,
          key=lambda item: item["name"]
          + ":"
          + str(item["version"] if "version" in item else 0).zfill(4),
      )
      root_dir = os.path.dirname(
          os.path.dirname(os.path.realpath(__file__))
      )
      json_file = os.path.join(root_dir, "source", "onnx-metadata.json")
      content = _read(json_file)
      items = json.loads(content)
      items = list(
          filter(lambda item: item["module"] == "com.microsoft", items)
      )
      json_root = json_root + items
      _write(json_file, json.dumps(json_root, indent=2))
  
file_path: netron/tools/onnx_metadata.py
imports: import collections
  import json
  import os
  import re
  import onnx.backend.test.case
  import onnx.defs
label_desc: Use image node_id 13 for calling a global function with example usage: _metadata() without return types