in mozilla_schema_generator/probes.py [0:0]
def get_schema(self, addtlProps: Any) -> Any:
# Get the schema based on the probe type
if self.get_type() == "scalar":
ptype = self.get("details", "kind")
if ptype == "boolean":
pschema = {"type": "boolean"}
elif ptype == "string":
pschema = {"type": "string"}
elif ptype == "uint":
pschema = {"type": "integer"}
else:
raise Exception("Unknown scalar type " + ptype)
elif self.get_type() == "histogram":
pschema = self.histogram_schema
if self.description is not None:
pschema["description"] = self.description
# Add nested level if keyed
if self.get("details", "keyed"):
final_schema = {"type": "object", "additionalProperties": pschema}
else:
final_schema = pschema
return final_schema