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

Uprade cadl ranch version to v0.16.1 #2907

Merged
merged 4 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 27 additions & 95 deletions common/config/rush/pnpm-lock.yaml

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

6 changes: 3 additions & 3 deletions packages/typespec-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"license": "MIT",
"devDependencies": {
"@azure-rest/core-client": "^2.3.1",
"@azure-tools/cadl-ranch-expect": "^0.15.5",
"@azure-tools/cadl-ranch-specs": "^0.38.0",
"@azure-tools/cadl-ranch": "^0.15.0",
"@azure-tools/cadl-ranch-expect": "^0.15.6",
"@azure-tools/cadl-ranch-specs": "^0.39.2",
"@azure-tools/cadl-ranch": "^0.16.1",
"@azure-tools/cadl-ranch-api": "^0.5.0",
"@azure-tools/typespec-autorest": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0",
Expand Down
9 changes: 5 additions & 4 deletions packages/typespec-ts/test/commands/cadl-ranch-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,11 @@ export const rlcTsps = [
outputPath: "versioning/madeOptional",
inputPath: "versioning/madeOptional"
},
{
outputPath: "versioning/removed",
inputPath: "versioning/removed"
},
// disable it as https://github.com/Azure/autorest.typescript/issues/2902
// {
v-jiaodi marked this conversation as resolved.
Show resolved Hide resolved
// outputPath: "versioning/removed",
// inputPath: "versioning/removed"
// },
MaryGao marked this conversation as resolved.
Show resolved Hide resolved
{
outputPath: "versioning/renamedFrom",
inputPath: "versioning/renamedFrom"
Expand Down
40 changes: 16 additions & 24 deletions packages/typespec-ts/test/integration/arrayItemTypes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,26 @@ describe("Array Item-Types Client", () => {

matrix([testedTypes], async (params: TypeDetail) => {
it(`should get a ${params.type} value`, async () => {
try {
const result = await client
.path(`/type/array/${params.type}` as any)
.get();
assert.strictEqual(result.status, "200");
assert.deepEqual(result.body, params.defaultValue);
} catch (err) {
assert.fail(err as string);
}
const result = await client
.path(`/type/array/${params.type}` as any)
.get();
assert.strictEqual(result.status, "200");
assert.deepEqual(result.body, params.defaultValue);
});

it(`should put a ${params.type} value`, async () => {
try {
let property;
if (params.convertedToFn) {
property = params.convertedToFn(params.defaultValue);
} else {
property = params.defaultValue;
}
const result = await client
.path(`/type/array/${params.type}` as any)
.put({
body: property
});
assert.strictEqual(result.status, "204");
} catch (err) {
assert.fail(err as string);
let property;
if (params.convertedToFn) {
property = params.convertedToFn(params.defaultValue);
} else {
property = params.defaultValue;
}
const result = await client
.path(`/type/array/${params.type}` as any)
.put({
body: property
});
assert.strictEqual(result.status, "204");
});
});
});
31 changes: 15 additions & 16 deletions packages/typespec-ts/test/integration/authApiKey.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,34 @@ import ApiKeyClientFactory, {
} from "./generated/authentication/api-key/src/index.js";
import { assert } from "chai";
describe("AuthApiKeyClient Rest Client", () => {
let client: AuthApiKeyClient;
let validKeyClient: AuthApiKeyClient;
let invalidKeyClient: AuthApiKeyClient;

beforeEach(() => {
client = ApiKeyClientFactory(
validKeyClient = ApiKeyClientFactory(
{
key: "valid-key"
},
{ allowInsecureConnection: true }
);
invalidKeyClient = ApiKeyClientFactory(
MaryGao marked this conversation as resolved.
Show resolved Hide resolved
{
key: "invalid-key"
},
{ allowInsecureConnection: true }
);
});

it("should return 204 when the apiKey is valid", async () => {
try {
const result = await client.path("/authentication/api-key/valid").get();
assert.strictEqual(result.status, "204");
} catch (err) {
assert.fail(err as string);
}
const result = await validKeyClient.path("/authentication/api-key/valid").get();
assert.strictEqual(result.status, "204");
});

it("should return 403 when the apiKey is invalid", async () => {
try {
const result = await client.path("/authentication/api-key/invalid").get();
assert.strictEqual(result.status, "403");
if (result.status === "403") {
assert.strictEqual(result.body.error, "invalid-api-key");
}
} catch (err) {
assert.fail(err as string);
const result = await invalidKeyClient.path("/authentication/api-key/invalid").get();
assert.strictEqual(result.status, "403");
if (result.status === "403") {
assert.strictEqual(result.body.error, "invalid-api-key");
}
});
});
Loading
Loading