-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Mgmt rest client #47665
base: main
Are you sure you want to change the base?
Mgmt rest client #47665
Conversation
{ | ||
type.Update(modifiers: TransfromModifiers(type), relativeFilePath: TransformRelativeFilePathForClient(type)); | ||
} | ||
//if (type is RestClientProvider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we make both client and restclient internal, all the models referenced will be internalized during the postprocess.
Once we have the resource and collection in place, public reference will be in place and the referenced models will be kept public.
So, keep restclient public for now to make the referenced models public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we put this comment as a comment in the code? just in case we could remember it and enable this piece in the future when we have the resource/collection types to keep those models public
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added TODO
...tp-client-csharp/generator/TestProjects/Local/Mgmt-TypeSpec/src/Generated/Foos.RestClient.cs
Show resolved
Hide resolved
.../TestProjects/Local/Mgmt-TypeSpec/src/Generated/RestOperations/PrivateLinksRestOperations.cs
Show resolved
Hide resolved
private static string TransformRelativeFilePathForRestClient(TypeProvider type) | ||
=> Path.Combine("src", "Generated", "RestOperations", $"{type.Name}.RestClient.cs"); | ||
|
||
private static TypeSignatureModifiers TransfromModifiers(TypeProvider type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should this be: TransformPublicToInternal or similar to be explicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
{ | ||
if (parameter.NameInRequest.Equals("subscriptionId", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
parameters.Add(new InputParameter(parameter.Name, parameter.NameInRequest, parameter.Summary, parameter.Doc, InputPrimitiveType.String, parameter.Location, parameter.DefaultValue, InputOperationParameterKind.Method, parameter.IsRequired, parameter.IsApiVersion, parameter.IsResourceParameter, parameter.IsContentType, parameter.IsEndpoint, parameter.SkipUrlEncoding, parameter.Explode, parameter.ArraySerializationDelimiter, parameter.HeaderCollectionPrefix)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need to change the type of subscriptionId back to string?
We do this in autorest.csharp because we want to minimize the changes to the old generator, since this is a new generator, we could cover the case that subscriptionId is a guid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not quite following here, change subscriptionId type will break the public contract.
Resolves #45830
SubscriptionId
to method parameter and type to string