Skip to content

Commit 9ce9ab3

Browse files
authored
Request Object Property Cleanup (#560)
* Remove entity-id property from entities. * Add tests for New-MgInvitation. * Set user type to MicrosoftGraphUser in v1.0.
1 parent 94c3696 commit 9ce9ab3

File tree

8 files changed

+289
-48
lines changed

8 files changed

+289
-48
lines changed

src/Authentication/Authentication/ErrorConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal static class Codes
3838
internal static class Message
3939
{
4040
internal const string InvalidJWT = "Invalid JWT access token.";
41-
internal const string MissingAuthContext = "Authentication needed, call Connect-Graph.";
41+
internal const string MissingAuthContext = "Authentication needed, call Connect-MgGraph.";
4242
internal const string NullOrEmptyParameter = "Parameter '{0}' cannot be null or empty.";
4343
internal const string MacKeyChainFailed = "{0} failed with result code {1}.";
4444
internal const string DeviceCodeTimeout = "Device code terminal timed-out after {0} seconds. Please try again.";
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"ClientId": "56db239f-b87c-4dc0-9d9b-2ec0318e4ad9",
3+
"TenantId": "61fcf17f-000c-4ab8-a4dc-9e92405fc737",
4+
"Users": [
5+
{
6+
"Id": "85d17c69-6789-47c7-bf10-ad08ab4cd8da",
7+
"DisplayName": "John Doe",
8+
9+
}
10+
]
11+
}

src/Identity.SignIns/Identity.SignIns/test/loadEnv.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) {
2323
}
2424
$env = @{}
2525
if (Test-Path -Path $envFilePath) {
26-
$env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json
27-
$PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant}
26+
# Load dummy configuration.
27+
$env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json -AsHashTable
28+
[Microsoft.Graph.PowerShell.Authentication.GraphSession]::Instance.AuthContext = New-Object Microsoft.Graph.PowerShell.Authentication.AuthContext -Property @{
29+
ClientId = $env.ClientId
30+
TenantId = $env.TenantId
31+
}
2832
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"New-MgInvitation+[NoContext]+ShouldCreateInvite+$POST+https://graph.microsoft.com/beta/invitations+1": {
3+
"Request": {
4+
"Method": "POST",
5+
"RequestUri": "https://graph.microsoft.com/beta/invitations",
6+
"Content": "{\r\n \"inviteRedirectUrl\": \"https://myapp.contoso.com\",\r\n \"invitedUserDisplayName\": \"John Doe\",\r\n \"invitedUserEmailAddress\": \"[email protected]\"\r\n}",
7+
"Headers": {
8+
},
9+
"ContentHeaders": {
10+
"Content-Type": [ "application/json" ],
11+
"Content-Length": [ "165" ]
12+
}
13+
},
14+
"Response": {
15+
"StatusCode": 201,
16+
"Headers": {
17+
"Date": [ "Wed, 17 Feb 2021 23:05:50 GMT" ],
18+
"Cache-Control": [ "no-store, must-revalidate, no-cache" ],
19+
"Transfer-Encoding": [ "chunked" ],
20+
"Location": [ "https://graph.microsoft.com/" ],
21+
"Vary": [ "Accept-Encoding" ],
22+
"Strict-Transport-Security": [ "max-age=31536000" ],
23+
"request-id": [ "7927b734-7f49-4704-8be9-2a802aeb76f8" ],
24+
"client-request-id": [ "7927b734-7f49-4704-8be9-2a802aeb76f8" ],
25+
"x-ms-ags-diagnostic": [ "{\"ServerInfo\":{\"DataCenter\":\"West US 2\",\"Slice\":\"E\",\"Ring\":\"1\",\"ScaleUnit\":\"002\",\"RoleInstance\":\"MWH0EPF00032E05\"}}" ],
26+
"OData-Version": [ "4.0" ]
27+
},
28+
"ContentHeaders": {
29+
},
30+
"Content": "{\"@odata.context\":\"https://graph.microsoft.com/beta/$metadata#invitations/$entity\",\"id\":\"0c9899a1-2e79-4b05-8285-7df46eda1e75\",\"inviteRedeemUrl\":\"https://login.microsoftonline.com/redeem?rd=NotValid\",\"invitedUserDisplayName\":\"John Doe\",\"invitedUserType\":\"Guest\",\"invitedUserEmailAddress\":\"[email protected]\",\"sendInvitationMessage\":false,\"resetRedemption\":false,\"inviteRedirectUrl\":\"https://myapp.contoso.com/\",\"status\":\"PendingAcceptance\",\"invitedUserMessageInfo\":{\"messageLanguage\":null,\"customizedMessageBody\":null,\"ccRecipients\":[{\"emailAddress\":{\"name\":null,\"address\":null}}]},\"invitedUser\":{\"id\":\"ebb12722-9cb6-4c90-ab39-bf1bb658bae7\"}}"
31+
}
32+
},
33+
"New-MgInvitation+[NoContext]+ShouldThrowInvalidEmailError+$POST+https://graph.microsoft.com/beta/invitations+1": {
34+
"Request": {
35+
"Method": "POST",
36+
"RequestUri": "https://graph.microsoft.com/beta/invitations",
37+
"Content": "{\r\n \"invitedUser\": {\r\n \"id\": \"\",\r\n \"displayName\": \"John Doe\",\r\n \"mail\": \"[email protected]\",\r\n \"userPrincipalName\": \"[email protected]\"\r\n }\r\n}",
38+
"Headers": {
39+
},
40+
"ContentHeaders": {
41+
"Content-Type": [ "application/json" ],
42+
"Content-Length": [ "190" ]
43+
}
44+
},
45+
"Response": {
46+
"StatusCode": 400,
47+
"Headers": {
48+
"Date": [ "Wed, 17 Feb 2021 23:05:50 GMT" ],
49+
"Cache-Control": [ "no-store, must-revalidate, no-cache" ],
50+
"Transfer-Encoding": [ "chunked" ],
51+
"Vary": [ "Accept-Encoding" ],
52+
"Strict-Transport-Security": [ "max-age=31536000" ],
53+
"request-id": [ "e71de23d-cfb6-416a-b03e-416e493ba6ea" ],
54+
"client-request-id": [ "e71de23d-cfb6-416a-b03e-416e493ba6ea" ],
55+
"x-ms-ags-diagnostic": [ "{\"ServerInfo\":{\"DataCenter\":\"West US 2\",\"Slice\":\"E\",\"Ring\":\"1\",\"ScaleUnit\":\"002\",\"RoleInstance\":\"MWH0EPF00033720\"}}" ]
56+
},
57+
"ContentHeaders": {
58+
},
59+
"Content": "{\r\n \"error\": {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"Invalid Email Address\",\r\n \"innerError\": {\r\n \"request-id\": \"e71de23d-cfb6-416a-b03e-416e493ba6ea\",\r\n \"date\": \"2021-02-17T23:05:51\",\r\n \"client-request-id\": \"e71de23d-cfb6-416a-b03e-416e493ba6ea\"\r\n }\r\n }\r\n}"
60+
}
61+
}
62+
}
Lines changed: 74 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,80 @@
1-
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
2-
if (-Not (Test-Path -Path $loadEnvPath)) {
3-
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
4-
}
5-
. ($loadEnvPath)
6-
$TestRecordingFile = Join-Path $PSScriptRoot 'New-MgInvitation.Recording.json'
7-
$currentPath = $PSScriptRoot
8-
while(-not $mockingPath) {
9-
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
10-
$currentPath = Split-Path -Path $currentPath -Parent
1+
BeforeAll {
2+
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
3+
if (-Not (Test-Path -Path $loadEnvPath)) {
4+
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
5+
}
6+
. ($loadEnvPath)
7+
# Set test mode to playback.
8+
$TestMode = 'playback'
9+
$TestRecordingFile = Join-Path $PSScriptRoot 'New-MgInvitation.Recording.json'
10+
$currentPath = $PSScriptRoot
11+
while(-not $mockingPath) {
12+
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
13+
$currentPath = Split-Path -Path $currentPath -Parent
14+
}
15+
. ($mockingPath | Select-Object -First 1).FullName
16+
# Switch to beta profile.
17+
Select-MgProfile beta
1118
}
12-
. ($mockingPath | Select-Object -First 1).FullName
1319

1420
Describe 'New-MgInvitation' {
15-
It 'CreateExpanded1' -skip {
16-
{ throw [System.NotImplementedException] } | Should -Not -Throw
21+
BeforeAll {
22+
$Mock.PushDescription('New-MgInvitation')
23+
}
24+
25+
Context 'CreateExpanded1' {
26+
It 'ShouldCreateInvite' {
27+
$Mock.PushScenario('ShouldCreateInvite')
28+
$Params = @{
29+
InvitedUserDisplayName = $env.Users[0].DisplayName
30+
InvitedUserEmailAddress = $env.Users[0].Mail
31+
InviteRedirectUrl = 'https://myapp.contoso.com'
32+
}
33+
$Invitation = New-MgInvitation @Params
34+
$Invitation | Should -BeOfType -ExpectedType 'Microsoft.Graph.PowerShell.Models.MicrosoftGraphInvitation1'
35+
$Invitation | Should -HaveCount 1
36+
$Invitation.InvitedUserDisplayName | Should -Be $env.Users[0].DisplayName
37+
$Invitation.Status | Should -Be 'PendingAcceptance'
38+
$Invitation.AdditionalProperties | Should -HaveCount 1
39+
}
40+
41+
It 'ShouldThrowInvalidEmailError' {
42+
$Mock.PushScenario('ShouldThrowInvalidEmailError')
43+
$MyUser = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphUser1]@{
44+
Id = $env.Users[0].UserId
45+
DisplayName = $env.Users[0].DisplayName
46+
Mail = $env.Users[0].Mail
47+
UserPrincipalName = $env.Users[0].Mail
48+
}
49+
{ New-MgInvitation -InvitedUser $MyUser -ErrorAction Stop } | Should -Throw -ErrorId 'BadRequest,Microsoft.Graph.PowerShell.Cmdlets.NewMgInvitation_CreateExpanded1' -ExpectedMessage 'Invalid Email Address' -ExceptionType 'Microsoft.Graph.PowerShell.Runtime.RestException<Microsoft.Graph.PowerShell.Models.IOdataError>'
50+
}
1751
}
1852

19-
It 'Create1' -skip {
20-
{ throw [System.NotImplementedException] } | Should -Not -Throw
53+
Context 'Create1' {
54+
It 'ShouldCreateInvite' {
55+
$Mock.PushScenario('ShouldCreateInvite')
56+
$Params = @{
57+
InvitedUserDisplayName = $env.Users[0].DisplayName
58+
InvitedUserEmailAddress = $env.Users[0].Mail
59+
InviteRedirectUrl = 'https://myapp.contoso.com'
60+
}
61+
$Invitation = New-MgInvitation -BodyParameter $Params
62+
$Invitation | Should -BeOfType -ExpectedType 'Microsoft.Graph.PowerShell.Models.MicrosoftGraphInvitation1'
63+
$Invitation | Should -HaveCount 1
64+
$Invitation.InvitedUserDisplayName | Should -Be $env.Users[0].DisplayName
65+
$Invitation.Status | Should -Be 'PendingAcceptance'
66+
$Invitation.AdditionalProperties | Should -HaveCount 1
67+
}
68+
69+
It 'ShouldThrowInvalidEmailError' {
70+
$Mock.PushScenario('ShouldThrowInvalidEmailError')
71+
$MyUser = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphUser1]@{
72+
Id = $env.Users[0].UserId
73+
DisplayName = $env.Users[0].DisplayName
74+
Mail = $env.Users[0].Mail
75+
UserPrincipalName = $env.Users[0].Mail
76+
}
77+
{ New-MgInvitation -BodyParameter @{ InvitedUser = $MyUser } -ErrorAction Stop } | Should -Throw -ErrorId 'BadRequest,Microsoft.Graph.PowerShell.Cmdlets.NewMgInvitation_Create1' -ExpectedMessage 'Invalid Email Address' -ExceptionType 'Microsoft.Graph.PowerShell.Runtime.RestException<Microsoft.Graph.PowerShell.Models.IOdataError>'
78+
}
2179
}
22-
}
80+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"New-MgInvitation+[NoContext]+ShouldCreateInvite+$POST+https://graph.microsoft.com/v1.0/invitations+1": {
3+
"Request": {
4+
"Method": "POST",
5+
"RequestUri": "https://graph.microsoft.com/v1.0/invitations",
6+
"Content": "{\r\n \"inviteRedirectUrl\": \"https://myapp.contoso.com\",\r\n \"invitedUserDisplayName\": \"John Doe\",\r\n \"invitedUserEmailAddress\": \"[email protected]\"\r\n}",
7+
"Headers": {
8+
},
9+
"ContentHeaders": {
10+
"Content-Type": [ "application/json" ],
11+
"Content-Length": [ "165" ]
12+
}
13+
},
14+
"Response": {
15+
"StatusCode": 201,
16+
"Headers": {
17+
"Date": [ "Wed, 17 Feb 2021 21:57:41 GMT" ],
18+
"Cache-Control": [ "no-store, must-revalidate, no-cache" ],
19+
"Transfer-Encoding": [ "chunked" ],
20+
"Location": [ "https://graph.microsoft.com/" ],
21+
"Vary": [ "Accept-Encoding" ],
22+
"Strict-Transport-Security": [ "max-age=31536000" ],
23+
"request-id": [ "f4cd9413-56cc-4ab5-affa-e17d488a6eb2" ],
24+
"client-request-id": [ "f4cd9413-56cc-4ab5-affa-e17d488a6eb2" ],
25+
"x-ms-ags-diagnostic": [ "{\"ServerInfo\":{\"DataCenter\":\"West US 2\",\"Slice\":\"E\",\"Ring\":\"1\",\"ScaleUnit\":\"002\",\"RoleInstance\":\"MWH0EPF00032D50\"}}" ],
26+
"OData-Version": [ "4.0" ]
27+
},
28+
"ContentHeaders": {
29+
},
30+
"Content": "{\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#invitations/$entity\",\"id\":\"0c9899a1-2e79-4b05-8285-7df46eda1e75\",\"inviteRedeemUrl\":\"https://login.microsoftonline.com/redeem?rd=NotValid\",\"invitedUserDisplayName\":\"John Doe\",\"invitedUserType\":\"Guest\",\"invitedUserEmailAddress\":\"[email protected]\",\"sendInvitationMessage\":false,\"inviteRedirectUrl\":\"https://myapp.contoso.com/\",\"status\":\"PendingAcceptance\",\"invitedUserMessageInfo\":{\"messageLanguage\":null,\"customizedMessageBody\":null,\"ccRecipients\":[{\"emailAddress\":{\"name\":null,\"address\":null}}]},\"invitedUser\":{\"id\":\"ebb12722-9cb6-4c90-ab39-bf1bb658bae7\"}}"
31+
}
32+
},
33+
"New-MgInvitation+[NoContext]+ShouldThrowInvalidEmailError+$POST+https://graph.microsoft.com/v1.0/invitations+1": {
34+
"Request": {
35+
"Method": "POST",
36+
"RequestUri": "https://graph.microsoft.com/v1.0/invitations",
37+
"Content": "{\r\n \"invitedUser\": {\r\n \"id\": \"\",\r\n \"displayName\": \"John Doe\",\r\n \"mail\": \"[email protected]\",\r\n \"userPrincipalName\": \"[email protected]\"\r\n }\r\n}",
38+
"Headers": {
39+
},
40+
"ContentHeaders": {
41+
"Content-Type": [ "application/json" ],
42+
"Content-Length": [ "190" ]
43+
}
44+
},
45+
"Response": {
46+
"StatusCode": 400,
47+
"Headers": {
48+
"Date": [ "Wed, 17 Feb 2021 21:57:39 GMT" ],
49+
"Cache-Control": [ "no-store, must-revalidate, no-cache" ],
50+
"Transfer-Encoding": [ "chunked" ],
51+
"Vary": [ "Accept-Encoding" ],
52+
"Strict-Transport-Security": [ "max-age=31536000" ],
53+
"request-id": [ "90b8bf35-b7d7-4278-8582-07ad4f34bce3" ],
54+
"client-request-id": [ "90b8bf35-b7d7-4278-8582-07ad4f34bce3" ],
55+
"x-ms-ags-diagnostic": [ "{\"ServerInfo\":{\"DataCenter\":\"West US 2\",\"Slice\":\"E\",\"Ring\":\"1\",\"ScaleUnit\":\"002\",\"RoleInstance\":\"MWH0EPF00032D57\"}}" ]
56+
},
57+
"ContentHeaders": {
58+
},
59+
"Content": "{\r\n \"error\": {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"Invalid Email Address\",\r\n \"innerError\": {\r\n \"request-id\": \"90b8bf35-b7d7-4278-8582-07ad4f34bce3\",\r\n \"date\": \"2021-02-17T21:57:39\",\r\n \"client-request-id\": \"90b8bf35-b7d7-4278-8582-07ad4f34bce3\"\r\n }\r\n }\r\n}"
60+
}
61+
}
62+
}
Lines changed: 73 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,80 @@
1-
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
2-
if (-Not (Test-Path -Path $loadEnvPath)) {
3-
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
4-
}
5-
. ($loadEnvPath)
6-
$TestRecordingFile = Join-Path $PSScriptRoot 'New-MgInvitation.Recording.json'
7-
$currentPath = $PSScriptRoot
8-
while(-not $mockingPath) {
9-
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
10-
$currentPath = Split-Path -Path $currentPath -Parent
1+
BeforeAll {
2+
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
3+
if (-Not (Test-Path -Path $loadEnvPath)) {
4+
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
5+
}
6+
. ($loadEnvPath)
7+
# Set test mode to playback.
8+
$TestMode = 'playback'
9+
$TestRecordingFile = Join-Path $PSScriptRoot 'New-MgInvitation.Recording.json'
10+
$currentPath = $PSScriptRoot
11+
while (-not $mockingPath) {
12+
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
13+
$currentPath = Split-Path -Path $currentPath -Parent
14+
}
15+
. ($mockingPath | Select-Object -First 1).FullName
16+
17+
Select-MgProfile 'v1.0'
1118
}
12-
. ($mockingPath | Select-Object -First 1).FullName
1319

1420
Describe 'New-MgInvitation' {
15-
It 'CreateExpanded' -skip {
16-
{ throw [System.NotImplementedException] } | Should -Not -Throw
21+
BeforeAll {
22+
$Mock.PushDescription('New-MgInvitation')
1723
}
1824

19-
It 'Create' -skip {
20-
{ throw [System.NotImplementedException] } | Should -Not -Throw
25+
Context 'CreateExpanded' {
26+
It 'ShouldCreateInvite' {
27+
$Mock.PushScenario('ShouldCreateInvite')
28+
$Params = @{
29+
InvitedUserDisplayName = $env.Users[0].DisplayName
30+
InvitedUserEmailAddress = $env.Users[0].Mail
31+
InviteRedirectUrl = 'https://myapp.contoso.com'
32+
}
33+
$Invitation = New-MgInvitation @Params
34+
$Invitation | Should -BeOfType -ExpectedType 'Microsoft.Graph.PowerShell.Models.MicrosoftGraphInvitation'
35+
$Invitation | Should -HaveCount 1
36+
$Invitation.InvitedUserDisplayName | Should -Be $env.Users[0].DisplayName
37+
$Invitation.Status | Should -Be 'PendingAcceptance'
38+
$Invitation.AdditionalProperties | Should -HaveCount 1
39+
}
40+
41+
It 'ShouldThrowInvalidEmailError' {
42+
$Mock.PushScenario('ShouldThrowInvalidEmailError')
43+
$MyUser = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphUser]@{
44+
Id = $env.Users[0].UserId
45+
DisplayName = $env.Users[0].DisplayName
46+
Mail = $env.Users[0].Mail
47+
UserPrincipalName = $env.Users[0].Mail
48+
}
49+
{ New-MgInvitation -InvitedUser $MyUser -ErrorAction Stop } | Should -Throw -ErrorId 'BadRequest,Microsoft.Graph.PowerShell.Cmdlets.NewMgInvitation_CreateExpanded' -ExpectedMessage 'Invalid Email Address' -ExceptionType 'Microsoft.Graph.PowerShell.Runtime.RestException<Microsoft.Graph.PowerShell.Models.IOdataError>'
50+
}
51+
}
52+
53+
Context 'Create' {
54+
It 'ShouldCreateInvite' {
55+
$Mock.PushScenario('ShouldCreateInvite')
56+
$Params = @{
57+
InvitedUserDisplayName = $env.Users[0].DisplayName
58+
InvitedUserEmailAddress = $env.Users[0].Mail
59+
InviteRedirectUrl = 'https://myapp.contoso.com'
60+
}
61+
$Invitation = New-MgInvitation -BodyParameter $Params
62+
$Invitation | Should -BeOfType -ExpectedType 'Microsoft.Graph.PowerShell.Models.MicrosoftGraphInvitation'
63+
$Invitation | Should -HaveCount 1
64+
$Invitation.InvitedUserDisplayName | Should -Be $env.Users[0].DisplayName
65+
$Invitation.Status | Should -Be 'PendingAcceptance'
66+
$Invitation.AdditionalProperties | Should -HaveCount 1
67+
}
68+
69+
It 'ShouldThrowInvalidEmailError' {
70+
$Mock.PushScenario('ShouldThrowInvalidEmailError')
71+
$MyUser = [Microsoft.Graph.PowerShell.Models.MicrosoftGraphUser]@{
72+
Id = $env.Users[0].UserId
73+
DisplayName = $env.Users[0].DisplayName
74+
Mail = $env.Users[0].Mail
75+
UserPrincipalName = $env.Users[0].Mail
76+
}
77+
{ New-MgInvitation -BodyParameter @{ InvitedUser = $MyUser } -ErrorAction Stop } | Should -Throw -ErrorId 'BadRequest,Microsoft.Graph.PowerShell.Cmdlets.NewMgInvitation_Create' -ExpectedMessage 'Invalid Email Address' -ExceptionType 'Microsoft.Graph.PowerShell.Runtime.RestException<Microsoft.Graph.PowerShell.Models.IOdataError>'
78+
}
2179
}
2280
}

src/readme.graph.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -501,20 +501,6 @@ directive:
501501
$ = $.replace(additionalPropertiesRegex, '$1$2 new $3');
502502
}
503503
504-
let regexPattern = /^\s*public\s*partial\s*class\s*MicrosoftGraph(?<EntityName>.*):$/gm;
505-
let regexArray;
506-
while ((regexArray = regexPattern.exec($)) !== null) {
507-
if (regexArray['groups'] != null)
508-
{
509-
let EntityName = regexArray['groups'].EntityName.trim();
510-
let newEntityId = EntityName + 'Id';
511-
let newEntityIdPropRegex = new RegExp("^\\s*public\\s*string\\s*"+newEntityId+"\\.*","gm");
512-
let existingIdPropRegex = /(^\s*)(public\s*string\s*Id\s.*)/gm;
513-
if ((!$.match(newEntityIdPropRegex)) && $.match(existingIdPropRegex) && (newEntityId != "EntityId") && (newEntityId != "BaseItemId")) {
514-
$ = $.replace(existingIdPropRegex, '$1$2\n\n$1partial void AfterToJson(ref Microsoft.Graph.PowerShell.Runtime.Json.JsonObject container, Microsoft.Graph.PowerShell.Runtime.SerializationMode serializationMode)\n$1{\n$1\tif (serializationMode == Microsoft.Graph.PowerShell.Runtime.SerializationMode.IncludeAll) {\n$1\t\tAddIf(null != this.Id ? (Microsoft.Graph.PowerShell.Runtime.Json.JsonNode)new Microsoft.Graph.PowerShell.Runtime.Json.JsonString(this.Id) : null, "'+ EntityName.toLowerCase() +'-id", container.Add);\n$1\t}\n$1}');
515-
}
516-
}
517-
}
518504
return $;
519505
}
520506
# Modify generated .cs cmdlets.

0 commit comments

Comments
 (0)