5 ms·
I was unaware of the usefulness of JSON Schema until recently I was writing some Vega Lite json specs in VS Code. I don't have any relevant json extensions, bu
by RobinL 9y ago
I was unaware of the usefulness of JSON Schema until recently I was writing some Vega Lite json specs in VS Code.
I don't have any relevant json extensions, but VS Code started auto-suggesting values for options (e.g. a drop down for whether the chart type is a 'bar', 'line', etc.) and pointing our mistakes like 'the size should be an integer not a percent'.
This was the lightbulb moment for me - as if by magic, my code editor was double checking my json document was valid and helping me write it. Amazing, and super useful.
It took me a while to work out how it was doing it, but all vega lite examples start with the magic:
"$schema": "https://vega.github.io/schema/vega-lite/v2.json" https://vega.github.io/schema/vega-lite/v2.json".
- malkia 9y agoI'm trying to find time, among many blockers that I have to take a look at Vega Lite - as another alternative/addition to kibana or grafana, also last night found DejaVu - https://github.com/appbaseio/dejavu https://github.com/appbaseio/dejavu - and yes, JSON schema comes off often enough, since we moved a lot of our configuration there, and hated or not XML had the XSD sanity...
- davidp 9y agoThis light bulb is exactly why many people prefer statically-typed programming languages, especially above a certain codebase size/complexity and team size. Make my tools do the grunt-work for me, thanks, so I can focus on the actual problem domain.
- vilmosi 9y agoBut this is about application or user specific config. In my experience, those tend to be either json, yml or plain terminal args regardless of the fact that the language is typed or not. Am I missing something?
- HumanDrivenDev 9y ago> This light bulb is exactly why many people prefer statically-typed programming languages, especially above a certain codebase size/complexity and team size. I agree, with the caveat that sometimes you need an escape valve. Basically I want static typing 99% of the time and I don't want guff from the compiler (or fanboys) in that 1%.
- runeks 9y agoThat’s what (unchecked) exceptions are for. They’re supported by all general purpose programming languages because we — as developers — are smarter than the compiler.
- manigandham 9y agoC# and Typescript are great at this, and a great combo together.
- majewsky 9y agoWorking link: https://vega.github.io/schema/vega-lite/v2.json https://vega.github.io/schema/vega-lite/v2.json
- bundle 9y agohttps://jsonschema.net https://jsonschema.net may help you get started without the pain of writing boilerplate code. Unfortunately it doesn't perform validation, nor implement all validation annotations - but it definitely helped me get started.