Skip to content
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
2 changes: 1 addition & 1 deletion core
Submodule core updated 61 files
+7 −0 .chronus/changes/emitter-diff-tool-2026-7-2-0-0-0.md
+2 −2 .github/actions/setup/action.yml
+5 −4 .github/skills/csharp-spector-coverage-gaps/SKILL.md
+147 −0 .github/workflows/ci-emitter-diff-python.yml
+1 −0 AGENTS.md
+1 −0 cspell.yaml
+2 −1 eng/common/scripts/labels/policy.ts
+199 −0 eng/emitter-diff/README.md
+141 −0 eng/emitter-diff/src/baseline-cache.ts
+495 −0 eng/emitter-diff/src/cli.ts
+374 −0 eng/emitter-diff/src/diff.ts
+44 −0 eng/emitter-diff/src/registry.ts
+299 −0 eng/emitter-diff/src/resolver.ts
+74 −0 eng/emitter-diff/src/types.ts
+110 −0 eng/emitter-diff/src/util.ts
+9 −0 eng/emitter-diff/tsconfig.json
+1 −0 package.json
+1 −3 packages/asset-emitter/src/builders/object-builder.ts
+1 −7 packages/asset-emitter/src/types.ts
+4 −4 packages/compiler/src/core/checker.ts
+1 −2 packages/compiler/src/core/name-resolver.ts
+1 −3 packages/compiler/src/core/scanner.ts
+3 −16 packages/compiler/src/core/types.ts
+1 −3 packages/compiler/src/experimental/mutators.ts
+1 −3 packages/compiler/src/server/serverlib.ts
+2 −6 packages/compiler/src/server/tmlanguage.ts
+1 −2 packages/emitter-framework/src/python/components/class-declaration/class-method.tsx
+1 −2 packages/emitter-framework/src/python/components/class-declaration/pydantic-class-declaration.tsx
+1 −2 packages/emitter-framework/src/python/components/function-declaration/function-declaration.tsx
+1 −2 packages/emitter-framework/src/typescript/components/function-declaration.tsx
+1 −2 packages/emitter-framework/src/typescript/components/interface-declaration.tsx
+2 −8 packages/html-program-viewer/src/react/type-config.ts
+4 −9 packages/http-canonicalization/src/operation.ts
+1 −7 packages/http-canonicalization/src/options.ts
+1 −2 packages/http-client-csharp/emitter/src/lib/type-converter.ts
+1 −4 packages/http-client-csharp/emitter/src/type/input-type.ts
+1 −2 packages/http-client-csharp/emitter/test/Unit/client-initialization.test.ts
+1 −3 packages/http-client-js/test/e2e/http/payload/multipart/main.test.ts
+1 −2 packages/http-client-python/emitter/src/code-model.ts
+2 −1 packages/http-client-python/package.json
+1 −1 packages/http-server-js/generated-defs/package.json.ts
+1 −2 packages/http-server-js/src/util/differentiate.ts
+2 −2 packages/http-specs/spec-summary.md
+6 −10 packages/http/src/private.decorators.ts
+3 −9 packages/http/src/types.ts
+1 −5 packages/openapi3/src/cli/actions/convert/interfaces.ts
+3 −17 packages/openapi3/src/types.ts
+2 −7 packages/protobuf/src/ast.ts
+10 −21 packages/protobuf/src/transform/index.ts
+1 −7 packages/rest/src/rest.ts
+1 −3 packages/tmlanguage-generator/src/tmlanguage-generator.ts
+16 −18 packages/tspd/src/gen-extern-signatures/components/decorator-signature-type.tsx
+16 −18 packages/tspd/src/gen-extern-signatures/components/function-signature-type.tsx
+2 −2 packages/typespec-vscode/src/typespec-utils.ts
+2 −2 packages/versioning/test/versioning-timeline.test.ts
+39 −29 pnpm-lock.yaml
+1 −1 pnpm-workspace.yaml
+3 −0 tsconfig.eng.json
+15 −15 website/src/content/docs/docs/emitters/protobuf/reference/data-types.md
+3 −3 website/src/content/docs/docs/handbook/configuration/configuration.mdx
+1 −1 website/src/content/docs/docs/libraries/rest/reference/data-types.md
10 changes: 5 additions & 5 deletions packages/azure-http-specs/spec-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -976,11 +976,11 @@ This scenario tests the exact() function applied to a model property with langua
The property 'name' on ScopedModel is renamed using exact() scoped to each language,
with names that include an underscore prefix to verify that language naming logic does not apply:

