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

Review break out properties in typings #80

Closed
rido-min opened this issue Mar 3, 2023 · 4 comments · Fixed by #82
Closed

Review break out properties in typings #80

rido-min opened this issue Mar 3, 2023 · 4 comments · Fixed by #82
Assignees

Comments

@rido-min
Copy link
Collaborator

rido-min commented Mar 3, 2023

These properties are not available in the output of ParseToJson

contents: { [name: string]: string };
commands: { [name: string]: string };
components: { [name: string]: string };
properties: { [name: string]: string };
relationships: { [name: string]: string };
telemetries: { [name: string]: string };
extends: string[];
extendedBy: string[];

Need to figure out how to consume those types in the JS Sample

@rido-min rido-min self-assigned this Mar 3, 2023
@jrdouceur
Copy link
Collaborator

I can't repro this failure. I just ran a simple model through ParseToJson() on the latest preview package (1.0.35-preview-gf7d12847e2) and its output included:

{
  . . .
  "dtmi:test:anInterface;1": {
    . . .
    "contents": {
      "expectedDistance": "dtmi:test:aProperty;1",
      "currentDistance": "dtmi:test:aTelemetry;1",
      "setDistance": "dtmi:test:aCommand;1",
      "proximity": "dtmi:test:aRelationship;1"
    },
    "commands": {
      "setDistance": "dtmi:test:aCommand;1"
    },
    "components": {},
    "properties": {
      "expectedDistance": "dtmi:test:aProperty;1"
    },
    "relationships": {
      "proximity": "dtmi:test:aRelationship;1"
    },
    "telemetries": {
      "currentDistance": "dtmi:test:aTelemetry;1"
    },
    . . .
  },
  . . .
}

@rido-min
Copy link
Collaborator Author

rido-min commented Mar 3, 2023

should the new breakout properties reference the concrete interfaces?

from

export interface InterfaceInfo extends EntityInfo {
  EntityKind: 'Interface';
  contents: { [name: string]: string };
  commands: { [name: string]: string };
  components: { [name: string]: string };
  properties: { [name: string]: string };
  relationships: { [name: string]: string };
  telemetries: { [name: string]: string };
  extends: string[];
  extendedBy: string[];
  schemas: string[];
}

to

export interface InterfaceInfo extends EntityInfo {
  EntityKind: 'Interface';
  contents: { [name: string]: ContentInfo };
  commands: { [name: string]: CommandInfo };
  components: { [name: string]: ComponentInfo };
  properties: { [name: string]: PropertyInfo };
  relationships: { [name: string]: RelationshipInfo };
  telemetries: { [name: string]: TelemetryInfo };
  extends: string[];
  extendedBy: string[];
  schemas: string[];
}

@jrdouceur
Copy link
Collaborator

The DtdlOm.d.ts file describes the JSON returned by ParseToJson(), which does not return a hierarchical structure. The JSON object that is the value of, e.g., "components" maps name strings to DTMI strings, not to ComponentInfo JSON objects. This is the same for the breakout properties as it is/was for the "contents" property.

@rido-min
Copy link
Collaborator Author

rido-min commented Mar 3, 2023

got it.

I'm leaving this issue open until the JS sample is updated to reflect those properties (that will require to populate to full objects)

@rido-min rido-min linked a pull request Mar 3, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants