Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I need a JSON schema editor for macOS. I found this:

https://www.json-buddy.com/ but it's Windows only and has what I call a "millions of tiny buttons" UI.

JSON schema is awesome but it's really tedious to write by hand, even if the basic is auto-generated. It can also get really complex and thumbs up or down doesn't cut it for developer experience.

I want something where I can debug/step through the validation.



I think nobody writes JSON Schema by hand .. I see most of them use their lang libs to generate it. What language are you using?


I agree. That's basically what I meant by, even when the base is auto-generated. In other words: you can generate a JSON schema from an example JSON. However, if you're using that to validate, say, an API response, the auto-generate tool can't possibly know what the valid range of values might be, or how some keys will shift depending on the request. Any type of variation like that requires hand-tuning.

I use it in a variety of languages: JS/TS, PHP, Java.


I believe a programming language can be written to generate any requirement you have on json schemas. Have you tried https://www.npmjs.com/package/ts-json-schema-generator and see what you can't do?

I built a json schema editor gui saas, and my conclusion is no one is buying because they use lang libs to generate it. So I kinda surprise you said you wanted an editor.


For my use case that doesn't really help at all. So I'm doing request/response in JSON with a third-party API and I want to programmatically detect if their response is valid, not based on any rules the API can know, but based on the context of my integration. So I use JSON schema to define what valid responses (for my particular application/integration) look like.

How I do this now, is to get an example response, auto-generate the schema using a tool like this https://extendsclass.com/json-schema-validator.html and then hand-tune from there. In some cases the same endpoint response can have huge variations depending on the request so it's very tedious doing this by hand.

A variation on the tool above that would help a lot would be if I could provide multiple example JSONs and it could return a schema that validates all of them.

JSON schema is used in MySQL now natively, it's used in PHP, and from what I can tell a lot of other languages. The package you linked to assumes you're generating it from JS/TS. As JSON becomes even more popular as a data interchange format I think that assumption will be less true.

This is just a complete guess, but maybe your tool wasn't getting traction just because it's so early in the life of JSON Schema. There's not even a final stable version 1 yet.


I got you now. The data comes from an external source, and then you wanted to infer json schema from it. So I guess the json response from APIs don't have json schema defined for you. But you could define schema from their api documentation, right? It doesn't matter what tool used to generate the json schema, we only care about the result that is the schema so that you can it wherever.

Trust me on JSON Schema spec, it's been in draft for a decade, to the point they stop calling it "draft" and put date on it instead. It's a frustrating specification (I read the whole thing dozen of time because I wanted it to fully compatible .. but decided to only adopt nice subset of it)

Your use case is very niche though.


> the json response from APIs don't have json schema defined for you. But you could define schema from their api documentation, right?

Yes exactly.

> it's been in draft for a decade

https://json-schema.org/blog/posts/future-of-json-schema#sta... https://github.com/json-schema-org/community/discussions/69

I can see they're working on this issue. Hopefully they get it resolved sooner rather than later.


I'm bearish on the spec. I think it's practically done since draft-4 or draft-7. Almost nobody is going to use something like dynamic scope recursion, and bundle (compound document), unless libs force them to.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: