Skip to content

Commit b254ebe

Browse files
authored
Add ODataId to required properties for update and create. (#1967)
1 parent a49fed5 commit b254ebe

File tree

5 files changed

+68
-2
lines changed

5 files changed

+68
-2
lines changed

src/Applications/beta/test/Update-MgBetaApplication.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Describe "Update-MgBetaApplication" {
1313
}
1414

1515
It "Should support UpdateExpanded parameterSet by default" {
16-
$UpdateMgBetaApplication.OutputType | Should -Be "System.Boolean"
16+
$UpdateMgBetaApplication.OutputType | Should -Be "Microsoft.Graph.PowerShell.Models.IMicrosoftGraphApplication"
1717
$UpdateMgBetaApplication.DefaultParameterSet | Should -Be "UpdateExpanded"
1818
}
1919

src/Applications/v1.0/test/New-MgApplicationOwnerByRef.Tests.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Describe "New-MgApplicationOwnerByRef" {
2323
$CreateExpandedParameterSet.Parameters.Name | Should -Contain OdataId
2424
$CreateExpandedParameterSet.Parameters.Name | Should -Contain AdditionalProperties
2525
$CreateExpandedParameterSet.Parameters.Name | Should -Not -Contain BodyParameter
26+
$NewMgApplicationOwnerByRef.Parameters.OdataId.ParameterSets.CreateExpanded.IsMandatory | Should -be $true
2627
}
2728

2829
It 'Should have Create parameterSet' {
@@ -45,5 +46,6 @@ Describe "New-MgApplicationOwnerByRef" {
4546
$CreateViaIdentityExpandedParameterSet.Parameters.Name | Should -Contain OdataId
4647
$CreateViaIdentityExpandedParameterSet.Parameters.Name | Should -Contain AdditionalProperties
4748
$CreateViaIdentityExpandedParameterSet.Parameters.Name | Should -Not -Contain BodyParameter
49+
$NewMgApplicationOwnerByRef.Parameters.OdataId.ParameterSets.CreateViaIdentityExpanded.IsMandatory | Should -be $true
4850
}
4951
}

src/Applications/v1.0/test/Update-MgApplication.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Describe "Update-MgApplication" {
1313
}
1414

1515
It "Should support UpdateExpanded parameterSet by default" {
16-
$UpdateMgApplication.OutputType | Should -Be "System.Boolean"
16+
$UpdateMgApplication.OutputType | Should -Be "Microsoft.Graph.PowerShell.Models.IMicrosoftGraphApplication"
1717
$UpdateMgApplication.DefaultParameterSet | Should -Be "UpdateExpanded"
1818
}
1919

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
# ------------------------------------------------------------------------------
4+
Describe "Set-MgUserManagerByRef" {
5+
BeforeAll {
6+
$SetMgUserManagerByRef = Get-Command Set-MgUserManagerByRef
7+
}
8+
9+
It "Should support minimum set of parameter sets" {
10+
$SetMgUserManagerByRef.ParameterSets.Name | Should -BeIn @("Set", "SetExpanded", "SetViaIdentity", "SetViaIdentityExpanded")
11+
$SetMgUserManagerByRef.Visibility | Should -Be "Public"
12+
$SetMgUserManagerByRef.CommandType | Should -Be "Function"
13+
}
14+
15+
It "Should support SetExpanded parameterSet by default" {
16+
$SetMgUserManagerByRef.OutputType | Should -Be "System.Boolean"
17+
$SetMgUserManagerByRef.DefaultParameterSet | Should -Be "SetExpanded"
18+
}
19+
20+
It 'Should have SetExpanded parameterSet' {
21+
$SetExpandedParameterSet = $SetMgUserManagerByRef.ParameterSets | Where-Object Name -eq "SetExpanded"
22+
$SetExpandedParameterSet.Parameters.Name | Should -Contain UserId
23+
$SetExpandedParameterSet.Parameters.Name | Should -Contain OdataId
24+
$SetExpandedParameterSet.Parameters.Name | Should -Contain AdditionalProperties
25+
$SetExpandedParameterSet.Parameters.Name | Should -Not -Contain BodyParameter
26+
$SetMgUserManagerByRef.Parameters.OdataId.ParameterSets.SetExpanded.IsMandatory | Should -be $true
27+
}
28+
29+
It 'Should have Set parameterSet' {
30+
$SetParameterSet = $SetMgUserManagerByRef.ParameterSets | Where-Object Name -eq "Set"
31+
$SetParameterSet.Parameters.Name | Should -Contain UserId
32+
$SetParameterSet.Parameters.Name | Should -Contain BodyParameter
33+
$SetParameterSet.Parameters.Name | Should -Not -Contain AdditionalProperties
34+
}
35+
36+
It 'Should have SetViaIdentity parameterSet' {
37+
$SetViaIdentityParameterSet = $SetMgUserManagerByRef.ParameterSets | Where-Object Name -eq "SetViaIdentity"
38+
$SetViaIdentityParameterSet.Parameters.Name | Should -Contain InputObject
39+
$SetViaIdentityParameterSet.Parameters.Name | Should -Contain BodyParameter
40+
$SetViaIdentityParameterSet.Parameters.Name | Should -Not -Contain AdditionalProperties
41+
}
42+
43+
It 'Should have SetViaIdentityExpanded parameterSet' {
44+
$SetViaIdentityExpandedParameterSet = $SetMgUserManagerByRef.ParameterSets | Where-Object Name -eq "SetViaIdentityExpanded"
45+
$SetViaIdentityExpandedParameterSet.Parameters.Name | Should -Contain InputObject
46+
$SetViaIdentityExpandedParameterSet.Parameters.Name | Should -Contain OdataId
47+
$SetViaIdentityExpandedParameterSet.Parameters.Name | Should -Contain AdditionalProperties
48+
$SetViaIdentityExpandedParameterSet.Parameters.Name | Should -Not -Contain BodyParameter
49+
$SetMgUserManagerByRef.Parameters.OdataId.ParameterSets.SetViaIdentityExpanded.IsMandatory | Should -be $true
50+
}
51+
}

src/readme.graph.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,19 @@ directive:
514514
}
515515
}
516516
}
517+
# Mark '@odata.id' as required properties for /$ref.
518+
- from: 'openapi-document'
519+
where: $.components.schemas.ReferenceCreate
520+
transform: $['required'] = ['@odata.id']
521+
- from: 'openapi-document'
522+
where: $.components.schemas.ReferenceCreate..properties['@odata.id']
523+
transform: $['description'] = 'The entity reference URL of the resource. For example, https://graph.microsoft.com/v1.0/directoryObjects/{id}.'
524+
- from: 'openapi-document'
525+
where: $.components.schemas.ReferenceUpdate
526+
transform: $['required'] = ['@odata.id']
527+
- from: 'openapi-document'
528+
where: $.components.schemas.ReferenceUpdate..properties['@odata.id']
529+
transform: $['description'] = 'The entity reference URL of the resource. For example, https://graph.microsoft.com/v1.0/directoryObjects/{id}.'
517530
# Mark consistency level parameter as required for /$count paths when header is present.
518531
- from: openapi-document
519532
where: $..paths.*[?(/(.*_GetCount)/gmi.exec(@.operationId))]..parameters[?(@.name === "ConsistencyLevel")]

0 commit comments

Comments
 (0)