-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
mcgallan
wants to merge
38
commits into
Azure:main
Choose a base branch
from
mcgallan:Convert-Help
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Convert Help swagger to Tsp #34311
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
20f0974
generated swagger
mcgallan 97e1a12
update
mcgallan c663650
update
e120a21
update
mcgallan d4acf4a
update
mcgallan f3db964
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
4f56310
update
1a5b435
update
198040e
Merge remote-tracking branch 'upstream/main' into Convert-Help
mcgallan 22d4e0b
Merge branch 'Convert-Help' of https://github.com/mcgallan/azure-rest…
mcgallan 6008496
update
mcgallan 4387328
update
mcgallan 5c35c61
fix name
mcgallan e0f26af
Merge branch 'main' into Convert-Help
mcgallan f25be95
fix
mcgallan 0851c57
update
mcgallan 6f24fab
Merge remote-tracking branch 'upstream/main' into Convert-Help
melina5656 f253cd6
update
melina5656 717789e
update
melina5656 12a4cf2
Merge branch 'main' into Convert-Help
mcgallan 59ee95e
Merge branch 'main' into Convert-Help
v-jiaodi 22a8536
Merge branch 'main' into Convert-Help
mcgallan 68a0ec9
update
mcgallan 687feac
Merge branch 'main' into Convert-Help
v-jiaodi 572dbd8
Delete conditionalClientFlatten
melina5656 e7cccf8
update
mcgallan b8a5ea9
update
mcgallan b882ac8
update justification
melina5656 68d91b6
update
mcgallan e4a0293
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
62f7345
upddate
117faec
Merge branch 'Convert-Help' of https://github.com/mcgallan/azure-rest…
9325d21
Merge remote-tracking branch 'upstream/main' into Convert-Help
mcgallan 0c7b36f
update
mcgallan b1f9b17
Merge remote-tracking branch 'upstream/main' into Convert-Help
mcgallan 72dd46d
wait fix
mcgallan a3c38ec
Merge branch 'main' into Convert-Help
v-jiaodi 1d03b6f
update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
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
78
specification/help/Help.Management/SimplifiedSolutionsResource.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
111
specification/help/Help.Management/SolutionResource.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
43
specification/help/Help.Management/SolutionResourceSelfHelp.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please fix all 'FIXME' comments in the PR by replacing them with real suppression reasons, or eliminating the suppression.