- Python: '\_my_name' (should not be converted to 'my_name' or other casing)
- Java: '\_myName' (should not be converted to remove the underscore prefix)
- C#: '\_MyName' (should not be converted to remove the underscore prefix)
- JavaScript: '\_myName' (should not be converted to remove the underscore prefix)
- Go: '\_MyName' (should not be converted to remove the underscore prefix)
- Python: '_my_name' (should not be converted to 'my_name' or other casing)
- Java: '_myName' (should not be converted to remove the underscore prefix)
- C#: '_MyName' (should not be converted to remove the underscore prefix)
- JavaScript: '_myName' (should not be converted to remove the underscore prefix)
- Go: '_MyName' (should not be converted to remove the underscore prefix)
Each language should preserve the specified exact name as-is without any further casing conversion.

Expected request body:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ export type JsonSchema = {
export type ResolvedJsonSchemaType = Exclude<JsonSchemaType, JsonSchemaRef>;

export type JsonSchemaType =
| JsonSchemaObject
| JsonSchemaArray
| JsonSchemaPrimitive
| JsonSchemaRef;
JsonSchemaObject | JsonSchemaArray | JsonSchemaPrimitive | JsonSchemaRef;

export interface JsonSchemaBase {
$id?: string;
Expand Down
3 changes: 1 addition & 2 deletions packages/typespec-autorest/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import type {
* a particular service definition.
*/
export type AutorestServiceRecord =
| AutorestUnversionedServiceRecord
| AutorestVersionedServiceRecord;
AutorestUnversionedServiceRecord | AutorestVersionedServiceRecord;

export interface AutorestUnversionedServiceRecord extends AutorestEmitterResult {
/** The service that generated this OpenAPI document */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ export interface ArmResourceIdentifierConfig {
}

export type ArmResourceDeploymentScope =
| "Tenant"
| "Subscription"
| "ResourceGroup"
| "ManagementGroup"
| "ServiceGroup"
| "Extension";
"Tenant" | "Subscription" | "ResourceGroup" | "ManagementGroup" | "ServiceGroup" | "Extension";

export interface ArmResourceIdentifierAllowedResource {
/** The type of resource that is being referred to. For example Microsoft.Network/virtualNetworks or Microsoft.Network/virtualNetworks/subnets. See Example Types for more examples. */
Expand Down
10 changes: 3 additions & 7 deletions packages/typespec-azure-core/src/lro-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,7 @@ export interface NextOperationReference extends LogicalOperationStep {
* getting to a success result
*/
export type FinalOperationStep =
| FinalOperationLink
| FinalOperationReference
| PollingSuccessProperty
| NoPollingSuccessProperty;
FinalOperationLink | FinalOperationReference | PollingSuccessProperty | NoPollingSuccessProperty;

/**
* For long-running operations, the resource link to the final result
Expand Down Expand Up @@ -296,9 +293,8 @@ export function getLroMetadata(program: Program, operation: Operation): LroMetad
processFinalReference(program, operation, context);
processFinalLink(program, operation, context);
const nextReference:
| NextOperationReference
| (NextOperationLink & { operation: Operation })
| undefined = processStatusMonitorReference(program, operation, context);
NextOperationReference | (NextOperationLink & { operation: Operation }) | undefined =
processStatusMonitorReference(program, operation, context);
if (nextReference !== undefined && nextReference.responseModel.kind === "Model") {
context.statusMonitorStep = nextReference;
const linkedOperation =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,7 @@ export type LegacyResourceOperationDecorator = (
target: Operation,
resourceType: Model,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
resourceName?: string,
) => DecoratorValidatorCallbacks | void;

Expand All @@ -264,13 +258,7 @@ export type ExtensionResourceOperationDecorator = (
targetResourceType: Model,
extensionResourceType: Model,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
resourceName?: string,
) => DecoratorValidatorCallbacks | void;

Expand All @@ -289,13 +277,7 @@ export type BuiltInResourceOperationDecorator = (
parentResourceType: Model,
builtInResourceType: Model,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
resourceName?: string,
) => DecoratorValidatorCallbacks | void;

Expand All @@ -312,13 +294,7 @@ export type LegacyExtensionResourceOperationDecorator = (
target: Operation,
resourceType: Model,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
resourceName?: string,
) => DecoratorValidatorCallbacks | void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ import {
import { ArmStateKeys } from "./state.js";

export type ArmLifecycleOperationKind =
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "checkExistence";
"read" | "createOrUpdate" | "update" | "delete" | "checkExistence";
export type ArmOperationKind = ArmLifecycleOperationKind | "list" | "action" | "other";

export interface ArmResourceOperation extends ArmResourceOperationData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,7 @@ function callOperationDecorator(
resourceType: Model,
resourceName: string,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
): void {
switch (operationType) {
case "read":
Expand Down Expand Up @@ -806,13 +800,7 @@ function callLifecycleDecorator(
target: Operation,
resourceType: Model,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
): void {
switch (operationType) {
case "read":
Expand Down Expand Up @@ -842,13 +830,7 @@ const $extensionResourceOperation: ExtensionResourceOperationDecorator = (
targetResourceType: Model,
extensionResourceType: Model,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
resourceName?: string,
) => {
if (
Expand Down Expand Up @@ -879,13 +861,7 @@ const $builtInResourceOperation: BuiltInResourceOperationDecorator = (
parentResourceType: Model,
builtInResourceType: Model,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
resourceName?: string,
) => {
if (
Expand All @@ -907,13 +883,7 @@ const $legacyResourceOperation: LegacyResourceOperationDecorator = (
target: Operation,
resourceType: Model,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
resourceName?: string,
) => {
if (
Expand Down Expand Up @@ -979,13 +949,7 @@ const $legacyExtensionResourceOperation: LegacyExtensionResourceOperationDecorat
target: Operation,
resourceType: Model,
operationType:
| "read"
| "createOrUpdate"
| "update"
| "delete"
| "list"
| "action"
| "checkExistence",
"read" | "createOrUpdate" | "update" | "delete" | "list" | "action" | "checkExistence",
resourceName?: string,
) => {
if (
Expand Down
8 changes: 1 addition & 7 deletions packages/typespec-azure-resource-manager/src/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ import { getArmResource, listArmResources, registerArmResource } from "./private
import { ArmStateKeys } from "./state.js";

export type ArmResourceKind =
| "Tracked"
| "Proxy"
| "Extension"
| "Virtual"
| "Custom"
| "BuiltIn"
| "Generic";
"Tracked" | "Proxy" | "Extension" | "Virtual" | "Custom" | "BuiltIn" | "Generic";

/**
* The base details for all kinds of resources
Expand Down
9 changes: 3 additions & 6 deletions packages/typespec-client-generator-core/src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1884,17 +1884,15 @@ export function getClientOptionValue(
): unknown | undefined {
// Check operation directly
const opOption = getScopedDecoratorData(context, clientOptionKey, target) as
| { name: string; value: unknown }
| undefined;
{ name: string; value: unknown } | undefined;
if (opOption?.name === optionName) {
return opOption.value;
}

// Check interface if operation is in one
if (target.interface) {
const ifaceOption = getScopedDecoratorData(context, clientOptionKey, target.interface) as
| { name: string; value: unknown }
| undefined;
{ name: string; value: unknown } | undefined;
if (ifaceOption?.name === optionName) {
return ifaceOption.value;
}
Expand All @@ -1904,8 +1902,7 @@ export function getClientOptionValue(
let ns = target.namespace;
while (ns) {
const nsOption = getScopedDecoratorData(context, clientOptionKey, ns) as
| { name: string; value: unknown }
| undefined;
{ name: string; value: unknown } | undefined;
if (nsOption?.name === optionName) {
return nsOption.value;
}
Expand Down
11 changes: 2 additions & 9 deletions packages/typespec-client-generator-core/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,7 @@ export interface SdkModelPropertyTypeBase<
}

export type ArrayKnownEncoding =
| "pipeDelimited"
| "spaceDelimited"
| "commaDelimited"
| "newlineDelimited";
"pipeDelimited" | "spaceDelimited" | "commaDelimited" | "newlineDelimited";

/**
* Options to show how to serialize a model/property.
Expand Down Expand Up @@ -920,11 +917,7 @@ export interface SdkBodyParameter extends SdkModelPropertyTypeBase {
}

export type SdkHttpParameter =
| SdkQueryParameter
| SdkPathParameter
| SdkBodyParameter
| SdkHeaderParameter
| SdkCookieParameter;
SdkQueryParameter | SdkPathParameter | SdkBodyParameter | SdkHeaderParameter | SdkCookieParameter;

export interface SdkMethodParameter extends SdkModelPropertyTypeBase {
kind: "method";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,15 +544,7 @@ export function getTypeDecorators(
function getDecoratorArgValue(
context: TCGCContext,
arg:
| Type
| Record<string, unknown>
| Value
| unknown[]
| string
| number
| boolean
| Numeric
| null,
Type | Record<string, unknown> | Value | unknown[] | string | number | boolean | Numeric | null,
type: Type,
decoratorName: string,
): [any, readonly Diagnostic[]] {
Expand Down
19 changes: 9 additions & 10 deletions packages/typespec-client-generator-core/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ function getSdkPagingServiceMethod<TServiceOperation extends SdkServiceOperation
baseServiceMethod.response,
);

baseServiceMethod.response.resultSegments = resultSegments?.map(
(resultSegment) => context.__modelPropertyCache.get(resultSegment)!,
baseServiceMethod.response.resultSegments = resultSegments?.map((resultSegment) =>
context.__modelPropertyCache.get(resultSegment)!,
);

context.__pagedResultSet.add(responseType);
Expand Down Expand Up @@ -254,14 +254,13 @@ function getSdkPagingServiceMethod<TServiceOperation extends SdkServiceOperation
context.program,
pagingMetadata.output.nextLink.property.type,
) ?? []
).map(
(t: ModelProperty) =>
getPropertySegmentsFromModelOrParameters(
baseServiceMethod.parameters,
(p) =>
p.__raw?.kind === "ModelProperty" &&
findRootSourceProperty(p.__raw) === findRootSourceProperty(t),
)!,
).map((t: ModelProperty) =>
getPropertySegmentsFromModelOrParameters(
baseServiceMethod.parameters,
(p) =>
p.__raw?.kind === "ModelProperty" &&
findRootSourceProperty(p.__raw) === findRootSourceProperty(t),
)!,
)
: undefined,
},
Expand Down
3 changes: 1 addition & 2 deletions packages/typespec-client-generator-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,7 @@ export function getSdkModelWithDiagnostics(
const rawBaseModel = getLegacyHierarchyBuilding(context, type) || type.baseModel;
if (rawBaseModel) {
sdkType.baseModel = context.__referencedTypeCache.get(rawBaseModel) as
| SdkModelType
| undefined;
SdkModelType | undefined;

if (sdkType.baseModel === undefined) {
// Use "AdditionalProperty" label for Record base models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1203,16 +1203,14 @@ describe("Parameter", () => {

// The foo method should NOT have subscriptionId as a method parameter (it's on client)
const fooMethod = client.methods.find((m) => m.name === "foo") as
| SdkServiceMethod<SdkHttpOperation>
| undefined;
SdkServiceMethod<SdkHttpOperation> | undefined;
ok(fooMethod);
const fooSubIdMethodParam = fooMethod.parameters.find((p) => p.name === "subscriptionId");
ok(!fooSubIdMethodParam);

// The bar method SHOULD have subscriptionId as a method parameter (moved to method level)
const barMethod = client.methods.find((m) => m.name === "bar") as
| SdkServiceMethod<SdkHttpOperation>
| undefined;
SdkServiceMethod<SdkHttpOperation> | undefined;
ok(barMethod);
const barSubIdMethodParam = barMethod.parameters.find((p) => p.name === "subscriptionId");
ok(barSubIdMethodParam);
Expand Down
Loading
Loading