blackbox_exporter icon indicating copy to clipboard operation
blackbox_exporter copied to clipboard

Add JSON Schema

Open PythonCoderAS opened this issue 1 year ago • 6 comments

I would like to include a JSON Schema for the blackbox.yml so that editing the file is easier in editors like VS Code.

PythonCoderAS avatar Aug 12 '24 22:08 PythonCoderAS

PRs welcome 🙏🏼

electron0zero avatar Oct 30 '25 13:10 electron0zero

I have a schema I wrote in Typebox, which is a schema generator in Typescript. The main issue is that it generates a lot of duplicate definitions since it uses references in Typescript.

Source: https://github.com/PythonCoderAS/schemas/tree/master/schemas/blackbox

Generated JSON: https://pythoncoderas.github.io/schemas/schemas/blackbox/schema.json

PythonCoderAS avatar Oct 31 '25 04:10 PythonCoderAS

not sure if I understand this? I was thinking more in terms of a code change in blackbox exporter where schema generation is automated using json tags in the config struct.

also, I would like to better understand how it would be used? and what use-cases it will solve?

electron0zero avatar Oct 31 '25 04:10 electron0zero

also, I would like to better understand how it would be used? and what use-cases it will solve?

It makes editing the config much easier, since it shows up like this in the editor:

Image

PythonCoderAS avatar Oct 31 '25 05:10 PythonCoderAS

cool, I am open to it, but it should be generated from the code, and it shouldn't need to be maintained manually. automation will ensure that it stays updated and doesn't drift over time.

electron0zero avatar Oct 31 '25 05:10 electron0zero

You probably want something like https://github.com/invopop/jsonschema

PythonCoderAS avatar Nov 01 '25 05:11 PythonCoderAS