From 9058009f71ea919c0953b57a4971dacdd90db73f Mon Sep 17 00:00:00 2001 From: ElinorW Date: Mon, 10 Jun 2024 18:44:07 +0300 Subject: [PATCH 1/7] display client or plugin name --- vscode/microsoft-kiota/package.json | 8 ++-- vscode/microsoft-kiota/src/extension.ts | 6 +-- vscode/microsoft-kiota/src/kiotaInterop.ts | 1 + .../src/openApiTreeProvider.ts | 46 +++++++++++++++++-- 4 files changed, 50 insertions(+), 11 deletions(-) diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 9442ff63db..1d76548198 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -271,22 +271,22 @@ }, { "command": "kiota.openApiExplorer.addToSelectedEndpoints", - "when": "view == kiota.openApiExplorer && viewItem != apiTitle", + "when": "view == kiota.openApiExplorer && viewItem != apiTitle && viewItem != clientNameOrPluginName", "group": "inline@2" }, { "command": "kiota.openApiExplorer.addAllToSelectedEndpoints", - "when": "view == kiota.openApiExplorer", + "when": "view == kiota.openApiExplorer && viewItem != clientNameOrPluginName", "group": "inline@4" }, { "command": "kiota.openApiExplorer.removeFromSelectedEndpoints", - "when": "view == kiota.openApiExplorer && viewItem != apiTitle", + "when": "view == kiota.openApiExplorer && viewItem != apiTitle && viewItem != clientNameOrPluginName", "group": "inline@3" }, { "command": "kiota.openApiExplorer.removeAllFromSelectedEndpoints", - "when": "view == kiota.openApiExplorer", + "when": "view == kiota.openApiExplorer && viewItem != clientNameOrPluginName", "group": "inline@5" } ], diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index 05f3069d17..2887325b20 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -225,7 +225,7 @@ export async function activate( clientOrPluginKey = clientKey; clientOrPluginObject = clientObject; workspaceGenerationType = generationType; - await loadEditPaths(clientObject, openApiTreeProvider); + await loadEditPaths(clientOrPluginKey, clientObject, openApiTreeProvider); await vscode.commands.executeCommand('setContext',`${treeViewId}.showIcons`, false); await vscode.commands.executeCommand('setContext', `${treeViewId}.showRegenerateIcon`, true); }), @@ -579,8 +579,8 @@ async function loadLockFile(node: { fsPath: string }, openApiTreeProvider: OpenA await vscode.commands.executeCommand('setContext',`${treeViewId}.showIcons`, true); } -async function loadEditPaths(clientObject: any, openApiTreeProvider: OpenApiTreeProvider): Promise { - await openTreeViewWithProgress(() => openApiTreeProvider.loadEditPaths(clientObject)); +async function loadEditPaths(clientOrPluginKey: string, clientObject: any, openApiTreeProvider: OpenApiTreeProvider): Promise { + await openTreeViewWithProgress(() => openApiTreeProvider.loadEditPaths(clientOrPluginKey, clientObject)); } async function exportLogsAndShowErrors(result: KiotaLogEntry[]) : Promise { diff --git a/vscode/microsoft-kiota/src/kiotaInterop.ts b/vscode/microsoft-kiota/src/kiotaInterop.ts index 974544ebfd..ee45e251f3 100644 --- a/vscode/microsoft-kiota/src/kiotaInterop.ts +++ b/vscode/microsoft-kiota/src/kiotaInterop.ts @@ -41,6 +41,7 @@ export interface KiotaOpenApiNode { selected?: boolean, isOperation?: boolean; documentationUrl?: string; + clientNameOrPluginName?: string; } interface CacheClearableConfiguration { clearCache: boolean; diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index bd26850ddf..fb7e9db390 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -40,15 +40,16 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider { + public async loadEditPaths(clientOrPluginKey: string, clientObject: any): Promise { this.closeDescription(false); this._lockFile = clientObject; + this._lockFile!.clientClassName = clientOrPluginKey; if (this._lockFile?.descriptionLocation) { this._descriptionUrl = this._lockFile.descriptionLocation; this.includeFilters = this._lockFile.includePatterns; this.excludeFilters = this._lockFile.excludePatterns; const settings = this.settingsGetter(); - await this.loadNodes(settings.clearCache); + await this.loadNodes(settings.clearCache, clientOrPluginKey); if (this.rawRootNode) { this.refreshView(); } @@ -213,7 +214,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider { + private async loadNodes(clearCache: boolean, clientNameOrPluginName?: string): Promise { if (!this.descriptionUrl || this.descriptionUrl.length === 0) { return; } @@ -233,6 +234,17 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider this.getTreeNodeFromKiotaNode(x)), node.documentationUrl, + node.clientNameOrPluginName ); } getChildren(element?: OpenApiTreeNode): vscode.ProviderResult { @@ -279,6 +292,26 @@ function getPathSegments(path: string): string[] { function trimOperation(path: string): string { return path.split(operationSeparator)[0]; } + +function createKiotaOpenApiNode( + segment: string, + path: string, + children: KiotaOpenApiNode[] = [], + selected?: boolean, + isOperation?: boolean, + documentationUrl?: string, + clientNameOrPluginName?: string +): KiotaOpenApiNode { + return { + segment, + path, + children, + selected, + isOperation, + documentationUrl, + clientNameOrPluginName + }; +} type IconSet = string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } | vscode.ThemeIcon; export class OpenApiTreeNode extends vscode.TreeItem { private static readonly selectedSet: IconSet = new vscode.ThemeIcon('check'); @@ -293,12 +326,17 @@ export class OpenApiTreeNode extends vscode.TreeItem { filterTokens: string[], apiTitle: string | undefined, public readonly children: OpenApiTreeNode[] = [], - public readonly documentationUrl?: string + public readonly documentationUrl?: string, + public readonly clientNameOrPluginName?: string ) { super(label, collapsibleState); this.id = `${path}_${filterTokens.join('_')}`; // so the collapsed state is NOT persisted between filter changes this.contextValue = label === pathSeparator + " (" + apiTitle + ")" ? 'apiTitle' : (this.documentationUrl ? 'documentationUrl' : ''); this.iconPath = selected ? OpenApiTreeNode.selectedSet : OpenApiTreeNode.unselectedSet; + if(clientNameOrPluginName) { + this.label = clientNameOrPluginName; + this.contextValue = 'clientNameOrPluginName'; + } } public isNodeVisible(tokenizedFilter: string[]): boolean { if (tokenizedFilter.length === 0) { From 41f0957f9adccfdb423f6eeca55707a9f765cb3f Mon Sep 17 00:00:00 2001 From: ElinorW Date: Mon, 10 Jun 2024 22:05:52 +0300 Subject: [PATCH 2/7] enable node selection --- vscode/microsoft-kiota/src/openApiTreeProvider.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index fb7e9db390..0df136f495 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -141,7 +141,15 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider x.segment === segment); + let child: KiotaOpenApiNode | undefined; + if (currentNode.clientNameOrPluginName) { + const rootChild = currentNode.children.find(x => x.segment === '/'); + if (rootChild) { + child = rootChild.children.find(x => x.segment === segment); + } + } else { + child = currentNode.children.find(x => x.segment === segment); + } if (child) { return this.findApiNode(segments, child); } else if (segment.startsWith('{') && segment.endsWith('}')) { From 78923d12ee705a62270061bcbdee085e8bfe7082 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Tue, 11 Jun 2024 12:32:07 +0300 Subject: [PATCH 3/7] fix indentation --- vscode/microsoft-kiota/src/openApiTreeProvider.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index 0df136f495..59ebdcb677 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -142,14 +142,14 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider x.segment === '/'); - if (rootChild) { - child = rootChild.children.find(x => x.segment === segment); + if (currentNode.clientNameOrPluginName) { + const rootChild = currentNode.children.find(x => x.segment === '/'); + if (rootChild) { + child = rootChild.children.find(x => x.segment === segment); + } + } else { + child = currentNode.children.find(x => x.segment === segment); } - } else { - child = currentNode.children.find(x => x.segment === segment); - } if (child) { return this.findApiNode(segments, child); } else if (segment.startsWith('{') && segment.endsWith('}')) { From afd4833be35059ca03a329b08ae6f17224732959 Mon Sep 17 00:00:00 2001 From: ElinorW Date: Wed, 12 Jun 2024 17:59:49 +0300 Subject: [PATCH 4/7] add client/plugin name after generation --- vscode/microsoft-kiota/src/extension.ts | 13 +- vscode/microsoft-kiota/src/kiotaInterop.ts | 23 +-- .../src/openApiTreeProvider.ts | 163 ++++++++++++------ 3 files changed, 129 insertions(+), 70 deletions(-) diff --git a/vscode/microsoft-kiota/src/extension.ts b/vscode/microsoft-kiota/src/extension.ts index 2887325b20..66b36ff9b0 100644 --- a/vscode/microsoft-kiota/src/extension.ts +++ b/vscode/microsoft-kiota/src/extension.ts @@ -45,6 +45,7 @@ export async function activate( kiotaOutputChannel = vscode.window.createOutputChannel("Kiota", { log: true, }); + const workspaceJsonPath = path.join(vscode.workspace.workspaceFolders?.map(folder => folder.uri.fsPath).join('') || '', KIOTA_DIRECTORY, KIOTA_WORKSPACE_FILE); const openApiTreeProvider = new OpenApiTreeProvider(context, () => getExtensionSettings(extensionId)); const dependenciesInfoProvider = new DependenciesViewProvider( context.extensionUri @@ -300,6 +301,8 @@ export async function activate( if (result) { await checkForSuccess(result); + openApiTreeProvider.refreshView(); + await loadLockFile({fsPath: workspaceJsonPath}, openApiTreeProvider, config.pluginName); await exportLogsAndShowErrors(result); } } @@ -339,6 +342,8 @@ export async function activate( if (result) { await checkForSuccess(result); + openApiTreeProvider.refreshView(); + await loadLockFile({fsPath: workspaceJsonPath}, openApiTreeProvider, config.pluginName); await exportLogsAndShowErrors(result); } } @@ -402,11 +407,13 @@ export async function activate( result && getLogEntriesForLevel(result, LogLevel.critical, LogLevel.error).length === 0) { const WORKSPACE_FOLDER = vscode.workspace.workspaceFolders[0].uri.fsPath; const KIOTA_WORKSPACE_PATH = path.join(WORKSPACE_FOLDER, KIOTA_DIRECTORY, KIOTA_WORKSPACE_FILE); - await openApiTreeProvider.loadLockFile(KIOTA_WORKSPACE_PATH); + await openApiTreeProvider.loadLockFile(KIOTA_WORKSPACE_PATH, config.clientClassName); } if (result) { await checkForSuccess(result); + openApiTreeProvider.refreshView(); + await loadLockFile({fsPath: workspaceJsonPath}, openApiTreeProvider, config.clientClassName); await exportLogsAndShowErrors(result); } } @@ -574,8 +581,8 @@ async function showUpgradeWarningMessage(clientPath: string, context: vscode.Ext } } -async function loadLockFile(node: { fsPath: string }, openApiTreeProvider: OpenApiTreeProvider): Promise { - await openTreeViewWithProgress(() => openApiTreeProvider.loadLockFile(node.fsPath)); +async function loadLockFile(node: { fsPath: string }, openApiTreeProvider: OpenApiTreeProvider, clientOrPluginName?: string): Promise { + await openTreeViewWithProgress(() => openApiTreeProvider.loadLockFile(node.fsPath, clientOrPluginName)); await vscode.commands.executeCommand('setContext',`${treeViewId}.showIcons`, true); } diff --git a/vscode/microsoft-kiota/src/kiotaInterop.ts b/vscode/microsoft-kiota/src/kiotaInterop.ts index ee45e251f3..7cfea7216f 100644 --- a/vscode/microsoft-kiota/src/kiotaInterop.ts +++ b/vscode/microsoft-kiota/src/kiotaInterop.ts @@ -255,22 +255,9 @@ export function maturityLevelToString(level: MaturityLevel): string { } } export interface LockFile { - clientClassName: string; - clientNamespaceName: string; - descriptionHash: string; - descriptionLocation: string; - deserializers: string[]; - disabledValidationRules: string[]; - excludeBackwardCompatible: boolean; - excludePatterns: string[]; - includeAdditionalData: boolean; - includePatterns: string[]; - kiotaVersion: string; - language: string; - lockFileVersion: string; - serializers: string[]; - structuredMimeTypes: string[]; - usesBackingStore: boolean; + version: string; + clients?: Record; + plugins?: Record; } export interface GenerationConfiguration { @@ -301,7 +288,7 @@ interface WorkspaceObjectProperties { outputPath: string; } -interface ClientObjectProperties extends WorkspaceObjectProperties { +export interface ClientObjectProperties extends WorkspaceObjectProperties { language: string; structuredMimeTypes: string[]; clientNamespaceName: string; @@ -311,7 +298,7 @@ interface ClientObjectProperties extends WorkspaceObjectProperties { disabledValidationRules: string[]; } -interface PluginObjectProperties extends WorkspaceObjectProperties { +export interface PluginObjectProperties extends WorkspaceObjectProperties { types: string[]; } diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index 59ebdcb677..eca76367ee 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -3,7 +3,18 @@ import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; import * as rpc from 'vscode-jsonrpc/node'; -import { connectToKiota, KiotaGetManifestDetailsConfiguration, KiotaLogEntry, KiotaManifestResult, KiotaOpenApiNode, KiotaShowConfiguration, KiotaShowResult, LockFile } from './kiotaInterop'; +import { + ClientObjectProperties, + ClientOrPluginProperties, + connectToKiota, + KiotaGetManifestDetailsConfiguration, + KiotaLogEntry, + KiotaManifestResult, + KiotaOpenApiNode, + KiotaShowConfiguration, + KiotaShowResult, + LockFile, + PluginObjectProperties } from './kiotaInterop'; import { ExtensionSettings } from './extensionSettings'; import { treeViewId } from './constants'; @@ -13,48 +24,83 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider ExtensionSettings, + private readonly settingsGetter: () => ExtensionSettings, private _descriptionUrl?: string, public includeFilters: string[] = [], public excludeFilters: string[] = []) { - + } private _lockFilePath?: string; - private _lockFile?: LockFile; + private _lockFile?: LockFile | Partial = {}; public get isLockFileLoaded(): boolean { return !!this._lockFile; } - public async loadLockFile(path: string): Promise { - this.closeDescription(false); - this._lockFilePath = path; - const lockFileData = await vscode.workspace.fs.readFile(vscode.Uri.file(path)); - this._lockFile = JSON.parse(lockFileData.toString()) as LockFile; - if (this._lockFile?.descriptionLocation) { - this._descriptionUrl = this._lockFile.descriptionLocation; - this.includeFilters = this._lockFile.includePatterns; - this.excludeFilters = this._lockFile.excludePatterns; - const settings = this.settingsGetter(); - await this.loadNodes(settings.clearCache); - if (this.rawRootNode) { - this.refreshView(); + public async loadLockFile(path: string, clientOrPluginName?: string): Promise { + this.closeDescription(false); + this._lockFilePath = path; + const lockFileData = await vscode.workspace.fs.readFile(vscode.Uri.file(path)); + let parsedLockFile = JSON.parse(lockFileData.toString()) as LockFile; + + if (clientOrPluginName) { + let filteredData: Partial = { version: parsedLockFile.version }; + + if (parsedLockFile.clients && parsedLockFile.clients[clientOrPluginName]) { + filteredData.clients = { + [clientOrPluginName]: parsedLockFile.clients[clientOrPluginName] + }; + } + + if (parsedLockFile.plugins && parsedLockFile.plugins[clientOrPluginName]) { + filteredData.plugins = { + [clientOrPluginName]: parsedLockFile.plugins[clientOrPluginName] + }; + } + + parsedLockFile = filteredData as LockFile; + } + + this._lockFile = parsedLockFile; + + const clientOrPlugin: ClientOrPluginProperties | undefined = + Object.values(this._lockFile.clients ?? {})[0] || + Object.values(this._lockFile.plugins ?? {})[0]; + + if (clientOrPlugin) { + this._descriptionUrl = clientOrPlugin.descriptionLocation; + this.includeFilters = clientOrPlugin.includePatterns; + this.excludeFilters = clientOrPlugin.excludePatterns; + + const settings = this.settingsGetter(); + await this.loadNodes(settings.clearCache, clientOrPluginName); + + if (this.rawRootNode) { + this.refreshView(); + } } - } } - public async loadEditPaths(clientOrPluginKey: string, clientObject: any): Promise { + public async loadEditPaths(clientOrPluginKey: string, clientObject: ClientOrPluginProperties): Promise { this.closeDescription(false); - this._lockFile = clientObject; - this._lockFile!.clientClassName = clientOrPluginKey; - if (this._lockFile?.descriptionLocation) { - this._descriptionUrl = this._lockFile.descriptionLocation; - this.includeFilters = this._lockFile.includePatterns; - this.excludeFilters = this._lockFile.excludePatterns; - const settings = this.settingsGetter(); - await this.loadNodes(settings.clearCache, clientOrPluginKey); - if (this.rawRootNode) { - this.refreshView(); - } + this._lockFile = { version: '1.0.0', clients: {}, plugins: {} }; + + if ((clientObject as ClientObjectProperties).clientNamespaceName) { + this._lockFile.clients![clientOrPluginKey] = clientObject as ClientObjectProperties; + } else { + this._lockFile.plugins![clientOrPluginKey] = clientObject as PluginObjectProperties; + } + + if (clientObject.descriptionLocation) { + this._descriptionUrl = clientObject.descriptionLocation; + this.includeFilters = clientObject.includePatterns; + this.excludeFilters = clientObject.excludePatterns; + + const settings = this.settingsGetter(); + await this.loadNodes(settings.clearCache, clientOrPluginKey); + + if (this.rawRootNode) { + this.refreshView(); + } } - } + } public async loadManifestFromUri(path: string, apiIdentifier?: string): Promise { this.closeDescription(false); const logs = await this.loadNodesFromManifest(path, apiIdentifier); @@ -74,17 +120,34 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider this.setAllSelected(x, selected)); } + private getFirstClient(): ClientObjectProperties | undefined { + return this._lockFile?.clients ? Object.values(this._lockFile.clients)[0] : undefined; + } public get outputPath(): string { - return this._lockFilePath ? path.parse(this._lockFilePath).dir : ''; + return this._lockFilePath ? path.parse(this._lockFilePath).dir : ''; } public get clientClassName(): string { - return this._lockFile?.clientClassName ?? ''; + if (this._lockFile?.clients) { + const client = this.getFirstClient(); + return client ? client.clientNamespaceName : ''; + } + return ''; } + public get clientNamespaceName(): string { - return this._lockFile?.clientNamespaceName ?? ''; + if (this._lockFile?.clients) { + const client = this.getFirstClient(); + return client ? client.clientNamespaceName : ''; + } + return ''; } + public get language(): string { - return this._lockFile?.language ?? ''; + if (this._lockFile?.clients) { + const client = this.getFirstClient(); + return client ? client.language : ''; + } + return ''; } public closeDescription(shouldRefresh = true) { this._descriptionUrl = ''; @@ -93,10 +156,12 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider this.selectInternal(x, selected, recursive)); } else if (!isOperationNode) { apiNode.children.filter(x => x.isOperation ?? false).forEach(x => this.selectInternal(x, selected, false)); @@ -177,7 +242,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider Date: Thu, 13 Jun 2024 13:14:18 +0300 Subject: [PATCH 5/7] update interface --- vscode/microsoft-kiota/src/kiotaInterop.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vscode/microsoft-kiota/src/kiotaInterop.ts b/vscode/microsoft-kiota/src/kiotaInterop.ts index 7cfea7216f..8debd2c1c9 100644 --- a/vscode/microsoft-kiota/src/kiotaInterop.ts +++ b/vscode/microsoft-kiota/src/kiotaInterop.ts @@ -254,7 +254,7 @@ export function maturityLevelToString(level: MaturityLevel): string { throw new Error("unknown level"); } } -export interface LockFile { +export interface ConfigurationFile { version: string; clients?: Record; plugins?: Record; From 276fdef5ed2ad56ca0796487649d72c1aea59cfb Mon Sep 17 00:00:00 2001 From: ElinorW Date: Thu, 13 Jun 2024 13:14:53 +0300 Subject: [PATCH 6/7] declare lockfile constant --- .../microsoft-kiota/src/openApiTreeProvider.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index eca76367ee..cbd12c7579 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -13,7 +13,7 @@ import { KiotaOpenApiNode, KiotaShowConfiguration, KiotaShowResult, - LockFile, + ConfigurationFile, PluginObjectProperties } from './kiotaInterop'; import { ExtensionSettings } from './extensionSettings'; import { treeViewId } from './constants'; @@ -31,7 +31,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider = {}; + private _lockFile?: ConfigurationFile | Partial = {}; public get isLockFileLoaded(): boolean { return !!this._lockFile; } @@ -39,10 +39,10 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider = { version: parsedLockFile.version }; + let filteredData: Partial = { version: parsedLockFile.version }; if (parsedLockFile.clients && parsedLockFile.clients[clientOrPluginName]) { filteredData.clients = { @@ -56,7 +56,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider { this.closeDescription(false); - this._lockFile = { version: '1.0.0', clients: {}, plugins: {} }; + const newLockFile: ConfigurationFile = { version: '1.0.0', clients: {}, plugins: {} }; if ((clientObject as ClientObjectProperties).clientNamespaceName) { - this._lockFile.clients![clientOrPluginKey] = clientObject as ClientObjectProperties; + newLockFile.clients![clientOrPluginKey] = clientObject as ClientObjectProperties; } else { - this._lockFile.plugins![clientOrPluginKey] = clientObject as PluginObjectProperties; + newLockFile.plugins![clientOrPluginKey] = clientObject as PluginObjectProperties; } - + this._lockFile = newLockFile; if (clientObject.descriptionLocation) { this._descriptionUrl = clientObject.descriptionLocation; this.includeFilters = clientObject.includePatterns; From 2e08478aa7c25386e5ce835801d01731ca0a1b2f Mon Sep 17 00:00:00 2001 From: ElinorW Date: Thu, 13 Jun 2024 15:37:32 +0300 Subject: [PATCH 7/7] make property required --- vscode/microsoft-kiota/src/kiotaInterop.ts | 4 ++-- vscode/microsoft-kiota/src/openApiTreeProvider.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vscode/microsoft-kiota/src/kiotaInterop.ts b/vscode/microsoft-kiota/src/kiotaInterop.ts index 8debd2c1c9..01a862cd72 100644 --- a/vscode/microsoft-kiota/src/kiotaInterop.ts +++ b/vscode/microsoft-kiota/src/kiotaInterop.ts @@ -256,8 +256,8 @@ export function maturityLevelToString(level: MaturityLevel): string { } export interface ConfigurationFile { version: string; - clients?: Record; - plugins?: Record; + clients: Record; + plugins: Record; } export interface GenerationConfiguration { diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index cbd12c7579..2d34ad150e 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -83,9 +83,9 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider