Projecting JSON #22
-
I see you can set the setting %JSONINCLUDE = "none" to exclude from the projection. It seems I get compilation errors if I don't set this setting for every property. Is there a way to default to %JSONINCLUDE = "none" when it's not set? What about when a property is an object reference. What if you just want one or two pieces of data from that object reference and not the whole thing? I assume that object has to be JSON enabled as well? Ok lets say you HAVE to either include or exclude all the properties in the projection to make it work (I think that's the answer). What if one API call needs to send some information from the class and another needs to send a different set of data from the class? I'm thinking this works is you start with REALLY good class design and you can be intentional about relationships and cardinality and not storing 100 properties on one persistent class. Is there a way to arrange the data as needed depending on the implementation without converting to a dynamic object and removing a bunch of data from the object? I'm thinking our better bet is just to write implementation classes that just loop through the data and collect the properties we need and arranging them in the data model we need than simply projecting the tables. Looking forward to thoughts! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
That said, the attraction to this, and what I'm exploring is a code first approach that produces to OpenAPI spec for documentation purposes. Can I still use this feature if I get a JSON object in another way (i.e. not using %pkg.isc.json.adaptor). Would I need a object.%ToJSON() or do I need to start with just a dynamic object? Where's my starting point in the doc for this approach? |
Beta Was this translation helpful? Give feedback.
-
@mdavidovichHst it's good to hear from you again!
This means that you can JSON-enable a class without JSON-enabling every other registered class referenced by it directly or indirectly. It does, however, mean that you need to define custom JSON mappings (in XData blocks) to be able to do JSON import/export with just the subset of properties you're interested in. I believe (but haven't tested/verified) that overriding the |
Beta Was this translation helpful? Give feedback.
@mdavidovichHst it's good to hear from you again!
%pkg.isc.json.adaptor
defines a parameter that can be overridden to avoid such compilation errors:This means that you can JSON-enable a class without JSON-enabling every other registered class referenced by it directly or indirectly. It does, however, mean that you need to define custom JSON mappings (in XData blocks) to be able to do JSON import/export with just the subset of properties you're interested in.
I believe (but haven't tested/verified) that overriding the
%JSONR…