Association metadata representation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Association metadata representation

bserdar
Which one is better?

The way it is specified:

            "something": {
                "type": "reference",
                "reference": {
                   "entity": "otherEntity",
                    "versionValue": "1.0.0",
                    "projection": { "field":"*", "recursive":true },
                    "query": {"field":"_id","op":"=","rfield":"$parent._id"}
                    }
             }

The way it is less redundant:

            "something": {
                "type": "reference",
                "entity": "otherEntity",
                "versionValue": "1.0.0",
                "projection": { "field":"*", "recursive":true },
                "query": {"field":"_id","op":"=","rfield":"$parent._id"}
             }

Reply | Threaded
Open this post in threaded view
|

Re: Association metadata representation

jewzaam
Administrator
+1 from me, looks good.  I like the type value being "reference".  If you want to enforce this in json schema it gets a bit tricky because you'll have to have a reference object where type is only allowed to be "reference".. but it can be done.
Reply | Threaded
Open this post in threaded view
|

Re: Association metadata representation

bserdar
I am trying tricks with large "oneOf" blocks in schema, no luck so far, lets see if I can figure it out
Reply | Threaded
Open this post in threaded view
|

Re: Association metadata representation

bserdar
Tricks with oneOf worked. Now schema looks like this:

fields:
   oneOf:
         { simpleField, with type one of simple types,  constraints, access }
         { objectField with type=object, constraints, access, fields }
         { arrayField with type=array, constraints, access, items }
         { referenceField with type=reference,constraints. access, entity, version, projection, query, sort }
   
For those who wants to review: 276bda1c12a3e9fc8561a336ae92ef08bee9bc56