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

refactor(http-client-csharp): dump deprecated description properties #5154

Merged
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
1e5d06c
refactor(http-client-csharp): remove `filter-out-core-models` option
Nov 20, 2024
0da80d7
fix format
Nov 20, 2024
a2fc591
regen test projects
Nov 20, 2024
0a8f988
Merge branch 'main' into http-client-csharp/adopt-tcgc-doc-properties
Nov 20, 2024
b7b3147
regen tspCodeModel.json for cadl-ranch test cases
Nov 20, 2024
496fc43
replace "" with string.Empty
Nov 21, 2024
40879b8
Merge branch 'main' into http-client-csharp/adopt-tcgc-doc-properties
Nov 21, 2024
d8b4fca
regen resiliency case
Nov 21, 2024
00efb01
update InputClient of which description property is not used
Nov 22, 2024
a582d1e
update InputEnumType
Nov 22, 2024
1b72c72
update InputEnumTypeValue
Nov 22, 2024
57d10e2
update `OperationResponseHeader`
Nov 25, 2024
ac27502
update `InputOperation`
Nov 25, 2024
3bfafa9
update `InputParameter`
Nov 25, 2024
dd7899c
update `InputModelType`
Nov 25, 2024
d51c152
Update `InputModelPropert`
Nov 25, 2024
3c7d62c
refactor
Nov 25, 2024
1dd58ad
Merge branch 'main' into http-client-csharp/adopt-tcgc-doc-properties
Nov 25, 2024
7b04dbd
fix description generation issues
Nov 25, 2024
da3b374
fix missing constructor initialization of InputOperation
Nov 25, 2024
1af2548
fix enum provider name determination bug
Nov 25, 2024
3fe48e0
Merge branch 'main' into http-client-csharp/adopt-tcgc-doc-properties
archerzz Nov 26, 2024
bd84916
Merge branch 'main' into http-client-csharp/adopt-tcgc-doc-properties
archerzz Nov 28, 2024
cb97a0f
[http-spec] add link case of server driven pagination test (#5211)
tadelesh Nov 28, 2024
2de3e04
http-client-java, upgrade tcgc 0.48.3 (#5230)
weidongxu-microsoft Nov 29, 2024
49f768d
Remove unnecessary lazy for InputLibrary (#5232)
live1206 Dec 2, 2024
2d3fa45
Remove self dependency and fix security issue (#5229)
pshao25 Dec 2, 2024
0ecb66e
Fix typeChangedFrom of template/union to catch invalid versioning (#5…
chrisradek Dec 2, 2024
bfe3f9d
http-client-java, remove throw whenever possible (#5243)
weidongxu-microsoft Dec 3, 2024
099f0ed
[python] remove useless object inheritance (#5249)
iscai-msft Dec 3, 2024
b4de5b8
[python] bump version and add changeset (#5251)
iscai-msft Dec 3, 2024
0d45c78
[http-client-csharp] Generate all req. response classifiers (#5174)
jorgerangel-msft Dec 3, 2024
5f3b324
Revert "Fix typeChangedFrom of template/union to catch invalid versio…
chrisradek Dec 3, 2024
f6a7c4d
[http-client-csharp] Add Flatten api to MethodBodyStatement (#5254)
jorgerangel-msft Dec 4, 2024
6c4b8cc
[EngSys] Update Package Version (#5267)
jsquire Dec 4, 2024
2000802
Add RegEx validation for @pattern decorator (#5252)
allenjzhang Dec 4, 2024
f045c0e
[http-client-csharp] use recursion for statement flattening (#5268)
jorgerangel-msft Dec 4, 2024
10188fc
Fix typeChangedFrom of template/union/tuple to catch invalid versioni…
chrisradek Dec 5, 2024
547e1cc
http-client-java, generate error model for unbranded (#5209)
weidongxu-microsoft Dec 5, 2024
9acf5a6
http-client-java, do not generate model under models sub package, for…
weidongxu-microsoft Dec 5, 2024
b774459
[openapi3] Add missing peer dependency "openapi-types" (#5274)
mikeharder Dec 5, 2024
6e56b0e
[http-server-javascript] Two small correctness fixes (#5253)
witemple-msft Dec 5, 2024
6ab201f
Adopt versioning Cadl-Ranch specs (#5273)
JoshLove-msft Dec 5, 2024
c52e937
http-client-java, remove extra shadowing if all polymorphic models ar…
XiaofeiCao Dec 6, 2024
ace5b98
http-client-java, add HttpLoggingPolicy to unbranded (#5281)
weidongxu-microsoft Dec 6, 2024
899cad2
[http-python-client] filter out credential that python does not suppo…
tadelesh Dec 6, 2024
444e5fa
[http-client-python] refine exception handling logic (#5270)
tadelesh Dec 6, 2024
67f7e0d
http-client-java, fix expandable enum `equals` (#5283)
XiaofeiCao Dec 6, 2024
4197f48
[http-client-csharp] split srv-driven cadl ranch directory (#5277)
jorgerangel-msft Dec 6, 2024
f1f5609
[@typespec/http-specs] Add Installation Scripts to typespec repositor…
sarangan12 Dec 6, 2024
74affd3
docs: Fix getting-started.md docs link (#5264)
Adam0Brien Dec 6, 2024
d5fc978
Support non-kebab-case directories for cadl-ranch scenarios (#5286)
JoshLove-msft Dec 6, 2024
dbe4ae3
C-sharp Service emitter: Fix nullable types, anonymous types, and saf…
markcowl Dec 6, 2024
0a4c148
Fix to cadlranch attribute (#5291)
JoshLove-msft Dec 7, 2024
d052e51
Add 1_0_E2E label (#5292)
allenjzhang Dec 7, 2024
aa1905e
bump http-client-python to 0.4.0 (#5284)
tadelesh Dec 9, 2024
1ea5a26
[python] ignore final envelope result models for DI (#5290)
iscai-msft Dec 9, 2024
f855747
[http-spec] Update Versioning/Removed Project And Removed Type/Model/…
mcgallan Dec 9, 2024
c6aca74
[http-client-python] fix vanilla legacy test (#5306)
tadelesh Dec 9, 2024
df1ada0
Release http specs alpha4 (#5303)
sarangan12 Dec 9, 2024
b6eeae6
docs: fix incorrect default (#5257)
TomerAberbach Dec 9, 2024
bd54d22
http-client-java, fix client accessor method parameter description (#…
XiaofeiCao Dec 10, 2024
12b540c
[python] add lint check for src code in CI (#5320)
msyyc Dec 10, 2024
ee7e8a5
[@typespec/spector] Update start server scenario paths (#5309)
sarangan12 Dec 10, 2024
c5d9eeb
Delete XML cadl-ranch projects (#5324)
JoshLove-msft Dec 10, 2024
00a68dc
Add release notes for December 2024 release (#5323)
markcowl Dec 10, 2024
905d9d8
Prepare Publish for December Release (#5329)
markcowl Dec 11, 2024
41604fa
Redirect compiler trace to IDE through language server (#5316)
RodgeFu Dec 11, 2024
55dbedf
Rename vscode extension typespec (#5314)
RodgeFu Dec 11, 2024
b715773
[typespec-vscode] expose linter rule documentation url in codefixes (…
mzhongl524 Dec 11, 2024
6bff0a3
bump TCGC version to 0.48.4 (#5260)
ArcturusZhang Dec 11, 2024
071284e
http-client-java, fix eclipse languageserver when tmp folder is corru…
XiaofeiCao Dec 11, 2024
daa148b
http-client-java, bump typespec libs (#5317)
weidongxu-microsoft Dec 11, 2024
ba1fbb9
Update JS API parser to install from local feed (#5285)
praveenkuttappan Dec 11, 2024
5725b25
[http-client-csharp] fix: enable cadl ranch coverage for srvdriven te…
jorgerangel-msft Dec 11, 2024
bc44486
Add cancellation token parameter to sync convenience methods (#5337)
JoshLove-msft Dec 11, 2024
176e1f3
http-client-java, doc, require JDK 17 (#5333)
weidongxu-microsoft Dec 12, 2024
0f90b9a
Update FormatLines in XmlDocStatement.cs to handle line breaks (#5214)
nisha-bhatia Dec 12, 2024
154ea89
Move setting retrieval into constructor (#5338)
alzimmermsft Dec 12, 2024
eb14584
bump TCGC version to 0.48.6 (#5331)
ArcturusZhang Dec 12, 2024
c3acb53
http-client-java, map typespec.rest.resource model to sdk base namesp…
weidongxu-microsoft Dec 12, 2024
c586df2
http-client-java, unify branded/unbranded ExpandableEnum (#5334)
XiaofeiCao Dec 12, 2024
1d013d1
http-client-java, remove code of convert contentType to header param …
weidongxu-microsoft Dec 12, 2024
a00e4e2
[python] bump tsp 0.63.0 (#5352)
msyyc Dec 13, 2024
971dbbe
http-client-java, migrate to http-specs (#5215)
weidongxu-microsoft Dec 13, 2024
9b51b0b
`typespec` repository - Upload Manifest file to the new storage accou…
sarangan12 Dec 13, 2024
cf8b019
[http-client-csharp] Bump typespec version to 0.63.0 (#5354)
ArcturusZhang Dec 16, 2024
e6df27f
Adopt http/special-headers/conditional-request from cadl ranch (#5318)
ArcturusZhang Dec 16, 2024
9454da5
introduce the abstraction for tokencredential type and keycredential …
ArcturusZhang Dec 16, 2024
fc89973
http-client-java, validate JDK and Maven (#5374)
weidongxu-microsoft Dec 17, 2024
e02766e
Merge branch 'main' into http-client-csharp/adopt-tcgc-doc-properties
Dec 17, 2024
61feb92
bump pnpm-lock
Dec 17, 2024
8d5c4c2
bump pnpm-lock
Dec 17, 2024
3559a7b
remove unnecessary changes
Dec 17, 2024
a54a5fe
Merge branch 'main' into http-client-csharp/adopt-tcgc-doc-properties
archerzz Dec 17, 2024
f666ee3
roll back pnpn-lock
Dec 18, 2024
6efc0f8
[Python] Fix incorrect code escape in M2R (#5373)
lmazuel Dec 17, 2024
f342693
[@typespec/spec-dashboard] Deploy Spec Dashboard (#5381)
sarangan12 Dec 17, 2024
e9d42b3
[@typespec/spec-dashboard] Release Spec Dashboard (#5397)
sarangan12 Dec 17, 2024
27f0bef
[@typespec/spec-dashboard] Add Account Name to the script (#5398)
sarangan12 Dec 18, 2024
d79c532
publish vscode artifact and display in pr comment for try-it (#5206)
chunyu3 Dec 18, 2024
486bb76
Merge branch 'main' into http-client-csharp/adopt-tcgc-doc-properties
archerzz Dec 18, 2024
e7c11f4
regen
Dec 18, 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
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 @@ -181,7 +182,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 @@ -202,7 +204,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 @@ -252,7 +254,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,
ArcturusZhang marked this conversation as resolved.
Show resolved Hide resolved
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;
}
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
using Microsoft.Generator.CSharp.Input;
using Microsoft.Generator.CSharp.Primitives;
using Microsoft.Generator.CSharp.Providers;
using Microsoft.Generator.CSharp.Utilities;
using static Microsoft.Generator.CSharp.Snippets.Snippet;
using System.ClientModel.Primitives;

namespace Microsoft.Generator.CSharp.ClientModel.Providers
{
Expand Down Expand Up @@ -125,9 +125,10 @@ protected override PropertyProvider[] BuildProperties()
if (!p.IsEndpoint && !p.IsApiVersion && p.DefaultValue != null)
{
FormattableString? description = null;
if (p.Description != null)
var parameterDescription = DocHelpers.GetDescription(p.Summary, p.Doc);
if (parameterDescription is not null)
{
description = $"{p.Description}";
description = $"{parameterDescription}";
}

var type = ClientModelPlugin.Instance.TypeFactory.CreateCSharpType(p.Type)?.PropertyInitializationType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ private static IReadOnlyList<ParameterProvider> BuildSpreadParametersForModel(In
var inputParameter = new InputParameter(
property.Name,
property.SerializedName,
property.Description,
property.Summary,
property.Doc,
property.Type,
RequestLocation.Body,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Microsoft.Generator.CSharp.Providers;
using Microsoft.Generator.CSharp.Snippets;
using Microsoft.Generator.CSharp.Statements;
using Microsoft.Generator.CSharp.Utilities;
using static Microsoft.Generator.CSharp.Snippets.Snippet;

namespace Microsoft.Generator.CSharp.ClientModel.Providers
Expand Down Expand Up @@ -71,7 +72,7 @@ private ScmMethodProvider BuildConvenienceMethod(MethodProvider protocolMethod,

var methodSignature = new MethodSignature(
isAsync ? _cleanOperationName + "Async" : _cleanOperationName,
FormattableStringHelpers.FromString(Operation.Description),
DocHelpers.GetFormattableDescription(Operation.Summary, Operation.Doc) ?? FormattableStringHelpers.FromString(Operation.Name),
methodModifier,
GetResponseType(Operation.Responses, true, isAsync, out var responseBodyType),
null,
Expand Down Expand Up @@ -424,7 +425,7 @@ private ScmMethodProvider BuildProtocolMethod(MethodProvider createRequestMethod

var methodSignature = new MethodSignature(
isAsync ? _cleanOperationName + "Async" : _cleanOperationName,
FormattableStringHelpers.FromString(Operation.Description),
DocHelpers.GetFormattableDescription(Operation.Summary, Operation.Doc) ?? FormattableStringHelpers.FromString(Operation.Name),
archerzz marked this conversation as resolved.
Show resolved Hide resolved
methodModifier,
GetResponseType(Operation.Responses, false, isAsync, out _),
$"The response returned from the service.",
Expand All @@ -450,7 +451,7 @@ private ScmMethodProvider BuildProtocolMethod(MethodProvider createRequestMethod
new XmlDocStatement("item", [], new XmlDocStatement("description", [$"This <see href=\"https://aka.ms/azsdk/net/protocol-methods\">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios."]))
];
XmlDocStatement listXmlDoc = new XmlDocStatement("<list type=\"bullet\">", "</list>", [], innerStatements: [.. listItems]);
protocolMethod.XmlDocs!.Summary = new XmlDocSummaryStatement([$"[Protocol Method] {Operation.Description}"], listXmlDoc);
protocolMethod.XmlDocs!.Summary = new XmlDocSummaryStatement([$"[Protocol Method] {DocHelpers.GetDescription(Operation.Summary, Operation.Doc) ?? Operation.Name}"], listXmlDoc);
}
return protocolMethod;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ namespace Microsoft.Generator.CSharp.ClientModel.Tests.Providers.ClientProviders
public class ClientProviderSubClientTests
{
private const string TestClientName = "TestClient";
private static readonly InputClient _animalClient = new("animal", "AnimalClient description", [], [], TestClientName);
private static readonly InputClient _dogClient = new("dog", "DogClient description", [], [], _animalClient.Name);
private static readonly InputClient _catClient = new("cat", "CatClient description", [], [], _animalClient.Name);
private static readonly InputClient _hawkClient = new("hawkClient", "HawkClient description", [], [], _animalClient.Name);
private static readonly InputClient _huskyClient = new("husky", "HuskyClient description", [], [], _dogClient.Name);
private static readonly InputClient _animalClient = new("animal", string.Empty, "AnimalClient description", [], [], TestClientName);
private static readonly InputClient _dogClient = new("dog", string.Empty, "DogClient description", [], [], _animalClient.Name);
private static readonly InputClient _catClient = new("cat", string.Empty, "CatClient description", [], [], _animalClient.Name);
private static readonly InputClient _hawkClient = new("hawkClient", string.Empty, "HawkClient description", [], [], _animalClient.Name);
private static readonly InputClient _huskyClient = new("husky", string.Empty, "HuskyClient description", [], [], _dogClient.Name);

[SetUp]
public void SetUp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public class ClientProviderTests
{
private const string SubClientsCategory = "WithSubClients";
private const string TestClientName = "TestClient";
private static readonly InputClient _animalClient = new("animal", "AnimalClient description", [], [], TestClientName);
private static readonly InputClient _dogClient = new("dog", "DogClient description", [], [], _animalClient.Name);
private static readonly InputClient _huskyClient = new("husky", "HuskyClient description", [], [], _dogClient.Name);
private static readonly InputClient _animalClient = new("animal", "", "AnimalClient description", [], [], TestClientName);
private static readonly InputClient _dogClient = new("dog", "", "DogClient description", [], [], _animalClient.Name);
private static readonly InputClient _huskyClient = new("husky", "", "HuskyClient description", [], [], _dogClient.Name);
private static readonly InputModelType _spreadModel = InputFactory.Model(
"spreadModel",
usage: InputModelTypeUsage.Spread,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,10 @@ public void TestIntSerializationStatement(
var name = kind.ToString().ToLower();
var properties = new List<InputModelProperty>
{
new InputModelProperty("requiredInt", "requiredInt", "", new InputPrimitiveType(kind, name, $"TypeSpec.{name}", encode), true, false, false),
new InputModelProperty("requiredInt", "requiredInt", "", "", new InputPrimitiveType(kind, name, $"TypeSpec.{name}", encode), true, false, false),
};

var inputModel = new InputModelType("TestModel", "TestModel", "public", null, "Test model.", InputModelTypeUsage.Input, properties, null, Array.Empty<InputModelType>(), null, null, new Dictionary<string, InputModelType>(), null, false);
var inputModel = new InputModelType("TestModel", "TestModel", "public", null, "", "Test model.", InputModelTypeUsage.Input, properties, null, Array.Empty<InputModelType>(), null, null, new Dictionary<string, InputModelType>(), null, false);

var (_, serialization) = CreateModelAndSerialization(inputModel);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ public class InputClient
private readonly string? _key;
private IReadOnlyDictionary<string, InputClientExample>? _examples;

public InputClient(string name, string description, IReadOnlyList<InputOperation> operations, IReadOnlyList<InputParameter> parameters, string? parent)
public InputClient(string name, string? summary, string? doc, IReadOnlyList<InputOperation> operations, IReadOnlyList<InputParameter> parameters, string? parent)
{
Name = name;
Description = description;
Summary = summary;
Doc = doc;
Operations = operations;
Parameters = parameters;
Parent = parent;
}

public InputClient() : this(string.Empty, string.Empty, Array.Empty<InputOperation>(), Array.Empty<InputParameter>(), null) { }
public InputClient() : this(string.Empty, string.Empty, string.Empty, Array.Empty<InputOperation>(), Array.Empty<InputParameter>(), null) { }

public string Name { get; internal set; }
public string Description { get; internal set; }
public string? Summary { get; internal set; }
public string? Doc { get; internal set; }
public IReadOnlyList<InputOperation> Operations { get; internal set; }
public IReadOnlyList<InputParameter> Parameters { get; internal set; }
public string? Parent { get; internal set; }
Expand Down
Loading
Loading