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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using Azure.Generator.Management.Extensions;
using Azure.Generator.Management.Models;
using Azure.Generator.Management.Primitives;
using Azure.Generator.Management.Providers.OperationMethodProviders;
using Azure.Generator.Management.Snippets;
using Azure.Generator.Management.Utilities;
Expand Down Expand Up @@ -170,7 +171,7 @@ protected static MethodBodyStatement GetResourceDataStatements(
return Declare(
variableName,
resourceClientProvider.ResourceData.Type,
new TupleExpression(This.Invoke(getMethod, [cancellationTokenParam], null, isAsync))
new TupleExpression(This.Invoke(getMethod, [KnownAzureParameters.CancellationTokenWithoutDefault.PositionalReference(cancellationTokenParam)], null, isAsync))
.Property("Value").Property("Data"),
out currentVar);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,15 @@ public static IReadOnlyList<ValueExpression> PopulateArguments(
}
else
{
var methodParam = methodParameters.Single(p => p.WireInfo.SerializedName == parameter.WireInfo.SerializedName);
arguments.Add(Convert(methodParam, methodParam.Type, parameter.Type));
var methodParam = methodParameters.SingleOrDefault(p => p.WireInfo.SerializedName == parameter.WireInfo.SerializedName);
if (methodParam != null)
{
arguments.Add(Convert(methodParam, methodParam.Type, parameter.Type));
}
else
{
arguments.Add(Null);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
else
{
global::Samples.Models.ResponseTypeData current = (this.Get(cancellationToken)).Value.Data;
global::Samples.Models.ResponseTypeData current = (this.Get(cancellationToken: cancellationToken)).Value.Data;
global::Samples.Models.ResponseTypeData patch = new global::Samples.Models.ResponseTypeData();
foreach (global::System.Collections.Generic.KeyValuePair<string, string> tag in current.Tags)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
else
{
global::Samples.Models.ResponseTypeData current = (await this.GetAsync(cancellationToken).ConfigureAwait(false)).Value.Data;
global::Samples.Models.ResponseTypeData current = (await this.GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
global::Samples.Models.ResponseTypeData patch = new global::Samples.Models.ResponseTypeData();
foreach (global::System.Collections.Generic.KeyValuePair<string, string> tag in current.Tags)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
else
{
global::Samples.Models.ResponseTypeData current = (this.Get(cancellationToken)).Value.Data;
global::Samples.Models.ResponseTypeData current = (this.Get(cancellationToken: cancellationToken)).Value.Data;
global::Samples.Models.ResponseTypeData patch = new global::Samples.Models.ResponseTypeData();
foreach (global::System.Collections.Generic.KeyValuePair<string, string> tag in current.Tags)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
else
{
global::Samples.Models.ResponseTypeData current = (await this.GetAsync(cancellationToken).ConfigureAwait(false)).Value.Data;
global::Samples.Models.ResponseTypeData current = (await this.GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
global::Samples.Models.ResponseTypeData patch = new global::Samples.Models.ResponseTypeData();
foreach (global::System.Collections.Generic.KeyValuePair<string, string> tag in current.Tags)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
else
{
global::Samples.Models.ResponseTypeData current = (this.Get(cancellationToken)).Value.Data;
global::Samples.Models.ResponseTypeData current = (this.Get(cancellationToken: cancellationToken)).Value.Data;
global::Samples.Models.ResponseTypeData patch = new global::Samples.Models.ResponseTypeData();
patch.Tags.ReplaceWith(tags);
global::Azure.Response<global::Samples.ResponseTypeResource> result = this.Update(patch, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
else
{
global::Samples.Models.ResponseTypeData current = (await this.GetAsync(cancellationToken).ConfigureAwait(false)).Value.Data;
global::Samples.Models.ResponseTypeData current = (await this.GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
global::Samples.Models.ResponseTypeData patch = new global::Samples.Models.ResponseTypeData();
patch.Tags.ReplaceWith(tags);
global::Azure.Response<global::Samples.ResponseTypeResource> result = await this.UpdateAsync(patch, cancellationToken).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import "@typespec/rest";
import "@typespec/openapi";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";

namespace MgmtTypeSpec;

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;


model JobResource
is Azure.ResourceManager.TrackedResource<JobProperties, false> {
...ResourceNameParameter<
Resource = JobResource,
KeyName = "jobName",
SegmentName = "jobs",
NamePattern = "^[-\\w\\.]+$"
>;
}

model JobProperties {
jobName: string;
}

@armResourceOperations
interface JobResources {
/**
* Gets information about the specified job.
*/
get is ArmResourceRead<
JobResource,
Parameters = {
/**
* $expand is supported on details parameter for job, which provides details on the job stages.
*/
@query("$expand")
$expand?: string;
},
>;

#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-patch" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@patch(#{ implicitOptionality: false })
update is ArmCustomPatchAsync<
JobResource,
PatchModel = JobResourceUpdateParameter,
>;
}

model JobResourceUpdateParameter {
properties?: JobProperties;
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
tags?: Record<string>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "./routes.tsp";
import "./endpoint.tsp";
import "./selfhelp.tsp";
import "./playwright.tsp";
import "./databox.tsp";
using TypeSpec.Versioning;
using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading