Skip to content

Commit

Permalink
Merge branch 'main' into multipart-01
Browse files Browse the repository at this point in the history
  • Loading branch information
markcowl authored Dec 20, 2024
2 parents 4c53d99 + 8214ed6 commit 06e921b
Show file tree
Hide file tree
Showing 146 changed files with 3,568 additions and 2,822 deletions.
7 changes: 7 additions & 0 deletions .chronus/changes/tadelesh-patch-1-2024-11-18-16-37-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/http-specs"
---

fix missing `@list` decorator for unbranded pageable operation
4 changes: 2 additions & 2 deletions eng/emitters/pipelines/templates/steps/test-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ steps:
displayName: "Upload Cadl Ranch Standard Coverage Report"
condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq('${{ parameters.EmitArtifacts }}', true))
inputs:
azureSubscription: "Cadl Ranch Storage"
azureSubscription: "TypeSpec Storage"
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: npx cadl-ranch upload-coverage --coverageFile ./generator/artifacts/coverage/cadl-ranch-coverage-${{ parameters.LanguageShortName }}-standard.json --generatorName ${{ coalesce(parameters.CadlRanchName, parameters.LanguageShortName) }} --storageAccountName azuresdkcadlranch --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode standard
inlineScript: npx tsp-spector upload-coverage --coverageFile ./generator/artifacts/coverage/tsp-spector-coverage-${{ parameters.LanguageShortName }}-standard.json --generatorName ${{ coalesce(parameters.CadlRanchName, parameters.LanguageShortName) }} --storageAccountName typespec --containerName coverages --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode standard
workingDirectory: $(selfRepositoryPath)${{ parameters.PackagePath }}
4 changes: 3 additions & 1 deletion eng/tsp-core/pipelines/dashboard-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ trigger:
# For patch releases
- release/*

pr: none

extends:
template: /eng/common/pipelines/templates/1es-redirect.yml
parameters:
Expand Down Expand Up @@ -38,5 +40,5 @@ extends:
scriptLocation: "inlineScript"
inlineScript: |
echo "Uploading files to Azure Blob Storage..."
az storage blob upload-batch --source packages/spec-dashboard/dist/ --destination '$web' --overwrite
az storage blob upload-batch --account-name specdashboard --source packages/spec-dashboard/dist/ --destination '$web' --overwrite
displayName: "Upload files to Azure Blob Storage"
26 changes: 26 additions & 0 deletions eng/tsp-core/pipelines/pr-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,37 @@ extends:
--destination-path $(TYPESPEC_WEBSITE_BASE_PATH) \
--source "./website/dist/" \
--overwrite
- task: CopyFiles@2
displayName: "Copy VSCode extension .vsix to artifact directory"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/packages/typespec-vscode"
Contents: "*.vsix"
TargetFolder: "$(Build.ArtifactStagingDirectory)/vscode-extension"
templateContext:
outputs:
- output: pipelineArtifact
path: $(Build.ArtifactStagingDirectory)/vscode-extension
artifact: vscode-extension
displayName: Copy VSCode extension .vsix to artifact directory
- job: tryit_comment
displayName: Create TryIt comment
dependsOn: tryit
steps:
- pwsh: |
$curlCommand = 'curl -s -u :$(System.AccessToken) "$(System.TeamFoundationCollectionUri)/$(System.TeamProject)/_apis/build/builds/$(Build.BuildId)/artifacts?artifactName=vscode-extension"'
$response = Invoke-Expression $curlCommand
$responseObject = $response | ConvertFrom-Json
Write-Host "response: $response"
$downloadUrl = $responseObject.resource.downloadUrl
Write-Output "Artifact URL: $downloadUrl"
Write-Host "##vso[task.setvariable variable=vscodeUrl]$downloadUrl"
displayName: Get vscode artifact URL
- script: npx tsx eng/tsp-core/scripts/create-tryit-comment.ts
displayName: Check already commented
env:
GH_TOKEN: $(azuresdk-github-pat)
VSCODE_DOWNLOAD_URL: $(vscodeUrl)

- job: change_comment
displayName: Describe changes on PR
Expand Down
12 changes: 10 additions & 2 deletions eng/tsp-core/scripts/create-tryit-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ async function main() {
const repo = process.env["BUILD_REPOSITORY_ID"];
const prNumber = process.env["SYSTEM_PULLREQUEST_PULLREQUESTNUMBER"];
const ghToken = process.env.GH_TOKEN;
const vscodeDownloadUrl = process.env.VSCODE_DOWNLOAD_URL;
if (repo === undefined) {
throw new Error("BUILD_REPOSITORY_ID environment variable is not set");
}
Expand All @@ -33,17 +34,24 @@ async function main() {
return;
}

const comment = makeComment(folderName, prNumber);
const comment = makeComment(folderName, prNumber, vscodeDownloadUrl);
await writeComment(repo, prNumber, comment, ghAuth);
}

function makeComment(folderName: string, prNumber: string): string {
function makeComment(
folderName: string,
prNumber: string,
vscodeDownloadUrl: string | undefined,
): string {
const links = [
`[🛝 Playground]( https://cadlplayground.z22.web.core.windows.net${folderName}/prs/${prNumber}/)`,
`[🌐 Website](https://tspwebsitepr.z22.web.core.windows.net${folderName}/prs/${prNumber}/)`,
`[📚 Next docs](https://tspwebsitepr.z22.web.core.windows.net${folderName}/prs/${prNumber}/docs/next.html)`,
];

if (vscodeDownloadUrl) {
links.push(`[🛝 VSCode Extension]( ${vscodeDownloadUrl})`);
}
return [
`<!-- ${TRY_ID_COMMENT_IDENTIFIER} -->`,
`You can try these changes here`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export function createModel(sdkContext: SdkContext<NetEmitterOptions>): CodeMode
const clientParameters = fromSdkEndpointParameter(endpointParameter);
return {
Name: getClientName(client, parentNames),
Description: client.summary ?? client.doc,
Summary: client.summary,
Doc: client.doc,
Operations: client.methods
.filter((m) => m.kind !== "clientaccessor")
.map((m) =>
Expand Down Expand Up @@ -156,7 +157,8 @@ export function createModel(sdkContext: SdkContext<NetEmitterOptions>): CodeMode
parameters.push({
Name: parameter.name,
NameInRequest: parameter.serializedName,
Description: parameter.doc,
Summary: parameter.summary,
Doc: parameter.doc,
// TODO: we should do the magic in generator
Type: parameterType,
Location: RequestLocation.Uri,
Expand Down
16 changes: 10 additions & 6 deletions packages/http-client-csharp/emitter/src/lib/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ export function fromSdkModelType(
) /* when tcgc provide a way to identify if the access is override or not, we can get the accessibility from the modelType.access */,
usage: modelType.usage,
deprecation: modelType.deprecation,
description: modelType.summary ?? modelType.doc,
doc: modelType.doc,
summary: modelType.summary,
discriminatorValue: modelType.discriminatorValue,
decorators: modelType.decorators,
} as InputModelType;
Expand Down Expand Up @@ -185,7 +186,8 @@ export function fromSdkModelType(
kind: property.kind,
name: property.name,
serializedName: serializedName,
description: property.summary ?? property.doc,
summary: property.summary,
doc: property.doc,
type: fromSdkType(
targetType,
context,
Expand Down Expand Up @@ -225,7 +227,8 @@ export function fromSdkEnumType(
enumType.__raw as any,
) /* when tcgc provide a way to identify if the access is override or not, we can get the accessibility from the enumType.access,*/,
deprecation: enumType.deprecation,
description: enumType.summary ?? enumType.doc,
summary: enumType.summary,
doc: enumType.doc,
isFixed: enumType.isFixed,
isFlags: enumType.isFlags,
usage: enumType.usage,
Expand Down Expand Up @@ -337,7 +340,7 @@ function fromSdkConstantType(
values: values,
crossLanguageDefinitionId: "",
access: undefined,
description: `The ${enumName}`, // TODO -- what should we put here?
doc: `The ${enumName}`, // TODO -- what should we put here?
isFixed: false,
isFlags: false,
usage: literalTypeContext.Usage,
Expand All @@ -350,7 +353,7 @@ function fromSdkConstantType(
kind: "enumvalue",
name: enumValueName,
value: constantType.value as string | number,
description: enumValueName,
doc: enumValueName,
valueType: enumType.valueType,
enumType: enumType,
});
Expand Down Expand Up @@ -386,7 +389,8 @@ function fromSdkEnumValueType(
value: enumValueType.value,
valueType: fromSdkBuiltInType(enumValueType.valueType),
enumType: fromSdkEnumType(enumValueType.enumType, context, typeMap),
description: enumValueType.summary ?? enumValueType.doc,
summary: enumValueType.summary,
doc: enumValueType.doc,
decorators: enumValueType.decorators,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { InputOperation } from "../type/input-operation.js";
import { InputParameter } from "../type/input-parameter.js";
import { InputType } from "../type/input-type.js";
import { convertLroFinalStateVia } from "../type/operation-final-state-via.js";
import { OperationLongRunning } from "../type/operation-long-running.js";
import { OperationPaging } from "../type/operation-paging.js";
import { OperationResponse } from "../type/operation-response.js";
import { RequestLocation } from "../type/request-location.js";
Expand Down Expand Up @@ -75,7 +76,7 @@ export function fromSdkServiceMethod(
getOperationGroupName(sdkContext, method.operation, sdkContext.sdkPackage.rootNamespace),
Deprecated: getDeprecated(sdkContext.program, method.__raw!),
Summary: method.summary,
Description: method.doc,
Doc: method.doc,
Accessibility: method.access,
Parameters: [...parameterMap.values()],
Responses: [...responseMap.values()],
Expand Down Expand Up @@ -189,7 +190,8 @@ function fromSdkHttpOperationParameter(
return {
Name: p.name,
NameInRequest: p.kind === "header" ? normalizeHeaderName(serializedName) : serializedName,
Description: p.summary ?? p.doc,
Summary: p.summary,
Doc: p.doc,
Type: parameterType,
Location: getParameterLocation(p),
IsApiVersion:
Expand All @@ -210,7 +212,7 @@ function loadLongRunningOperation(
method: SdkServiceMethod<SdkHttpOperation>,
sdkContext: SdkContext<NetEmitterOptions>,
typeMap: SdkTypeMap,
): import("../type/operation-long-running.js").OperationLongRunning | undefined {
): OperationLongRunning | undefined {
if (method.kind !== "lro") {
return undefined;
}
Expand Down Expand Up @@ -260,7 +262,8 @@ function fromSdkServiceResponseHeaders(
({
Name: h.__raw!.name,
NameInResponse: h.serializedName,
Description: h.summary ?? h.doc,
Summary: h.summary,
Doc: h.doc,
Type: fromSdkType(h.type, sdkContext, typeMap),
}) as HttpResponseHeader,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

import { SdkContext } from "@azure-tools/typespec-client-generator-core";
import { getDoc } from "@typespec/compiler";
import { getDoc, getSummary } from "@typespec/compiler";
import { HttpServer } from "@typespec/http";
import { getExtensions } from "@typespec/openapi";
import { NetEmitterOptions } from "../options.js";
Expand Down Expand Up @@ -50,7 +50,8 @@ export function resolveServers(
const variable: InputParameter = {
Name: name,
NameInRequest: name,
Description: getDoc(context.program, prop),
Summary: getSummary(context.program, prop),
Doc: getDoc(context.program, prop),
Type: inputType,
Location: RequestLocation.Uri,
IsApiVersion: name.toLowerCase() === "apiversion" || name.toLowerCase() === "api-version",
Expand All @@ -73,7 +74,7 @@ export function resolveServers(
const variable: InputParameter = {
Name: "host",
NameInRequest: "host",
Description: server.description,
Doc: server.description,
Type: {
kind: "string",
name: "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { InputType } from "./input-type.js";
export interface HttpResponseHeader {
Name: string;
NameInResponse: string;
Description: string;
Summary: string;
Doc: string;
Type: InputType;
}
3 changes: 2 additions & 1 deletion packages/http-client-csharp/emitter/src/type/input-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { Protocols } from "./protocols.js";

export interface InputClient {
Name: string;
Description?: string;
Summary?: string;
Doc?: string;
Operations: InputOperation[];
Protocol?: Protocols;
Parent?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface InputOperation {
ResourceName?: string;
Summary?: string;
Deprecated?: string;
Description?: string;
Doc?: string;
Accessibility?: string;
Parameters: InputParameter[];
Responses: OperationResponse[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export interface VirtualParameter {}
export interface InputParameter {
Name: string;
NameInRequest: string;
Description?: string;
Summary?: string;
Doc?: string;
Type: InputType;
Location: RequestLocation;
DefaultValue?: InputConstant;
Expand Down
3 changes: 2 additions & 1 deletion packages/http-client-csharp/emitter/src/type/input-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { DateTimeKnownEncoding, DurationKnownEncoding } from "@typespec/compiler

interface InputTypeBase {
kind: string;
description?: string;
summary?: string;
doc?: string;
deprecation?: string;
decorators?: DecoratorInfo[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ op test(@body input: Pet): Pet;
const discriminatorProperty = pet?.properties.find((p) => p === pet?.discriminatorProperty);
strictEqual(discriminatorProperty?.name, "kind");
strictEqual(discriminatorProperty.serializedName, "kind");
strictEqual(discriminatorProperty.description, "The kind of the pet");
strictEqual(discriminatorProperty.doc, "The kind of the pet");
strictEqual(discriminatorProperty.type.kind, "enum");
strictEqual(discriminatorProperty.type.name, "PetKind");
strictEqual(discriminatorProperty.type.valueType.kind, "string");
Expand Down Expand Up @@ -234,7 +234,7 @@ op test(@body input: Pet): Pet;
const discriminatorProperty = pet?.properties.find((p) => p === pet?.discriminatorProperty);
strictEqual(discriminatorProperty?.name, "kind");
strictEqual(discriminatorProperty.serializedName, "kind");
strictEqual(discriminatorProperty.description, "The kind of the pet");
strictEqual(discriminatorProperty.doc, "The kind of the pet");
strictEqual(discriminatorProperty.type.kind, "enum");
strictEqual(discriminatorProperty.type.name, "PetKind");
strictEqual(discriminatorProperty.type.valueType.kind, "string");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe("Test GetInputType for enum", () => {
strictEqual(type.kind, "enum");
strictEqual(type.name, "SimpleEnum");
strictEqual(type.isFixed, true);
strictEqual(type.description, "fixed string enum");
strictEqual(type.doc, "fixed string enum");
strictEqual(type.crossLanguageDefinitionId, "Azure.Csharp.Testing.SimpleEnum");
strictEqual(type.access, undefined);
strictEqual(type.valueType.kind, "string");
Expand Down Expand Up @@ -142,7 +142,7 @@ describe("Test GetInputType for enum", () => {
strictEqual(type.name, "FixedIntEnum");
strictEqual(type.crossLanguageDefinitionId, "Azure.Csharp.Testing.FixedIntEnum");
strictEqual(type.access, undefined);
strictEqual(type.description, "Fixed int enum");
strictEqual(type.doc, "Fixed int enum");
strictEqual(type.valueType.crossLanguageDefinitionId, "TypeSpec.int32");
strictEqual(type.valueType.kind, "int32");
strictEqual(type.values.length, 3);
Expand Down Expand Up @@ -181,7 +181,7 @@ describe("Test GetInputType for enum", () => {
strictEqual(type.name, "FixedEnum");
strictEqual(type.crossLanguageDefinitionId, "Azure.Csharp.Testing.FixedEnum");
strictEqual(type.access, undefined);
strictEqual(type.description, "Fixed enum");
strictEqual(type.doc, "Fixed enum");
strictEqual(type.valueType.kind, "string");
strictEqual(type.valueType.crossLanguageDefinitionId, "TypeSpec.string");
strictEqual(type.values.length, 3);
Expand Down
Loading

0 comments on commit 06e921b

Please sign in to comment.