Re: JSON schema and some object format examples for thought/discussion
And, yes, my manic stream of emails *is* very much the equivalent of an unboxing video ;-) "Hey guys! I'm checking out the C_OBJECT commands today, let's open the docs!" ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: JSON schema and some object format examples for thought/discussion
...and take the prior as a sketch. Still working out the best way to organize type descriptors in this case. I want to be able to figure out the raw JSON type, if it's an array, what type it goes into in 4D (most important for arrays), and if there is any kind of extra type magic ("abstract" type) to do. Note that with the scheme above (or anything comparable, however implemented), ObjectType (unique key for defined objects) + ElementPath (unique key for elements), you get a clear index into the dictionary of definitions. Obviously, elements may repeat within the JSON*, but anything at the same type of path is expected to remain the same. So, you can't have: [ {"foo":"bar"}, {"foo":5} ] Not a problem in my case. * Cardinality rules are something else that you could specify in a schema-like system, if you have a need. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: JSON schema and some object format examples for thought/discussion
...in 4D code, something like this for defining the base object's basic components: // Object_RegisterRootObject OBRegister_RegisterObject (Object is RootObject;1;"Object_New";"Object_ToText") C_BOOLEAN($required) C_BOOLEAN($optional) $required:=True $optional:=False OBRegister_RegisterObject (Object is RootObject;"Root.header";Is object;$required) OBRegister_RegisterObject (Object is RootObject;"Root.header";Abstract type is ObjectType;$required) OBRegister_RegisterObject (Object is RootObject;"Root.version_number";Is real;$required) OBRegister_RegisterObject (Object is RootObject;"Root.instance_name";Is text;$optional) OBRegister_RegisterObject (Object is RootObject;"Root.body";Is object;$required) There are several custom constants in there. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **