Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into andrueastman/fixTsGen…
Browse files Browse the repository at this point in the history
…eration
  • Loading branch information
andrueastman committed Sep 30, 2024
2 parents 4b640c4 + 9e44119 commit 4e5029a
Show file tree
Hide file tree
Showing 14 changed files with 178 additions and 214 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.8.0
with:
push: false
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Push to GitHub Packages - Nightly
if: contains(github.ref, env.PREVIEW_BRANCH)
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.8.0
with:
push: true
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
Expand All @@ -104,7 +104,7 @@ jobs:
# we can't get the sequence number from ADO so we default it back to github run number
- name: Push to GitHub Packages - Release
if: contains(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.8.0
with:
push: true
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
Expand Down
4 changes: 2 additions & 2 deletions it/python/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ yapf==0.40.2

zipp==3.20.2 ; python_version >= '3.7'

aiohttp==3.10.6 ; python_version >= '3.6'
aiohttp==3.10.8 ; python_version >= '3.6'

aiosignal==1.3.1 ; python_version >= '3.7'

Expand Down Expand Up @@ -136,5 +136,5 @@ sniffio==1.3.1 ; python_version >= '3.7'

uritemplate==4.1.1 ; python_version >= '3.6'

yarl==1.13.0 ; python_version >= '3.7'
yarl==1.13.1 ; python_version >= '3.7'

8 changes: 4 additions & 4 deletions it/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion it/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"devDependencies": {
"@es-exec/esbuild-plugin-start": "^0.0.5",
"@stylistic/eslint-plugin-ts": "^2.8.0",
"@types/node": "^22.7.3",
"@types/node": "^22.7.4",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"esbuild": "^0.24.0",
Expand Down
6 changes: 3 additions & 3 deletions vscode/microsoft-kiota/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 27 additions & 31 deletions vscode/microsoft-kiota/src/generateClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,31 @@ export function generateClient(context: vscode.ExtensionContext,
operation: ConsumerOperation,
workingDirectory: string = getWorkspaceJsonDirectory()
): Promise<KiotaLogEntry[] | undefined> {
try {
return connectToKiota<KiotaLogEntry[]>(context, async (connection) => {
const request = new rpc.RequestType1<GenerationConfiguration, KiotaLogEntry[], void>(
"Generate"
);
return await connection.sendRequest(
request,
{
cleanOutput: cleanOutput,
clearCache: clearCache,
clientClassName: clientClassName,
clientNamespaceName: clientNamespaceName,
deserializers: deserializers,
disabledValidationRules: disableValidationRules,
excludeBackwardCompatible: excludeBackwardCompatible,
excludePatterns: excludeFilters,
includeAdditionalData: includeAdditionalData,
includePatterns: includeFilters,
language: language,
openAPIFilePath: descriptionPath,
outputPath: output,
serializers: serializers,
structuredMimeTypes: structuredMimeTypes,
usesBackingStore: usesBackingStore,
operation: operation
} as GenerationConfiguration,
);
}, workingDirectory);
} catch (error) {
return Promise.resolve(undefined);
}
return connectToKiota<KiotaLogEntry[]>(context, async (connection) => {
const request = new rpc.RequestType1<GenerationConfiguration, KiotaLogEntry[], void>(
"Generate"
);
return await connection.sendRequest(
request,
{
cleanOutput: cleanOutput,
clearCache: clearCache,
clientClassName: clientClassName,
clientNamespaceName: clientNamespaceName,
deserializers: deserializers,
disabledValidationRules: disableValidationRules,
excludeBackwardCompatible: excludeBackwardCompatible,
excludePatterns: excludeFilters,
includeAdditionalData: includeAdditionalData,
includePatterns: includeFilters,
language: language,
openAPIFilePath: descriptionPath,
outputPath: output,
serializers: serializers,
structuredMimeTypes: structuredMimeTypes,
usesBackingStore: usesBackingStore,
operation: operation
} as GenerationConfiguration,
);
}, workingDirectory);
};
44 changes: 20 additions & 24 deletions vscode/microsoft-kiota/src/generatePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,24 @@ export function generatePlugin(context: vscode.ExtensionContext,
disableValidationRules: string[],
operation: ConsumerOperation,
workingDirectory: string = getWorkspaceJsonDirectory()): Promise<KiotaLogEntry[] | undefined> {
try {
return connectToKiota<KiotaLogEntry[]>(context, async (connection) => {
const request = new rpc.RequestType1<GenerationConfiguration, KiotaLogEntry[], void>(
"GeneratePlugin"
);
return await connection.sendRequest(
request,
{
pluginTypes: pluginTypes,
cleanOutput: cleanOutput,
clearCache: clearCache,
clientClassName: clientClassName,
disabledValidationRules: disableValidationRules,
excludePatterns: excludeFilters,
includePatterns: includeFilters,
openAPIFilePath: descriptionPath,
outputPath: output,
operation: operation
} as GenerationConfiguration,
);
}, workingDirectory);
} catch (error) {
return Promise.resolve(undefined);
}
return connectToKiota<KiotaLogEntry[]>(context, async (connection) => {
const request = new rpc.RequestType1<GenerationConfiguration, KiotaLogEntry[], void>(
"GeneratePlugin"
);
return await connection.sendRequest(
request,
{
pluginTypes: pluginTypes,
cleanOutput: cleanOutput,
clearCache: clearCache,
clientClassName: clientClassName,
disabledValidationRules: disableValidationRules,
excludePatterns: excludeFilters,
includePatterns: includeFilters,
openAPIFilePath: descriptionPath,
outputPath: output,
operation: operation
} as GenerationConfiguration,
);
}, workingDirectory);
};
30 changes: 13 additions & 17 deletions vscode/microsoft-kiota/src/getKiotaVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@ import * as rpc from "vscode-jsonrpc/node";
import * as vscode from "vscode";

export function getKiotaVersion(context: vscode.ExtensionContext, kiotaOutputChannel: vscode.LogOutputChannel): Promise<string | undefined> {
try {
return connectToKiota<string>(context, async (connection) => {
const request = new rpc.RequestType0<string, void>("GetVersion");
const result = await connection.sendRequest(request);
if (result) {
const version = result.split("+")[0];
if (version) {
kiotaOutputChannel.info(`kiota: ${version}`);
return version;
}
return connectToKiota<string>(context, async (connection) => {
const request = new rpc.RequestType0<string, void>("GetVersion");
const result = await connection.sendRequest(request);
if (result) {
const version = result.split("+")[0];
if (version) {
kiotaOutputChannel.info(`kiota: ${version}`);
return version;
}
kiotaOutputChannel.error(`kiota: ${vscode.l10n.t('not found')}`);
kiotaOutputChannel.show();
return undefined;
});
} catch (error) {
return Promise.resolve(undefined);
}
}
kiotaOutputChannel.error(`kiota: ${vscode.l10n.t('not found')}`);
kiotaOutputChannel.show();
return undefined;
});
};
44 changes: 18 additions & 26 deletions vscode/microsoft-kiota/src/getLanguageInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,25 @@ export async function getLanguageInformation(context: vscode.ExtensionContext):
};

function getLanguageInformationInternal(context: vscode.ExtensionContext): Promise<LanguagesInformation | undefined> {
try {
return connectToKiota<LanguagesInformation>(context, async (connection) => {
const request = new rpc.RequestType0<LanguagesInformation, void>(
"Info"
);
return await connection.sendRequest(
request,
);
});
} catch (error) {
return Promise.resolve(undefined);
}
return connectToKiota<LanguagesInformation>(context, async (connection) => {
const request = new rpc.RequestType0<LanguagesInformation, void>(
"Info"
);
return await connection.sendRequest(
request,
);
});
};

export function getLanguageInformationForDescription(context: vscode.ExtensionContext, descriptionUrl: string, clearCache: boolean): Promise<LanguagesInformation | undefined> {
try {
return connectToKiota<LanguagesInformation>(context, async (connection) => {
const request = new rpc.RequestType2<string, boolean, LanguagesInformation, void>(
"InfoForDescription"
);
return await connection.sendRequest(
request,
descriptionUrl,
clearCache
);
});
} catch (error) {
return Promise.resolve(undefined);
}
return connectToKiota<LanguagesInformation>(context, async (connection) => {
const request = new rpc.RequestType2<string, boolean, LanguagesInformation, void>(
"InfoForDescription"
);
return await connection.sendRequest(
request,
descriptionUrl,
clearCache
);
});
};
46 changes: 23 additions & 23 deletions vscode/microsoft-kiota/src/kiotaInterop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function connectToKiota<T>(context: vscode.ExtensionContext, callba
} catch (error) {
const errorMessage = (error as { data?: { message: string } })?.data?.message
|| 'An unknown error occurred';
throw new Error(errorMessage);
vscode.window.showErrorMessage(errorMessage);
} finally {
connection.dispose();
childProcess.kill();
Expand Down Expand Up @@ -197,30 +197,30 @@ export function maturityLevelToString(level: MaturityLevel): string {
}
}
export enum DependencyType {
abstractions,
serialization,
authentication,
http,
bundle,
additional,
abstractions,
serialization,
authentication,
http,
bundle,
additional,
}
export function dependencyTypeToString(type: DependencyType): string {
switch (type) {
case DependencyType.abstractions:
return "abstractions";
case DependencyType.serialization:
return "serialization";
case DependencyType.authentication:
return "authentication";
case DependencyType.http:
return "http";
case DependencyType.bundle:
return "bundle";
case DependencyType.additional:
return "additional";
default:
throw new Error("unknown type");
}
switch (type) {
case DependencyType.abstractions:
return "abstractions";
case DependencyType.serialization:
return "serialization";
case DependencyType.authentication:
return "authentication";
case DependencyType.http:
return "http";
case DependencyType.bundle:
return "bundle";
case DependencyType.additional:
return "additional";
default:
throw new Error("unknown type");
}
}
export interface ConfigurationFile {
version: string;
Expand Down
24 changes: 10 additions & 14 deletions vscode/microsoft-kiota/src/migrateFromLockFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@ import { KIOTA_LOCK_FILE } from "./constants";
import { getWorkspaceJsonPath, handleMigration } from "./util";

export function migrateFromLockFile(context: vscode.ExtensionContext, lockFileDirectory: string): Promise<KiotaLogEntry[] | undefined> {
try {
return connectToKiota(context, async (connection) => {
const request = new rpc.RequestType1<string, KiotaLogEntry[], void>(
"MigrateFromLockFile"
);
const result = await connection.sendRequest(
request,
lockFileDirectory
);
return result;
});
} catch (error) {
return Promise.resolve(undefined);
}
return connectToKiota(context, async (connection) => {
const request = new rpc.RequestType1<string, KiotaLogEntry[], void>(
"MigrateFromLockFile"
);
const result = await connection.sendRequest(
request,
lockFileDirectory
);
return result;
});
};

export async function checkForLockFileAndPrompt(context: vscode.ExtensionContext) {
Expand Down
Loading

0 comments on commit 4e5029a

Please sign in to comment.