Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
111–120 of 179 posts
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#112This gives you a pretty good feel for where it’s at: https://json-schema.org/blog/posts/future-of-json-schema I’m invested in it. I’m using it to provide implementation-specific validation of requests to/from a third party API. I wish there was a good macOS editor or IDEA plugin for it with autocomplete etc. The static generators from examples are obscure, ugly, minimal, and can’t account for variations. It isn’t ple…
What are you trying to do in regard to your API? I just developed an extensive API definition using OpenAPI, which (as of version 3.1) is compliant with JSON Schema. I used Stoplight Studio on Mac OS, although it still doesn't fully support OAS 3.1 two years after it became the current OpenAPI standard. The support from tools and generators is terrible; there's still no apparent toolchain that supports version 3.1 fr…
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#113JSON Schema is awesome. I wish Typescript had better support for it though, having to do stuff in Zod and JSON Scheme sucks. I have a system I built that compiles TS types to JSON schema, which then validates data coming into my endpoints, this way I am typesafe at compile time (Typescript API) but if someone hits my REST endpoint w/o using my library, I still get runtime goodness. The number of different ways that J…
What tool do you use to generate json schema from typescript?
As an extra, our frontend uses the same shared TS code for data transfer objects, this way there's an extra level of type safety at the API.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#114I use json schema to communicate the potential shape of JSON input and output to co-workers who have to produce or consume said JSON, and use it to validate incoming requests via valijson. It's somewhat clunky. Stability guarantees? Well, it's all namespaced anyways, isn't it.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#115Started using it for my site. Have a hard time navigating the docs and understanding the best types of schema for different purposes. Is there a great guide that anyone knows of?
This one is good - https://json-schema.org/understanding-json-schema/index.html . I also found this site useful - https://cswr.github.io/JsonSchema/spec/grammar/ .
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#116Earlier quoted context omitted.
If you're going from Zod parsers to JSON schema, are you duplicating that in Typescript? Or can you just go ts-to-zod[1] then zod-to-json-schema? [1]: https://github.com/fabien0102/ts-to-zod
Zod schemas are the source of truth, from which TS types are inferred and JSON schemas are generated.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#117Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#118Keeping things compatible is essentially always preferable. Making breaking changes is in isolation a bad thing but can be worth it for what you get out of it.
Is there a wishlist of "if only we could break compatibility, we'd do X/Y/Z"?
> The specifications that have been published to date provide no stability guarantees, but we will be adding explicit guarantees with the next publication. However, it seems disingenuous to promise "no breaking changes" while including breaking changes.
Not really, this seems pretty par for the course of any project hitting a 1.0 release - announcing that things are now stable. Perhaps that's a better framing, you wouldn't release something saying no breaking changes while containing breaking changes, but releasing something that has breaking changes as a stable thing makes a lot of sense.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#119Earlier quoted context omitted.
That sounds like a limitation of the implementation. Decimal types exist. If the implementation wants to account for some floating point errors I think that's fine too. If they want to codify it though, maybe add an epsilon param so the user can specify how close they want it to be.
Decimal types don't exist in JSON. If you need decimals, you definitely should encode them as strings. As JSONschema exists to document JSON, it should be agnostic to that. You can if you wish, provide format information in the format field, which is not prescriptive.
Having said that most implementations don't use decimal floating points to represent these.
Re: Ask HN: Do you use JSON Schema? Help us shape its future stability guarantees
#120Here's my gripe with jsonschema... In most cases where I want to do some validation on JSON I find that I usually have a class/struct/object that represents the payload and I want to unpack JSON into it (or dump that class to JSON). Ultimately, there are already nice tools to do this (eg; marshmallow on the python side). So unless I'm crossing language boundaries writing a separate jsonschema and using that is more w…
To say something concrete about this: it’s vital that JSONSchema have the ability to provide arbitrary namespace-friendly metadata at a field level. This would allow the schema itself to be extended to specify serialization details - much like Kubernetes YAML can go far beyond specifying a deployment and be tagged with various kinds of behavior modifiers. In theory this is already supported - ish. Because unknown key…