Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fields are missing #180

Open
JumpLink opened this issue Jul 21, 2024 · 1 comment
Open

Some fields are missing #180

JumpLink opened this issue Jul 21, 2024 · 1 comment
Labels

Comments

@JumpLink
Copy link
Collaborator

JumpLink commented Jul 21, 2024

@ewlsh for example on Gio.DBusNodeInfo, here are the GIR XML definitions:

<record name="DBusNodeInfo"
            c:type="GDBusNodeInfo"
            version="2.26"
            glib:type-name="GDBusNodeInfo"
            glib:get-type="g_dbus_node_info_get_type"
            c:symbol-prefix="dbus_node_info">
      <field name="ref_count" writable="1">
        <doc xml:space="preserve"
             filename="gio/gdbusintrospection.h"
             line="164">The reference count or -1 if statically allocated.</doc>
        <type name="gint" c:type="gint"/>
      </field>
      <field name="path" writable="1">
        <doc xml:space="preserve"
             filename="gio/gdbusintrospection.h"
             line="165">The path of the node or %NULL if omitted. Note that this may be a relative path. See the D-Bus specification for more details.</doc>
        <type name="utf8" c:type="gchar*"/>
      </field>
      <field name="interfaces" writable="1">
        <doc xml:space="preserve"
             filename="gio/gdbusintrospection.h"
             line="166">A pointer to a %NULL-terminated array of pointers to #GDBusInterfaceInfo structures or %NULL if there are no interfaces.</doc>
        <array c:type="GDBusInterfaceInfo**">
          <type name="DBusInterfaceInfo" c:type="GDBusInterfaceInfo*"/>
        </array>
      </field>
      <field name="nodes" writable="1">
        <doc xml:space="preserve"
             filename="gio/gdbusintrospection.h"
             line="167">A pointer to a %NULL-terminated array of pointers to #GDBusNodeInfo structures or %NULL if there are no nodes.</doc>
        <array c:type="GDBusNodeInfo**">
          <type name="DBusNodeInfo" c:type="GDBusNodeInfo*"/>
        </array>
      </field>
      <field name="annotations" writable="1">
        <doc xml:space="preserve"
             filename="gio/gdbusintrospection.h"
             line="168">A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.</doc>
        <array c:type="GDBusAnnotationInfo**">
          <type name="DBusAnnotationInfo" c:type="GDBusAnnotationInfo*"/>
        </array>
      </field>
...

So the generated class fields should look like this:

export class DBusNodeInfo {
    ...
    ref_count: number;
    path: string;
    interfaces: DBusInterfaceInfo[];
    nodes: DBusNodeInfo[];
    annotations: DBusAnnotationInfo[];
...
}

But currently it is looking like this:

export class DBusNodeInfo {
    ...
    ref_count: number;
    path: string;
    annotations: DBusAnnotationInfo[];
...
}

The Structure members are also in the documentation.

@JumpLink JumpLink added the bug label Jul 21, 2024
@JumpLink
Copy link
Collaborator Author

JumpLink commented Jul 22, 2024

@ewlsh Okay, looks like these fields will be removed by removeComplexFields because classNode.isSimple() is false, so its removed here:

            // Only allow fields pointing to simple structs.
            if (classNode && classNode instanceof IntrospectedRecord && !classNode.isSimple()) {
                return false;
            }

I have tried this 62f2174 this adds the missing fields but results in conflicts.

I don't understand why isSimple looks again in the target record to see if their fields are all simple:

const isSimple = this.fields.every(f => this.isSimpleType(f.type));`

Don't you remove the non-simple fields anyway?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant