sogno-platform / cimgen

Code generation from CIM data model for several programming languages
Apache License 2.0
16 stars 7 forks source link

`dataType` in attribute description seems to be misleading #28

Open Haifischbecken opened 5 months ago

Haifischbecken commented 5 months ago

Context

When running the generation for a class the templater is fed with the class_details dictonary. Within there is a list of attributes (class_details["attributes"}]`) that describe the attributes. This attribute description contains a key dataType.

Problem

The value of this key seems to be inconsitent or the name might be missleading, as for primitives (Integer, Boolean etc.) it does contain the type but for complex types it contains the muliplicity (e.g. M:0..n) for some reason. This seems to be either:

  1. a bug (if muliplicity should never be there) or
  2. misleading naming (if it is correct that the multiplicity shows up here).

Either way the contained information is available from other values class_name and multiplicity respectively which both seem to be more consitent and should likely be used instead.

Scope

Other than the generation of a comment in the cpp generation the value from dataType is thus far only used in the modern_python langPack.

Haifischbecken commented 5 months ago

@m-mirz Can you maybe say something about whether this is a bug or a naming issue?

Haifischbecken commented 5 months ago

I'll have a look at fixing this for modern_python.

m-mirz commented 5 months ago

@Haifischbecken I am not really sure but I don’t think that it was intentionally done this way. I think it is a good idea to check and potentially change this.

Haifischbecken commented 5 months ago

@m-mirz Ok, great. As I said the same info is available via other attributes and it is basically unused as of now, so we can probably just remove it to avoid confusion.