enunciate icon indicating copy to clipboard operation
enunciate copied to clipboard

Support for JSON schema

Open vguna opened this issue 8 years ago • 3 comments

Hi.

Enunciate already creates nice XSDs describing the XML models. It would be great if it could also create a JSON schema out of it. Maybe supporting the default BeanValidation annotations like @NotNull, @Max, @Min, @Size etc.

vguna avatar May 19 '16 09:05 vguna

Yes, this has been requested before.

Have you ever used JSON schema for practical purposes? I've never personally seen it used in day-to-day development practices...

stoicflame avatar May 19 '16 14:05 stoicflame

In our new project, I'm aiming to use the json schema to validate our server responses during ITs in a "raw" fashion without the java<->json binding stuff.

Having a json schema would avoid writing testcases for the raw json structure (fieldnames, datatypes, required etc.). The ITs would use the once generated json schema to validate it against the changing json model in the future. That would make sure, that the contract is kept and violations are detected. The json schema in the ITs wouldn't be updated automatically during the build, but would be manually. Otherwise the schema/json would always be valid :).

Of course, that all assumes that there's a java json->schema validator out there - haven't checked yet ;). So for now it's just a nice to have. Otherwise I would write the schema manually...

vguna avatar May 19 '16 16:05 vguna

This enhancement is currently seeking a sponsor. If anybody is willing to sponsor the work, reach out to me and I'd be happy to pick it up.

stoicflame avatar Dec 16 '16 21:12 stoicflame