Question
Ming Zhou · Jan 21

How to get all properties defined in a class from %Dictionary.ClassDefinition?

I am looking for a way to find all properties defined in any given class through coding, including those inherited from parent class(s). In case of inherited properties, I would like to know from which class etc.

A related question: XML adaptor provides a way to export xml schema for a class. Is there a similar method for JSON adaptor to generate a JSON schema for a class?

Thanks in advance for your help.

Product version: IRIS 2021.1
0
0 125
Discussion (5)2
Log in or sign up to continue

I'm not aware of any JSON schema capability.

%Dictionary has two sets of classes: *Definition and Compiled*. If you want to see inherited members you need to look at Compiled* (e.g., CompiledClass / CompiledProperty). If you want to know from which class, there's an "Origin" property.

Thanks Timothy for the quick response. One thing I have not figured out is: regardless ClassDefinition or CompiledClass, their .Properties returns a relationshipObject. How do I get the set/array of PropertyDefinition associated with the class? Thanks.

I'd run a query against %Dictionary.CompiledProperty where parent = (the classname)