Skip to content

Commit

Permalink
Merge pull request #12477 from OfficeDev/main
Browse files Browse the repository at this point in the history
build: merge back to dev after publish TTK for VS 17.12 P3
  • Loading branch information
eriolchan authored Sep 29, 2024
2 parents d8792ed + ef0e026 commit 9a901bd
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/fx-core/src/common/templates-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "~4.2",
"localVersion": "4.2.2",
"localVersion": "4.2.3",
"tagPrefix": "templates@",
"tagListURL": "https://github.com/OfficeDev/TeamsFx/releases/download/template-tag-list/template-tags.txt",
"templateDownloadBaseURL": "https://github.com/OfficeDev/TeamsFx/releases/download",
Expand Down
13 changes: 10 additions & 3 deletions packages/fx-core/src/component/generator/apiSpec/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ const enum telemetryEvents {
failedToGetGenerateWarning = "failed-to-get-generate-warning",
}

export function getParserOptions(type: ProjectType, isDeclarativeCopilot?: boolean): ParseOptions {
export function getParserOptions(
type: ProjectType,
isDeclarativeCopilot?: boolean,
platform?: string
): ParseOptions {
return type === ProjectType.Copilot
? {
isGptPlugin: isDeclarativeCopilot,
Expand Down Expand Up @@ -113,7 +117,7 @@ export function getParserOptions(type: ProjectType, isDeclarativeCopilot?: boole
}
: {
projectType: type,
allowBearerTokenAuth: true, // Currently, API key auth support is actually bearer token auth
allowBearerTokenAuth: !!platform && platform === Platform.VS ? false : true, // Currently, API key auth support is actually bearer token auth
allowMultipleParameters: true,
allowOauth2: featureFlagManager.getBooleanValue(FeatureFlags.SMEOAuth),
};
Expand Down Expand Up @@ -158,7 +162,10 @@ export async function listOperations(
: ProjectType.SME;

try {
const specParser = new SpecParser(apiSpecUrl as string, getParserOptions(projectType));
const specParser = new SpecParser(
apiSpecUrl as string,
getParserOptions(projectType, undefined, inputs.platform)
);
const validationRes = await specParser.validate();
validationRes.errors = formatValidationErrors(validationRes.errors, inputs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,36 @@ describe("listOperations", async () => {
expect(res.error[0].type).to.be.equal(ErrorType.AddedAPINotInOriginalSpec);
}
});

it("should not allow auth for VS project", async () => {
const inputs = {
platform: Platform.VS,
};
sandbox.stub(CopilotPluginHelper, "formatValidationErrors").resolves([]);
sandbox.stub(CopilotPluginHelper, "logValidationResults").resolves();
sandbox.stub(SpecParser.prototype, "validate").resolves({
status: ValidationStatus.Valid,
warnings: [],
errors: [],
specHash: "xxx",
});
sandbox.stub(SpecParser.prototype, "list").resolves({
APIs: [
{
api: "1",
server: "https://test",
operationId: "id1",
isValid: false,
reason: [ErrorType.AuthTypeIsNotSupported],
},
],
allAPICount: 1,
validAPICount: 0,
});

const res = await CopilotPluginHelper.listOperations(context, "", inputs, true, false, "");
expect(res.isOk()).to.be.true;
});
});

describe("SpecGenerator", async () => {
Expand Down
2 changes: 1 addition & 1 deletion templates/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "templates",
"version": "4.3.0-alpha",
"version": "4.2.3",
"private": "true",
"license": "MIT",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions templates/ts/ai-assistant-bot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/ai-bot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/command-and-response/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/default-bot-message-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/default-bot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/link-unfurling/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/m365-message-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/message-extension-action/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
2 changes: 1 addition & 1 deletion templates/ts/message-extension-copilot/package.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@types/node": "^20.8.9",
"env-cmd": "^10.1.0",
"ts-node": "^10.4.0",
"typescript": "^5.2.2",
"typescript": "^4.4.4",
"nodemon": "^3.0.1",
"shx": "^0.3.3"
}
Expand Down
1 change: 1 addition & 0 deletions templates/ts/message-extension-copilot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/message-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/non-sso-tab-default-bot/bot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/notification-http-timer-trigger/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"resolveJsonModule": true,
Expand Down
1 change: 1 addition & 0 deletions templates/ts/notification-http-trigger/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"resolveJsonModule": true,
Expand Down
1 change: 1 addition & 0 deletions templates/ts/notification-restify/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions templates/ts/notification-timer-trigger/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"resolveJsonModule": true,
Expand Down
5 changes: 3 additions & 2 deletions templates/ts/sso-tab-with-obo-flow/api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "nodenext",
"outDir": "dist",
"rootDir": ".",
"sourceMap": true,
Expand Down
1 change: 1 addition & 0 deletions templates/ts/workflow/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"moduleResolution": "nodenext",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo",
Expand Down

0 comments on commit 9a901bd

Please sign in to comment.