static getStructItems()

in src/explorer.ts [744:785]


  static getStructItems(
    extensionUri,
    definitions: DiffResult<ObjectMap<PontJsonSchema>>,
    specName: string,
    contextValue: string,
  ): PontChangeTreeItem[] {
    const localSpec = getSpecByName(alicloudAPIMessageService.pontManager.localPontSpecs, specName);
    const remoteSpec = getSpecByName(alicloudAPIMessageService.pontManager.remotePontSpecs, specName);

    return Object.keys(definitions || {}).map((name) => {
      const schema = definitions[name];
      const meta = localSpec?.definitions?.[name];
      const remoteMeta = remoteSpec?.definitions?.[name];

      return {
        label: name,
        specName,
        structName: name,
        description: schema.title || schema.description,
        tooltip: schema.description || schema.title,
        contextValue: contextValue + "Struct",
        iconPath: vscode.Uri.joinPath(extensionUri, "resources/struct-outline.svg"),
        resourceUri: vscode.Uri.parse(`pontx-changes://${contextValue}API/${schema.diffType}`),
        collapsibleState: vscode.TreeItemCollapsibleState.None,
        schema,
        command: {
          command: "alicloud.api.openDocument",
          title: "open",
          arguments: [
            {
              specName,
              name,
              spec: meta,
              remoteSpec: remoteMeta,
              pageType: "changes",
              schemaType: "struct",
            },
          ],
        },
      };
    });
  }