xeipuuv / gojsonschema

An implementation of JSON Schema, draft v4 v6 & v7 - Go language
2.56k stars 358 forks source link

Generate Schemas? #124

Open jdoklovic opened 8 years ago

jdoklovic commented 8 years ago

Any chance you're willing to add in the ability to generate a schema based on a go object? similar to github.com/alecthomas/jsonschema or github.com/mcuadros/go-jsonschema-generator ?

Those above projects are very limited and don't seem to adhere to the spec.

xeipuuv commented 7 years ago

Not planned, but feel free to implement it :)

jdoklovic commented 7 years ago

@xeipuuv done. I created a separate library (actually took creating 3 libs alltogether) that can generate json-schema from go code. I've been using it extensively and it works well, especially combined with your validator.

I've mentioned this lib in the README as the preferred validator... maybe you could add a link to the generator in your readme?

anyway, check it out: https://github.com/brainicorn/jsonschemagen

hbagdi commented 5 years ago

https://github.com/alecthomas/jsonschema is another great tool. It seems like these two could be merged in together, could be very powerful.