Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: coeko50 on August 07, 2014, 03:28:27 am

Title: Generate JSON schema syntax from a model
Post by: coeko50 on August 07, 2014, 03:28:27 am
Hi, EA supports the generation of XSD schemas from within the tool but  we  using JSON. Has anybody generated JSON
Title: Re: Generate JSON schema syntax from a model
Post by: qwerty on August 07, 2014, 03:41:30 am
Haven't read anything related here. But you can tweak the the code generation to create JSON (I guess). At least you would be able to do it via automation.

q.
Title: Re: Generate JSON schema syntax from a model
Post by: skiwi on August 14, 2014, 08:55:50 am
Quote
Hi, EA supports the generation of XSD schemas from within the tool but  we  using JSON. Has anybody generated JSON

A fine idea
Title: Re: Generate JSON schema syntax from a model
Post by: wikitect on July 22, 2016, 09:12:02 pm
The built in SpiderMonkey JavaScript Engine is 7 years old and doesn't support JSON ... http://sparxsystems.com/forums/smf/index.php/topic,31211.0.html (http://sparxsystems.com/forums/smf/index.php/topic,31211.0.html)
Title: Re: Generate JSON schema syntax from a model
Post by: Geert Bellekens on July 23, 2016, 05:16:23 pm
I think the new Schema Composer does JSON

Geert
Title: Re: Generate JSON schema syntax from a model
Post by: wikitect on July 25, 2016, 02:55:04 am
Yes, indeed this looks to be possible - see http://sparxsystems.com/downloads/whitepapers/the-schema-composer.pdf (http://sparxsystems.com/downloads/whitepapers/the-schema-composer.pdf)

Is it possible to then use a defined schema to export an entire model?
Title: Re: Generate JSON schema syntax from a model
Post by: Geert Bellekens on July 25, 2016, 05:06:49 pm
In theory it is, but it might be a bit slow.

I wrote a script a while ago to add a complete data model into the schema composer: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Projects/Project%20A/Temp/SetPackageToSchema.vbs (https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Projects/Project%20A/Temp/SetPackageToSchema.vbs)

Geert
Title: Re: Generate JSON schema syntax from a model
Post by: Geert Bellekens on June 18, 2019, 10:34:45 pm
For those still interested in this. I just finished the first version of an add-in that supports modelling and generating JSON Schema.

See https://bellekens.com/ea-json/ (https://bellekens.com/ea-json/)

Geert
Title: Re: Generate JSON schema syntax from a model
Post by: jasen on December 16, 2020, 04:59:15 am
Fairly soon I am going to need to generate some JSON schemas. Don't know much about them yet but I tried Mr Belleken's JSON's EA plug in. It looks good but every time I try to generate a JSON schema I get an error:

EA JSON (EAJSON.EAJSONAddin)
"EA_MenuClick:Invalid URI: The URI is empty"

Is the plug-in trying to validate my schema and not finding a Schema attribute and URI?
I tried to implement the same schema as in the EAJSON example on the plug in web page but had the same problem. I've tried with EA V12.0 and EA V15.
What am I doing wrong, has anyone else tried this plugin?
Title: Re: Generate JSON schema syntax from a model
Post by: Geert Bellekens on December 16, 2020, 05:30:24 am
Hmm, I think I'm going to add issue to the webpage (and I should probably catch that exception and return a more user friendly error message) ???

The problem is that the tagged value "id" in your JSONSchema element is empty.

Fill that with "http://example.com" and the error should disappear.

Geert
Title: Re: Generate JSON schema syntax from a model
Post by: jasen on December 16, 2020, 09:15:49 pm
Excellent, thanks for the quick response. I can now generate JSON schemas, very easy  :D
Title: Re: Generate JSON schema syntax from a model
Post by: nathmaheshmp on December 16, 2020, 11:46:14 pm

Thanks for the quick reply:)