Closed JoergStahnke closed 11 months ago
Hey @JoergStahnke,
we didn't choose to provide any additional reflection data beyond the mandatory properties yet, since you can easily find all key/values of an object in JavaScript via the Object.keys
, Object.values
and Object.entries
methods. You just need to filter out the framework properties that start with $
. Does that work for you?
Hey @msujew , thank you for the response. But there is a little difference. With Object.keys I get only the keys set during runtime. If I have an optional property and the property is not set I will not get this key with Objects.keys. Im interested in a full list of all possible keys of an object.
Ok, I guess that makes sense 👍
At runtime I need to iterate over all possible keys of a given type, defined in the grammar. The background is, that I generate SQL Scripts to migrate database object. I need to compare two different versions of the modell created with langium. I loop over all possible keys. When I find a difference I generate the corresponding SQL commands. This is equivalent to the former Xtext method
EClass.EAllStructuralFeatures
.Now a time there is in
generated/ast.ts
an objectreflection
with a methodgetTypeMetaData(type: string): TypeMetaData
This method returns all mandantory properties of type boolean and array. Can you add here a component to get all possible keys of the provided type? I would like to add a propertyallKeys: TypeAllProperty[]
in the interfaceTypeMetaData
. The interfaceTypeAllProperty
should look like this:Kind regards Jörg