Skip to content

Commit 1b9e813

Browse files
committed
Added support for external docs link in findmggraph command
1 parent 05b939d commit 1b9e813

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "autorest.powershell"]
22
path = autorest.powershell
33
url = https://github.com/microsoftgraph/autorest.powershell
4-
branch = powershell-v2
4+
branch = external-docs-support

src/Authentication/Authentication/Models/GraphCommand.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public class GraphCommand : IGraphCommand
7373
/// </summary>
7474
public string OutputType { get; set; }
7575
/// <summary>
76+
/// The response type of the command.
77+
/// </summary>
78+
public string ApiReferenceLink { get; set; }
79+
/// <summary>
7680
/// The parameter sets of the command.
7781
/// </summary>
7882
public string[] Variants { get; set; }

tools/PostGeneration/NewCommandMetadata.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ $CommandPathMapping = [ordered]@{}
3535

3636
# Regex patterns.
3737
$OpenApiTagPattern = '\[OpenAPI\].s*(.*)=>(.*):\"(.*)\"'
38+
$ExternalDocsPattern ='https://learn.microsoft.com/graph/api/(.*?(graph-rest-1.0|graph-rest-beta))'
3839
$ActionFunctionFQNPattern = "\/Microsoft.Graph.(.*)$"
3940
$PermissionsUrl = "https://graphexplorerapi.azurewebsites.net/permissions"
4041

@@ -51,7 +52,6 @@ $ApiVersion | ForEach-Object {
5152
if ($_.DirectoryName -match "\\src\\(.*?.)\\") {
5253
$ModuleName = ($CurrentApiVersion -eq "beta") ? "Beta.$($Matches.1)" : $Matches.1
5354
}
54-
5555
$RawFileContent = (Get-Content -Path $_.FullName -Raw)
5656
if ($RawFileContent -match $OpenApiTagPattern) {
5757
$Method = $Matches.2
@@ -81,6 +81,7 @@ $ApiVersion | ForEach-Object {
8181
ApiVersion = $CurrentApiVersion
8282
OutputType = ($RawFileContent -match $OutputTypePattern) ? $Matches.1 : $null
8383
Module = $ModuleName
84+
ApiReferenceLink = ($RawFileContent -match $ExternalDocsPattern) ? $Matches.0 : $null
8485
Permissions = @()
8586
}
8687

0 commit comments

Comments
 (0)