Skip to content

Convert Help swagger to Tsp #34311

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 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
20f0974
generated swagger
mcgallan Apr 27, 2025
97e1a12
update
mcgallan Apr 29, 2025
c663650
update
Apr 29, 2025
e120a21
update
mcgallan Apr 29, 2025
d4acf4a
update
mcgallan May 7, 2025
f3db964
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
May 7, 2025
4f56310
update
May 7, 2025
1a5b435
update
May 8, 2025
198040e
Merge remote-tracking branch 'upstream/main' into Convert-Help
mcgallan May 8, 2025
22d4e0b
Merge branch 'Convert-Help' of https://github.com/mcgallan/azure-rest…
mcgallan May 8, 2025
6008496
update
mcgallan May 8, 2025
4387328
update
mcgallan May 8, 2025
5c35c61
fix name
mcgallan May 9, 2025
e0f26af
Merge branch 'main' into Convert-Help
mcgallan May 9, 2025
f25be95
fix
mcgallan May 9, 2025
0851c57
update
mcgallan May 9, 2025
6f24fab
Merge remote-tracking branch 'upstream/main' into Convert-Help
melina5656 May 19, 2025
f253cd6
update
melina5656 May 20, 2025
717789e
update
melina5656 May 20, 2025
12a4cf2
Merge branch 'main' into Convert-Help
mcgallan May 22, 2025
59ee95e
Merge branch 'main' into Convert-Help
v-jiaodi May 23, 2025
22a8536
Merge branch 'main' into Convert-Help
mcgallan May 30, 2025
68a0ec9
update
mcgallan May 30, 2025
687feac
Merge branch 'main' into Convert-Help
v-jiaodi Jun 3, 2025
572dbd8
Delete conditionalClientFlatten
melina5656 Jun 6, 2025
e7cccf8
update
mcgallan Jun 6, 2025
b8a5ea9
update
mcgallan Jun 10, 2025
b882ac8
update justification
melina5656 Jun 10, 2025
68d91b6
update
mcgallan Jun 12, 2025
e4a0293
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
Jun 16, 2025
62f7345
upddate
Jun 16, 2025
117faec
Merge branch 'Convert-Help' of https://github.com/mcgallan/azure-rest…
Jun 16, 2025
9325d21
Merge remote-tracking branch 'upstream/main' into Convert-Help
mcgallan Jun 19, 2025
0c7b36f
update
mcgallan Jun 19, 2025
b1f9b17
Merge remote-tracking branch 'upstream/main' into Convert-Help
mcgallan Jun 30, 2025
72dd46d
wait fix
mcgallan Jul 1, 2025
a3c38ec
Merge branch 'main' into Convert-Help
v-jiaodi Jul 2, 2025
1d03b6f
update
Jul 3, 2025
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
78 changes: 78 additions & 0 deletions specification/help/Help.Management/DiagnosticResource.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

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

namespace Microsoft.Help;
/**
* Diagnostic resource
*/
model DiagnosticResource
is Azure.ResourceManager.ExtensionResource<DiagnosticResourceProperties> {
...ResourceNameParameter<
Resource = DiagnosticResource,
KeyName = "diagnosticsResourceName",
SegmentName = "diagnostics",
NamePattern = "^[A-Za-z0-9-+@()_]+$"
>;
}

#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
Copy link
Member

Choose a reason for hiding this comment

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

Please fix all 'FIXME' comments in the PR by replacing them with real suppression reasons, or eliminating the suppression.

interface DiagnosticResourcesOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,

/**
* The fully qualified Azure Resource manager identifier of the resource.
*/
#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@path(#{ allowReserved: true })
scope: string,

...Azure.ResourceManager.Legacy.Provider,
},
{
/**
* Unique resource name for insight resources
*/
#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@path
@segment("diagnostics")
@minLength(1)
@maxLength(100)
@pattern("^[A-Za-z0-9-+@()_]+$")
diagnosticsResourceName: string,
}
> {}

