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

Upgrade compiler to v0.62.x and tcgc in Nov. #2892

Merged
merged 22 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3f595fb
upgrade tcgc cadl-ranch and compiler to latest
v-jiaodi Nov 6, 2024
6441656
Merge branch 'main' into upgrade-116
MaryGao Nov 11, 2024
14f5f8d
Fix the build issue for upgrading
MaryGao Nov 11, 2024
9619310
Report warnings for cookie parameter in RLC
MaryGao Nov 11, 2024
eea815e
update the ut for rlc and modular
MaryGao Nov 11, 2024
01bfa0a
Merge to main
MaryGao Nov 11, 2024
cfca3e5
Merge remote-tracking branch 'origin/main' into upgrade-116
MaryGao Nov 11, 2024
c0e1011
Update the lock file
MaryGao Nov 11, 2024
753e773
Update the nextlink to azure core's one
MaryGao Nov 11, 2024
f0e432f
Fix RLC ut failure
MaryGao Nov 11, 2024
2486e5d
Update the comments
MaryGao Nov 11, 2024
de610d4
Update the ruleset dependency
MaryGao Nov 11, 2024
3bcbdbf
update @nextLink to @Azure.core.nextLink
v-jiaodi Nov 11, 2024
df13414
Merge branch 'upgrade-116' of https://github.com/v-jiaodi/autorest.ty…
v-jiaodi Nov 11, 2024
6977fc2
Merge branch 'main' of https://github.com/Azure/autorest.typescript i…
v-jiaodi Nov 11, 2024
f255359
Update the failure for todo-non-branded.api
MaryGao Nov 11, 2024
410d2af
Remove the list decorator with error thrown
MaryGao Nov 11, 2024
11070e5
Merge remote-tracking branch 'v-jiaodi/upgrade-116' into pr/v-jiaodi/…
MaryGao Nov 11, 2024
88e9365
Update the smoke test
MaryGao Nov 11, 2024
1ede9b9
Downgrade the cadl ranch version
MaryGao Nov 11, 2024
ce2e07c
Revert cadl-ranch version
MaryGao Nov 11, 2024
6aaa7be
Merge branch 'main' into upgrade-116
MaryGao Nov 13, 2024
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
402 changes: 237 additions & 165 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions packages/typespec-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"type": "module",
"dependencies": {
"@azure-tools/typespec-ts": "workspace:^0.34.0",
"@typespec/openapi": ">=0.61.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.47.0 <1.0.0",
"@typespec/openapi3": ">=0.61.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.47.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.47.4 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.47.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.47.0 <1.0.0",
"@typespec/compiler": ">=0.61.2 <1.0.0",
"@typespec/http": ">=0.61.0 <1.0.0",
"@typespec/rest": ">=0.61.0 <1.0.0",
"@typespec/versioning": ">=0.61.0 <1.0.0",
"@typespec/openapi": ">=0.62.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.48.0 <1.0.0",
"@typespec/openapi3": ">=0.62.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.48.0 <1.0.0",
"@typespec/compiler": ">=0.62.0 <1.0.0",
"@typespec/http": ">=0.62.0 <1.0.0",
"@typespec/rest": ">=0.62.0 <1.0.0",
"@typespec/versioning": ">=0.62.0 <1.0.0",
"prettier": "^3.1.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ export interface AnomalyDetectorClientOptionalParams extends ClientOptions {
apiVersion?: string;
}

// @public
export type APIVersion = "v1.1";

// @public
export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
continuationToken?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export {
UnivariateUnivariateLastDetectionResult,
UnivariateUnivariateChangePointDetectionOptions,
UnivariateUnivariateChangePointDetectionResult,
APIVersion,
KnownVersions,
} from "./models/index.js";
export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ export {
UnivariateUnivariateLastDetectionResult,
UnivariateUnivariateChangePointDetectionOptions,
UnivariateUnivariateChangePointDetectionResult,
APIVersion,
KnownVersions,
} from "./models.js";
Original file line number Diff line number Diff line change
Expand Up @@ -1071,9 +1071,6 @@ export function univariateUnivariateChangePointDetectionResultDeserializer(
};
}

/** Type of APIVersion */
export type APIVersion = "v1.1";
MaryGao marked this conversation as resolved.
Show resolved Hide resolved

/** Known values of {@link Versions} that the service accepts. */
export enum KnownVersions {
v1_1 = "v1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ model ModelList {
maxCount: int32;

@doc("The link to fetch more models.")
@nextLink
@Azure.Core.nextLink
nextLink?: string;
}

