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

add a cache for parameters/responses/operations #6030

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remove all references for isResourceParameter in the csharp part
  • Loading branch information
ArcturusZhang committed Feb 17, 2025
commit 9d4bcb4ac88ac07d23e8d892e71d0afae0b82230
Original file line number Diff line number Diff line change
@@ -456,7 +456,6 @@ private static IReadOnlyList<ParameterProvider> BuildSpreadParametersForModel(In
false,
false,
false,
false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO - this part is not quite correct to do.
We should not be constructing any input types since we are out of the input library construction.
Instead, this part I think we should

  1. Build the spread model and get its corresponding ModelProvider.
  2. "Spread" it into parameters from ModelProvider and directly get its corresponding ParameterProvider.

I will create an issue later to track this.

null,
null);

Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ public void PreVisitsMethods()
var inputModelProperty = InputFactory.Property("prop1", InputPrimitiveType.Any, isRequired: true, isReadOnly: true);
var inputModel = InputFactory.Model("foo", access: "internal", usage: InputModelTypeUsage.Input, properties: [inputModelProperty]);

var param = InputFactory.Parameter("param", InputFactory.Literal.String("bar"), location: RequestLocation.Header, isRequired: true, isResourceParameter: true);
var param = InputFactory.Parameter("param", InputFactory.Literal.String("bar"), location: RequestLocation.Header, isRequired: true);
var inputOperation = InputFactory.Operation("testOperation", parameters: [param], responses: [InputFactory.OperationResponse(bodytype: InputPrimitiveType.Any)]);
var inputClient = InputFactory.Client("fooClient", operations: [inputOperation], parameters: [param]);
_mockInputLibrary.Setup(l => l.InputNamespace).Returns(InputFactory.Namespace(
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ public InputParameter(
InputOperationParameterKind kind,
bool isRequired,
bool isApiVersion,
bool isResourceParameter,
bool isContentType,
bool isEndpoint,
bool skipUrlEncoding,
@@ -38,7 +37,6 @@ public InputParameter(
Kind = kind;
IsRequired = isRequired;
_isApiVersion = isApiVersion;
IsResourceParameter = isResourceParameter;
IsContentType = isContentType;
IsEndpoint = isEndpoint;
SkipUrlEncoding = skipUrlEncoding;
@@ -57,7 +55,6 @@ public InputParameter(
public InputOperationParameterKind Kind { get; }
public bool IsRequired { get; }
public bool IsApiVersion => _isApiVersion || Type is InputEnumType enumType && enumType.Usage.HasFlag(InputModelTypeUsage.ApiVersionEnum);
public bool IsResourceParameter { get; }
public bool IsContentType { get; }
public bool IsEndpoint { get; }
public bool SkipUrlEncoding { get; }
Original file line number Diff line number Diff line change
@@ -38,7 +38,6 @@ public static InputParameter CreateInputParameter(ref Utf8JsonReader reader, str
string? kind = null;
bool isRequired = false;
bool isApiVersion = false;
bool isResourceParameter = false;
bool isContentType = false;
bool isEndpoint = false;
bool skipUrlEncoding = false;
@@ -59,7 +58,6 @@ public static InputParameter CreateInputParameter(ref Utf8JsonReader reader, str
|| reader.TryReadString(nameof(InputParameter.Kind), ref kind)
|| reader.TryReadBoolean(nameof(InputParameter.IsRequired), ref isRequired)
|| reader.TryReadBoolean(nameof(InputParameter.IsApiVersion), ref isApiVersion)
|| reader.TryReadBoolean(nameof(InputParameter.IsResourceParameter), ref isResourceParameter)
|| reader.TryReadBoolean(nameof(InputParameter.IsContentType), ref isContentType)
|| reader.TryReadBoolean(nameof(InputParameter.IsEndpoint), ref isEndpoint)
|| reader.TryReadBoolean(nameof(InputParameter.SkipUrlEncoding), ref skipUrlEncoding)
@@ -106,7 +104,6 @@ public static InputParameter CreateInputParameter(ref Utf8JsonReader reader, str
kind: parameterKind,
isRequired: isRequired,
isApiVersion: isApiVersion,
isResourceParameter: isResourceParameter,
isContentType: isContentType,
isEndpoint: isEndpoint,
skipUrlEncoding: skipUrlEncoding,
Original file line number Diff line number Diff line change
@@ -78,7 +78,6 @@ public static InputParameter Parameter(
bool isRequired = false,
InputOperationParameterKind kind = InputOperationParameterKind.Method,
bool isEndpoint = false,
bool isResourceParameter = false,
bool isContentType = false,
bool isApiVersion = false,
bool explode = false,
@@ -95,7 +94,6 @@ public static InputParameter Parameter(
kind,
isRequired,
isApiVersion,
isResourceParameter,
isContentType,
isEndpoint,
false,
Loading
Oops, something went wrong.