#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@armResourceOperations
interface DiagnosticResources {
/**
* Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic.
*/
get is ArmResourceRead<DiagnosticResource>;

/**
* Creates a diagnostic for the specific resource using solutionId from discovery solutions. <br/>Diagnostics are powerful solutions that access product resources or other relevant data and provide the root cause of the issue and the steps to address the issue.<br/><br/>
*/
create is DiagnosticResourcesOps.CreateOrUpdateAsync<
DiagnosticResource,
OptionalRequestBody = true
>;
}

@@maxLength(DiagnosticResource.name, 100);
@@minLength(DiagnosticResource.name, 1);
@@doc(DiagnosticResource.name, "Unique resource name for insight resources");
@@doc(DiagnosticResource.properties, "Diagnostic Resource properties.");
@@doc(DiagnosticResources.create::parameters.resource,
"The required request body for this insightResource invocation."
);
78 changes: 78 additions & 0 deletions specification/help/Help.Management/SimplifiedSolutionsResource.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

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

namespace Microsoft.Help;
/**
* Simplified Solutions response.
*/
model SimplifiedSolutionsResource
is Azure.ResourceManager.ExtensionResource<SimplifiedSolutionsResourceProperties> {
...ResourceNameParameter<
Resource = SimplifiedSolutionsResource,
KeyName = "simplifiedSolutionsResourceName",
SegmentName = "simplifiedSolutions",
NamePattern = "^[A-Za-z0-9-+@()_]+$"
>;
}

#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
interface SimplifiedSolutionsResourcesOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,

/**
* The fully qualified Azure Resource manager identifier of the resource.
*/
#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@path(#{ allowReserved: true })
scope: string,

...Azure.ResourceManager.Legacy.Provider,
},
{
/**
* Simplified Solutions Resource Name.
*/
#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@path
@segment("simplifiedSolutions")
@minLength(1)
@maxLength(100)
@pattern("^[A-Za-z0-9-+@()_]+$")
simplifiedSolutionsResourceName: string,
}
> {}

#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@armResourceOperations
interface SimplifiedSolutionsResources {
/**
* Get the simplified Solutions using the applicable solutionResourceName while creating the simplified Solutions.
*/
get is ArmResourceRead<SimplifiedSolutionsResource>;

/**
* Creates Simplified Solutions for an Azure subscription using 'solutionId' from Discovery Solutions as the input. <br/><br/> Simplified Solutions API makes the consumption of solutions APIs easier while still providing access to the same powerful solutions rendered in Solutions API. With Simplified Solutions, users don't have to worry about stitching together the article using replacement maps and can use the content in the API response to directly render as HTML content.<br/>
*/
create is SimplifiedSolutionsResourcesOps.CreateOrUpdateAsync<
SimplifiedSolutionsResource,
OptionalRequestBody = true
>;
}

@@maxLength(SimplifiedSolutionsResource.name, 100);
@@minLength(SimplifiedSolutionsResource.name, 1);
@@doc(SimplifiedSolutionsResource.name, "Simplified Solutions Resource Name.");
@@doc(SimplifiedSolutionsResource.properties, "Simplified Solutions result");
@@doc(SimplifiedSolutionsResources.create::parameters.resource,
"The required request body for simplified Solutions resource creation."
);
111 changes: 111 additions & 0 deletions specification/help/Help.Management/SolutionResource.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

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

namespace Microsoft.Help;
/**
* Solution response.
*/
model SolutionResource
is Azure.ResourceManager.ExtensionResource<SolutionResourceProperties> {
...ResourceNameParameter<
Resource = SolutionResource,
KeyName = "solutionResourceName",
SegmentName = "solutions",
NamePattern = "^[A-Za-z0-9-+@()_]+$"
>;
}

#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
interface SolutionResourcesOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,

/**
* The fully qualified Azure Resource manager identifier of the resource.
*/
#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@path(#{ allowReserved: true })
scope: string,