Expand Down
26 changes: 13 additions & 13 deletions packages/typespec-test/test/batch_modular/spec/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ model ApplicationListResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -642,7 +642,7 @@ model PoolListUsageMetricsResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -673,7 +673,7 @@ model AccountListSupportedImagesResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -738,7 +738,7 @@ model PoolNodeCountsListResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -1001,7 +1001,7 @@ model CertificateListResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand All @@ -1017,7 +1017,7 @@ model NodeFileListResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -2228,7 +2228,7 @@ model BatchJobScheduleListResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -2461,7 +2461,7 @@ model BatchJobListResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand All @@ -2477,7 +2477,7 @@ model BatchJobListPreparationAndReleaseTaskStatusResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -2998,7 +2998,7 @@ model BatchPoolListResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -3422,7 +3422,7 @@ model BatchTaskListResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -3783,7 +3783,7 @@ model BatchNodeListResult {

#suppress "@azure-tools/typespec-azure-core/casing-style" "The names of Property types must use camelCase"
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down Expand Up @@ -3840,6 +3840,6 @@ model NodeVMExtensionList {
value?: NodeVMExtension[];

@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ model PagedLedgerEntries {
state: LedgerQueryState;

@doc("Path from which to retrieve the next page of results.")
@nextLink
@Azure.Core.nextLink
nextLink?: ResourceLocation<LedgerEntry>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ namespace TodoItems {

model TodoPage {
/** The items in the page */
@pageItems
items: TodoItem[];

pagination: {
Expand Down Expand Up @@ -248,7 +249,7 @@ namespace TodoItems {

@route("{itemId}/attachments")
namespace Attachments {
@list op list(
op list(
MaryGao marked this conversation as resolved.
Show resolved Hide resolved
@path itemId: TodoItem.id,
): TodoAttachment[] | NotFoundResponse;

Expand Down
2 changes: 1 addition & 1 deletion packages/typespec-test/test/widget_dpg/spec/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ model ListWidgetsPagesResults {
@items
results: Widget[];
@doc("The URL to get the next set of results.")
@nextLink
@Azure.Core.nextLink
`odata.nextLink`?: string;
}

Expand Down
30 changes: 15 additions & 15 deletions packages/typespec-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
"@azure-tools/cadl-ranch-specs": "^0.38.0",
MaryGao marked this conversation as resolved.
Show resolved Hide resolved
"@azure-tools/cadl-ranch": "^0.15.0",
"@azure-tools/cadl-ranch-api": "^0.5.0",
"@azure-tools/typespec-autorest": ">=0.47.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.47.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.47.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.47.4 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.48.0 <1.0.0",
"@azure/abort-controller": "^2.1.2",
"@azure/core-auth": "^1.6.0",
"@azure/core-lro": "^3.1.0",
Expand All @@ -85,12 +85,12 @@
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@typespec/compiler": ">=0.61.2 <1.0.0",
"@typespec/http": ">=0.61.0 <1.0.0",
"@typespec/openapi": ">=0.61.0, <1.0.0",
"@typespec/rest": ">=0.61.0 <1.0.0",
"@typespec/compiler": ">=0.62.0 <1.0.0",
"@typespec/http": ">=0.62.0 <1.0.0",
"@typespec/openapi": ">=0.62.0, <1.0.0",
"@typespec/rest": ">=0.62.0 <1.0.0",
"@typespec/ts-http-runtime": "1.0.0-alpha.20240314.2",
"@typespec/versioning": ">=0.61.0 <1.0.0",
"@typespec/versioning": ">=0.62.0 <1.0.0",
"chai": "^4.3.6",
"chalk": "^4.0.0",
"cross-env": "^7.0.3",
Expand All @@ -110,12 +110,12 @@
"tsx": "^4.16.5"
},
"peerDependencies": {
"@azure-tools/typespec-azure-core": ">=0.47.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.47.4 <1.0.0",
"@typespec/compiler": ">=0.61.2 <1.0.0",
"@typespec/http": ">=0.61.0 <1.0.0",
"@typespec/rest": ">=0.61.0 <1.0.0",
"@typespec/versioning": ">=0.61.0 <1.0.0"
"@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.48.0 <1.0.0",
"@typespec/compiler": ">=0.62.0 <1.0.0",
"@typespec/http": ">=0.62.0 <1.0.0",
"@typespec/rest": ">=0.62.0 <1.0.0",
"@typespec/versioning": ">=0.62.0 <1.0.0"
},
"dependencies": {
"@azure-tools/rlc-common": "workspace:^0.34.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/typespec-ts/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ const libDef = {
messages: {
default: paramMessage`Path parameter '${"paramName"}' cannot be optional.`
}
},
"parameter-type-not-supported": {
severity: "warning",
messages: {
default: paramMessage`Parameter '${"paramName"}' with type '${"paramType"}' is not supported and we would ignore this parameter.`
}
}
},
emitter: {
Expand Down
20 changes: 19 additions & 1 deletion packages/typespec-ts/src/modular/buildCodeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,19 @@ function emitParameter(
context: SdkContext,
parameter: HttpOperationParameter | HttpServerParameter,
implementation: string
): Parameter {
): Parameter | undefined {
if (parameter.type === "cookie") {
// TODO: support cookie parameters, https://github.com/Azure/autorest.typescript/issues/2898
reportDiagnostic(context.program, {
code: "parameter-type-not-supported",
format: {
paramType: parameter.type,
paramName: parameter.name
},
target: NoTarget
});
return undefined;
}
const base = emitParamBase(context, parameter.param);
let type = getType(context, parameter.param.type, {
usage: UsageFlags.Input
Expand Down Expand Up @@ -857,6 +869,9 @@ function emitBasicOperation(
continue;
}
const emittedParam = emitParameter(context, param, "Method");
if (emittedParam === undefined) {
continue;
}
if (isApiVersion(context, param)) {
emittedParam.isApiVersion = true;
methodApiVersionParam = emittedParam;
Expand Down Expand Up @@ -1719,6 +1734,9 @@ function emitServerParams(
serverParameter,
"Client"
);
if (emittedParameter === undefined) {
continue;
}
endpointPathParameters.push(emittedParameter);
if (isApiVersion(context, serverParameter as any)) {
emittedParameter.isApiVersion = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function getOperationApiVersion(
relevantProperty: p.param
});
required.add(!p.param.optional);
if (p.type !== "header") {
if (p.type === "query" || p.type === "path") {
locations.add(p.type);
}
const typeString = JSON.stringify(trimUsage(type));
Expand Down Expand Up @@ -127,7 +127,7 @@ export function getOperationApiVersion(
relevantProperty: p.param
});
required.add(!p.param.optional);
if (p.type !== "header") {
if (p.type === "query" || p.type === "path") {
locations.add(p.type);
}
const typeString = JSON.stringify(trimUsage(type));
Expand Down
24 changes: 23 additions & 1 deletion packages/typespec-ts/src/transform/transformParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
listOperationGroups,
listOperationsInOperationGroup
} from "@azure-tools/typespec-client-generator-core";
import { Type, isVoidType } from "@typespec/compiler";
import { NoTarget, Type, isVoidType } from "@typespec/compiler";
import {
getBodyType,
getFormattedPropertyDoc,
Expand All @@ -46,6 +46,7 @@ import {
} from "../utils/operationUtil.js";

import { SdkContext } from "../utils/interfaces.js";
import { reportDiagnostic } from "../lib.js";

export function transformToParameterTypes(
client: SdkClient,
Expand Down Expand Up @@ -99,6 +100,8 @@ export function transformToParameterTypes(
);
// transform path param
const pathParams = transformPathParameters();
// TODO: support cookie parameters, https://github.com/Azure/autorest.typescript/issues/2898
transformCookieParameters(dpgContext, parameters);
// transform header param including content-type
const headerParams = transformHeaderParameters(
dpgContext,
Expand Down Expand Up @@ -200,6 +203,25 @@ function getParameterName(name: string) {
return `"${name}"`;
}

function transformCookieParameters(
dpgContext: SdkContext,
parameters: HttpOperationParameters
) {
// TODO: support cookie parameters, https://github.com/Azure/autorest.typescript/issues/2898
parameters.parameters
.filter((p) => p.type === "cookie")
.forEach((p) => {
reportDiagnostic(dpgContext.program, {
code: "parameter-type-not-supported",
format: {
paramName: p.name,
paramType: p.type
},
target: NoTarget
});
});
}

function transformQueryParameters(
dpgContext: SdkContext,
parameters: HttpOperationParameters,
Expand Down
Loading
Loading