Skip to content

Update for optional action body #34701

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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 .github/actions/setup-node-install-deps/action.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Setup Node and install dependencies

Check failure on line 1 in .github/actions/setup-node-install-deps/action.yaml

View workflow job for this annotation

GitHub Actions / Protected Files

File '.github/actions/setup-node-install-deps/action.yaml' should only be updated by the Azure SDK team. If intentional, the PR may be merged by the Azure SDK team via bypassing the branch protections.
description: Uses specified Node version and installs dependencies (typically using "npm")

inputs:
Expand All @@ -7,7 +7,7 @@
default: 22.x
install-command:
description: 'Command to install dependencies'
default: 'npm ci'
default: 'npm i --no-package-lock --force'
working-directory:
description: 'Working directory'
default: '.'
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{

Check failure on line 1 in package.json

View workflow job for this annotation

GitHub Actions / Protected Files

File 'package.json' should only be updated by the Azure SDK team. If intentional, the PR may be merged by the Azure SDK team via bypassing the branch protections.
"name": "azure-rest-api-specs",
"devDependencies": {
"@azure-tools/spec-gen-sdk": "~0.6.1",
"@azure-tools/specs-shared": "file:.github/shared",
"@azure-tools/typespec-apiview": "0.7.2",
"@azure-tools/typespec-autorest": "0.56.0",
"@azure-tools/typespec-autorest": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNDg2Njc4MS9hcnRpZmFjdE5hbWUvcGFja2FnZXM1/content?format=file&subPath=%2Fazure-tools-typespec-autorest-0.57.0-pr-2674.20250514.10.tgz",
"@azure-tools/typespec-azure-core": "0.56.0",
"@azure-tools/typespec-azure-portal-core": "0.56.0",
"@azure-tools/typespec-azure-resource-manager": "0.56.0",
"@azure-tools/typespec-azure-rulesets": "0.56.0",
"@azure-tools/typespec-azure-portal-core": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNDg2Njc4MS9hcnRpZmFjdE5hbWUvcGFja2FnZXM1/content?format=file&subPath=%2Fazure-tools-typespec-azure-portal-core-0.57.0-pr-2674.20250514.10.tgz",
"@azure-tools/typespec-azure-resource-manager": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNDg2Njc4MS9hcnRpZmFjdE5hbWUvcGFja2FnZXM1/content?format=file&subPath=%2Fazure-tools-typespec-azure-resource-manager-0.57.0-pr-2674.20250514.10.tgz",
"@azure-tools/typespec-azure-rulesets": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNDg2Njc4MS9hcnRpZmFjdE5hbWUvcGFja2FnZXM1/content?format=file&subPath=%2Fazure-tools-typespec-azure-rulesets-0.57.0-pr-2674.20250514.10.tgz",
"@azure-tools/typespec-client-generator-cli": "0.21.0",
"@azure-tools/typespec-client-generator-core": "0.56.2",
"@azure-tools/typespec-liftr-base": "0.8.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ interface ApiDefinitions {
importSpecification is ArmResourceActionAsync<
ApiDefinition,
ApiSpecImportRequest,
ApiImportSuccess
ApiImportSuccess,
BodyParameter = {
#suppress "deprecated" "Avoid ModelValidation issues"
@encodedName("application/json", "payload")
@doc("The content of the action request")
@bodyRoot
body: ApiSpecImportRequest;
}
>;
@doc("Exports the API specification.")
exportSpecification is ArmResourceActionAsync<
Expand Down
9 changes: 8 additions & 1 deletion specification/apicenter/ApiCenter.Management/Service.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ interface Services {
exportMetadataSchema is ArmResourceActionAsync<
Service,
MetadataSchemaExportRequest,
MetadataSchemaExportResult
MetadataSchemaExportResult,
BodyParameter = {
#suppress "deprecated" "Avoid ModelValidation issues"
@encodedName("application/json", "payload")
@doc("The content of the action request")
@bodyRoot
body: MetadataSchemaExportRequest;
}
>;
}
21 changes: 0 additions & 21 deletions specification/apicenter/ApiCenter.Management/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,6 @@ enum Versions {
);
@@clientName(Workspaces.createOrUpdate::parameters.resource, "payload");

#suppress "deprecated" "LEGACY - DO NOT COPY THIS DOESN'T MAKE SENSE - FIX"
@@encodedName(ApiDefinitions.importSpecification::parameters.body,
"application/json",
"payload"
);

@@encodedName(ApiDefinitions.exportSpecification::parameters.body,
"application/json",
"payload"
);

@@clientName(ApiDefinitions.exportSpecification::parameters.body, "payload");

#suppress "deprecated" "LEGACY - DO NOT COPY THIS DOESN'T MAKE SENSE - FIX"
@@encodedName(Services.exportMetadataSchema::parameters.body,
"application/json",
"payload"
);

@@clientName(Services.exportMetadataSchema::parameters.body, "payload");

@@visibility(Azure.Core.Page.nextLink, Lifecycle.Read);
@@visibility(Azure.Core.Page.value, Lifecycle.Read);
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "./ReportResource.tsp";
using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using OpenAPI;
using Azure.ClientGenerator.Core;

namespace Microsoft.AppComplianceAutomation;
Expand Down Expand Up @@ -47,8 +46,6 @@ interface Evidence {
/**
* Get the evidence metadata
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Evidence_Get")
get is ArmResourceRead<
EvidenceResource,
{
Expand All @@ -59,8 +56,6 @@ interface Evidence {
/**
* Create or Update an evidence a specified report
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Evidence_CreateOrUpdate")
createOrUpdate is ArmResourceCreateOrReplaceSync<
EvidenceResource,
{
Expand All @@ -72,15 +67,11 @@ interface Evidence {
/**
* Delete an existent evidence from a specified report
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Evidence_Delete")
delete is ArmResourceDeleteSync<EvidenceResource>;

/**
* Returns a paginated list of evidences for a specified report.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Evidence_ListByReport")
listByReport is ArmResourceListByParent<
EvidenceResource,
{
Expand All @@ -92,23 +83,23 @@ interface Evidence {
/**
* Download evidence file.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Evidence_Download")
download is ArmResourceActionSync<
EvidenceResource,
EvidenceFileDownloadRequest,
EvidenceFileDownloadResponse
EvidenceFileDownloadResponse,
BodyParameter = {
#suppress "deprecated" "Avoid ModelValidation issues"
@encodedName("application/json", "parameters")
@doc("Parameters for the query operation")
@bodyRoot
body: EvidenceFileDownloadRequest;
}
>;
}

@@doc(Evidence.createOrUpdate::parameters.resource,
"Parameters for the create or update operation"
);
@@encodedName(Evidence.download::parameters.body,
"application/json",
"parameters"
);
@@doc(Evidence.download::parameters.body, "Parameters for the query operation");

#suppress "deprecated" "LEGACY - DO NOT COPY - FIX"
@@encodedName(Evidence.createOrUpdate::parameters.resource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ using Azure.ClientGenerator.Core;
using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using OpenAPI;
using Azure.Core;

namespace Microsoft.AppComplianceAutomation;
/**
Expand Down Expand Up @@ -47,16 +45,12 @@ interface Report {
/**
* Get the AppComplianceAutomation report and its properties.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Report_Get")
get is ArmResourceRead<ReportResource>;

/**
* Create a new AppComplianceAutomation report or update an exiting AppComplianceAutomation report.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE"
@operationId("Report_CreateOrUpdate")
@Azure.Core.useFinalStateVia("azure-async-operation")
createOrUpdate is ArmResourceCreateOrReplaceAsync<
ReportResource,
Expand All @@ -67,9 +61,7 @@ interface Report {
/**
* Update an exiting AppComplianceAutomation report.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@patch(#{ implicitOptionality: false })
@operationId("Report_Update")
update is ArmCustomPatchAsync<
ReportResource,
ReportResourcePatch,
Expand All @@ -79,8 +71,6 @@ interface Report {
/**
* Delete an AppComplianceAutomation report.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Report_Delete")
delete is ArmResourceDeleteWithoutOkAsync<
ReportResource,
Azure.ResourceManager.Foundations.BaseParameters<ReportResource>
Expand All @@ -89,8 +79,6 @@ interface Report {
/**
* Get the AppComplianceAutomation report list for the tenant.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Report_List")
list is ArmResourceListByParent<
ReportResource,
{
Expand All @@ -102,31 +90,40 @@ interface Report {
/**
* Synchronize attestation record from app compliance.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Report_SyncCertRecord")
syncCertRecord is ArmResourceActionAsync<
ReportResource,
SyncCertRecordRequest,
SyncCertRecordResponse,
Azure.ResourceManager.Foundations.BaseParameters<ReportResource>
Azure.ResourceManager.Foundations.BaseParameters<ReportResource>,
BodyParameter = {
#suppress "deprecated" "Avoid ModelValidation issues"
@encodedName("application/json", "parameters")
@doc("Parameters for synchronize certification record operation")
@bodyRoot
body: SyncCertRecordRequest;
}
>;

/**
* Checks the report's nested resource name availability, e.g: Webhooks, Evidences, Snapshots.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Report_NestedResourceCheckNameAvailability")
checkNameAvailability is ArmResourceActionSync<
@action("checkNameAvailability")
nestedResourceCheckNameAvailability is ArmResourceActionSync<
ReportResource,
Azure.ResourceManager.Foundations.CheckNameAvailabilityRequest,
Azure.ResourceManager.Foundations.CheckNameAvailabilityResponse
Azure.ResourceManager.Foundations.CheckNameAvailabilityResponse,
BodyParameter = {
#suppress "deprecated" "Avoid ModelValidation issues"
@encodedName("application/json", "parameters")
@doc("NameAvailabilityRequest object.")
@bodyRoot
body: Azure.ResourceManager.Foundations.CheckNameAvailabilityRequest;
}
>;

/**
* Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Report_Fix")
fix is ArmResourceActionAsync<
ReportResource,
void,
Expand All @@ -137,8 +134,6 @@ interface Report {
/**
* Fix the AppComplianceAutomation report error. e.g: App Compliance Automation Tool service unregistered, automation removed.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Report_GetScopingQuestions")
getScopingQuestions is ArmResourceActionSync<
ReportResource,
void,
Expand All @@ -149,8 +144,6 @@ interface Report {
/**
* Verify the AppComplianceAutomation report health status.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Report_Verify")
verify is ArmResourceActionAsync<
ReportResource,
void,
Expand All @@ -173,19 +166,9 @@ interface Report {
@@doc(Report.update::parameters.properties,
"Parameters for the create or update operation"
);
@@doc(Report.syncCertRecord::parameters.body,
"Parameters for synchronize certification record operation"
);
@@doc(Report.checkNameAvailability::parameters.body,
"NameAvailabilityRequest object."
);

#suppress "deprecated" "LEGACY - DO NOT COPY - FIX"
@@encodedName(Report.update::parameters.properties,
"application/json",
"parameters"
);

@@encodedName(Report.syncCertRecord::parameters.body,
"application/json",
"parameters"
);
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "../models/models.tsp";
import "./ReportResource.tsp";

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

namespace Microsoft.AppComplianceAutomation;
/**
Expand Down Expand Up @@ -45,15 +43,11 @@ interface Snapshot {
/**
* Get the AppComplianceAutomation snapshot and its properties.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Snapshot_Get")
get is ArmResourceRead<SnapshotResource>;

/**
* Get the AppComplianceAutomation snapshot list.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Snapshot_List")
list is ArmResourceListByParent<
SnapshotResource,
{
Expand All @@ -65,14 +59,17 @@ interface Snapshot {
/**
* Download compliance needs from snapshot, like: Compliance Report, Resource List.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "For backward compatibility"
@operationId("Snapshot_Download")
download is ArmResourceActionAsync<
SnapshotResource,
SnapshotDownloadRequest,
DownloadResponse,
Azure.ResourceManager.Foundations.BaseParameters<SnapshotResource>
Azure.ResourceManager.Foundations.BaseParameters<SnapshotResource>,
BodyParameter = {
#suppress "deprecated" "Avoid ModelValidation issues"
@encodedName("application/json", "parameters")
@doc("Parameters for the query operation")
@bodyRoot
body: SnapshotDownloadRequest;
}
>;
}

@@doc(Snapshot.download::parameters.body, "Parameters for the query operation");
Loading
Loading