...Azure.ResourceManager.Legacy.Provider,
},
{
/**
* Solution resource Name.
*/
#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@path
@segment("solutions")
@minLength(1)
@maxLength(100)
@pattern("^[A-Za-z0-9-+@()_]+$")
solutionResourceName: string,
}
> {}

#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@armResourceOperations
interface SolutionResources {
/**
* Get the solution using the applicable solutionResourceName while creating the solution.
*/
get is ArmResourceRead<SolutionResource>;

/**
* Creates a solution for the specific Azure resource or subscription using the inputs ‘solutionId and requiredInputs’ from discovery solutions. <br/> Azure solutions comprise a comprehensive library of self-help resources that have been thoughtfully curated by Azure engineers to aid customers in resolving typical troubleshooting issues. These solutions encompass: <br/> (1.) Dynamic and context-aware diagnostics, guided troubleshooting wizards, and data visualizations. <br/> (2.) Rich instructional video tutorials and illustrative diagrams and images. <br/> (3.) Thoughtfully assembled textual troubleshooting instructions. <br/> All these components are seamlessly converged into unified solutions tailored to address a specific support problem area.
*/
create is SolutionResourcesOps.CreateOrUpdateAsync<
SolutionResource,
OptionalRequestBody = true
>;

/**
* Update the requiredInputs or additional information needed to execute the solution
*/
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@patch(#{ implicitOptionality: false })
update is SolutionResourcesOps.CustomPatchAsync<
SolutionResource,
PatchModel = SolutionPatchRequestBody,
Response = ArmResourceUpdatedResponse<SolutionResource> | (ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader<FinalResult = SolutionResource>> & {
@bodyRoot
_: SolutionResource;
}),
OptionalRequestBody = true
>;

/**
* Warm up the solution resource by preloading asynchronous diagnostics results into cache
*/
@action("warmup")
warmUp is ArmResourceActionSync<
SolutionResource,
SolutionWarmUpRequestBody,
NoContentResponse,
OptionalRequestBody = true
>;
}

@@maxLength(SolutionResource.name, 100);
@@minLength(SolutionResource.name, 1);
@@doc(SolutionResource.name, "Solution resource Name.");
@@doc(SolutionResource.properties, "Solution result");
@@doc(SolutionResources.create::parameters.resource,
"The required request body for this solution resource creation."
);
@@doc(SolutionResources.update::parameters.properties,
"The required request body for updating a solution resource."
);
@@doc(SolutionResources.warmUp::parameters.body,
"The required request body for warming up a solution resource."
);
43 changes: 43 additions & 0 deletions specification/help/Help.Management/SolutionResourceSelfHelp.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

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

namespace Microsoft.Help;
/**
* Self Help Solution response.
*/
@tenantResource
model SolutionResourceSelfHelp
is Azure.ResourceManager.ProxyResource<SolutionsResourcePropertiesSelfHelp> {
...ResourceNameParameter<
Resource = SolutionResourceSelfHelp,
KeyName = "solutionId",
SegmentName = "selfHelp",
NamePattern = ""
>;
}

@armResourceOperations
interface SolutionResourceSelfHelps {
/**
* Gets Self Help Solutions for a given solutionId. Self Help Solutions consist of rich instructional video tutorials, links and guides to public documentation related to a specific problem that enables users to troubleshoot Azure issues.
*/
get is ArmResourceRead<
SolutionResourceSelfHelp,
BaseParameters = Azure.ResourceManager.Foundations.TenantBaseParameters
>;
}

@@maxLength(SolutionResourceSelfHelp.name, 100);
@@minLength(SolutionResourceSelfHelp.name, 1);
@@doc(SolutionResourceSelfHelp.name,
"SolutionId is a unique id to identify a solution. You can retrieve the solution id using the Discovery api - https://learn.microsoft.com/en-us/rest/api/help/discovery-solution/list?view=rest-help-2023-09-01-preview&tabs=HTTP"
);
@@doc(SolutionResourceSelfHelp.properties, "Solution result");
Loading
Loading