Skip to content

Commit 903eee8

Browse files
authored
Merge pull request #855 from microsoftgraph/dev
Release to main
2 parents cfd421d + 252e775 commit 903eee8

File tree

13 files changed

+81
-8
lines changed

13 files changed

+81
-8
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
with:
1717
submodules: recursive
1818
- name: Setup .NET
19-
uses: actions/setup-dotnet@v3.0.0
19+
uses: actions/setup-dotnet@v3.0.2
2020
with:
2121
dotnet-version: 6.0.x
2222
- name: Restore dependencies

Templates/templates/PHP/Model/EntityType.php.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
188188
* <#=property.GetSanitizedLongDescription()#>
189189
<# } #>
190190
*
191-
* @return <#=propertyTypeReference#>|null The <#=propertyName#>
191+
* @return <#=(property.IsCollection()) ? "array" : propertyTypeReference#>|null The <#=propertyName#>
192192
*/
193193
public function get<#=propertyName.ToCheckedCase()#>()
194194
{
@@ -216,7 +216,7 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
216216
* <#=property.GetSanitizedLongDescription()#>
217217
<# } #>
218218
*
219-
* @param <#=propertyTypeReference#> $val The <#=propertyName#>
219+
* @param <#=(property.IsCollection()) ? $"{propertyTypeReference}[]" : propertyTypeReference#> $val The <#=propertyName#>
220220
*
221221
* @return <#=entityName.ToCheckedCase()#>
222222
*/

src/GraphODataTemplateWriter/Extensions/OdcmModelExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,10 +730,10 @@ public static List<OdcmProperty> GetComposableFunctionReturnTypeNavigations(this
730730
throw new InvalidOperationException("This extension method is intended " +
731731
"to only be called on a composable function.");
732732

733-
return (odcmMethod.ReturnType as OdcmClass).Properties
733+
return (odcmMethod.ReturnType as OdcmClass)?.Properties
734734
.Where(p => p.IsLink)
735735
.OrderBy(p => p.Name)
736-
.ToList();
736+
.ToList() ?? new List<OdcmProperty>(); // default to empty list
737737
}
738738

739739
/// <summary>

src/GraphODataTemplateWriter/GraphODataTemplateWriter.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
5555
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
5656
<PackageReference Include="Mono.TextTemplating">
57-
<Version>2.2.1</Version>
57+
<Version>2.3.0</Version>
5858
</PackageReference>
5959
<PackageReference Include="NLog.Config">
6060
<Version>4.7.15</Version>

test/Typewriter.Test/Metadata/MetadataWithSubNamespaces.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
</EntityType>
1111
<EntityType Name="testType" BaseType="graph.entity">
1212
<Property Name="propertyAlpha" Type="graph.derivedComplexTypeRequest" />
13+
<Property Name="primitiveCollection" Type="Collection(Edm.String)" />
1314
</EntityType>
1415
<EnumType Name="enum1">
1516
<Member Name="value0" Value="0" />

test/Typewriter.Test/TestDataObjC/Models/MSGraphTestType.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
@interface MSGraphTestType : MSGraphEntity
1010

1111
@property (nullable, nonatomic, setter=setPropertyAlpha:, getter=propertyAlpha) MSGraphDerivedComplexTypeRequest* propertyAlpha;
12+
@property (nullable, nonatomic, setter=setPrimitiveCollection:, getter=primitiveCollection) NSArray* primitiveCollection;
1213

1314
@end

test/Typewriter.Test/TestDataObjC/Models/MSGraphTestType.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ @interface MSObject()
1515
@interface MSGraphTestType()
1616
{
1717
MSGraphDerivedComplexTypeRequest* _propertyAlpha;
18+
NSArray* _primitiveCollection;
1819
}
1920
@end
2021

@@ -41,5 +42,19 @@ - (void) setPropertyAlpha: (MSGraphDerivedComplexTypeRequest*) val
4142
self.dictionary[@"propertyAlpha"] = val;
4243
}
4344

45+
- (NSArray*) primitiveCollection
46+
{
47+
if([[NSNull null] isEqual:self.dictionary[@"primitiveCollection"]])
48+
{
49+
return nil;
50+
}
51+
return self.dictionary[@"primitiveCollection"];
52+
}
53+
54+
- (void) setPrimitiveCollection: (NSArray*) val
55+
{
56+
self.dictionary[@"primitiveCollection"] = val;
57+
}
58+
4459

4560
@end

test/Typewriter.Test/TestDataPHP/com/Microsoft/Graph/Model/TestType.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,31 @@ public function setPropertyAlpha($val)
5555
return $this;
5656
}
5757

58+
/**
59+
* Gets the primitiveCollection
60+
*
61+
* @return array|null The primitiveCollection
62+
*/
63+
public function getPrimitiveCollection()
64+
{
65+
if (array_key_exists("primitiveCollection", $this->_propDict)) {
66+
return $this->_propDict["primitiveCollection"];
67+
} else {
68+
return null;
69+
}
70+
}
71+
72+
/**
73+
* Sets the primitiveCollection
74+
*
75+
* @param string[] $val The primitiveCollection
76+
*
77+
* @return TestType
78+
*/
79+
public function setPrimitiveCollection($val)
80+
{
81+
$this->_propDict["primitiveCollection"] = $val;
82+
return $this;
83+
}
84+
5885
}

0 commit comments

Comments
 (0)