GeertBellekens / Enterprise-Architect-Toolpack

Addins and tools for Sparx Systems Enterprise Architect
https://bellekens.com/product/bellekens-enterprise-architect-toolpack/
BSD 2-Clause "Simplified" License
97 stars 39 forks source link

Support for nullable fields in JSON schemas #129

Open Non0mnisMoriar opened 1 year ago

Non0mnisMoriar commented 1 year ago

Hello,

Thanks for this great toolpack - I'm using it mostly to design and export JSON schemas.

One important feature that I believe might be missing (or at least, I couldn't find how to do it! apologies if that is already supported) would be the support of nullable data types, i.e. something like a field on JSON_Attribute stereotype that once set would modify the attributes' type definition in the exported schema from (example with "string" type) :

"type" : "string"

to:

"type" ["string", "null"]

so that the JSON schema supports validating payloads with corresponding fields that have the null value.

I'm not sure how difficult it would be to support this though, but I believe this is a somewhat important feature of the JSON schema spec. (reference: http://json-schema.org/draft/2020-12/json-schema-validation.html#name-type)

Thanks again! Regards