Skip to content

Commit 75143ba

Browse files
authored
Merge pull request #139 from microsoft/feature/trimming
feature/trimming
2 parents dc816a5 + d54010a commit 75143ba

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.5.0] - 2023-10-19
11+
12+
### Added
13+
14+
- Added dotnet trimming support.
15+
1016
## [1.4.0] - 2023-10-12
1117

1218
### Added

src/Microsoft.Kiota.Abstractions.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
77
<AssemblyTitle>Kiota Abstractions Library for dotnet</AssemblyTitle>
88
<Authors>Microsoft</Authors>
9-
<TargetFrameworks>netstandard2.0;netstandard2.1;</TargetFrameworks>
9+
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;</TargetFrameworks>
1010
<LangVersion>latest</LangVersion>
1111
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1212
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
1313
<RepositoryUrl>https://github.com/microsoft/kiota-abstractions-dotnet</RepositoryUrl>
1414
<PackageProjectUrl>https://aka.ms/kiota/docs</PackageProjectUrl>
1515
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1616
<Deterministic>true</Deterministic>
17-
<VersionPrefix>1.4.0</VersionPrefix>
17+
<VersionPrefix>1.5.0</VersionPrefix>
1818
<VersionSuffix></VersionSuffix>
1919
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2020
<SignAssembly>false</SignAssembly>
@@ -33,7 +33,8 @@
3333
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
3434
<PackageLicenseFile>LICENSE</PackageLicenseFile>
3535
<PackageReadmeFile>README.md</PackageReadmeFile>
36-
<NoWarn>$(NoWarn);NU5048</NoWarn>
36+
<NoWarn>$(NoWarn);NU5048;NETSDK1138</NoWarn>
37+
<IsTrimmable>true</IsTrimmable>
3738
</PropertyGroup>
3839

3940
<ItemGroup>

src/RequestInformation.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
using System.Linq;
1111
using Microsoft.Kiota.Abstractions.Extensions;
1212
using Microsoft.Kiota.Abstractions.Serialization;
13+
#if NET5_0_OR_GREATER
14+
using System.Diagnostics.CodeAnalysis;
15+
#endif
1316

1417
namespace Microsoft.Kiota.Abstractions
1518
{
@@ -101,10 +104,14 @@ public Uri URI
101104
/// Vanity method to add the query parameters to the request query parameters dictionary.
102105
/// </summary>
103106
/// <param name="source">The query parameters to add.</param>
104-
public void AddQueryParameters(object source)
107+
#if NET5_0_OR_GREATER
108+
public void AddQueryParameters<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(T source)
109+
#else
110+
public void AddQueryParameters<T>(T source)
111+
#endif
105112
{
106113
if(source == null) return;
107-
foreach(var property in source.GetType()
114+
foreach(var property in typeof(T)
108115
.GetProperties()
109116
.Select(
110117
x => (

src/serialization/IParseNode.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
using System;
66
using System.Collections.Generic;
7+
#if NET5_0_OR_GREATER
8+
using System.Diagnostics.CodeAnalysis;
9+
#endif
710

811
namespace Microsoft.Kiota.Abstractions.Serialization
912
{
@@ -97,7 +100,11 @@ public interface IParseNode
97100
/// Gets the collection of enum values of the node.
98101
/// </summary>
99102
/// <returns>The collection of enum values.</returns>
103+
#if NET5_0_OR_GREATER
104+
IEnumerable<T?> GetCollectionOfEnumValues<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]T>() where T : struct, Enum;
105+
#else
100106
IEnumerable<T?> GetCollectionOfEnumValues<T>() where T : struct, Enum;
107+
#endif
101108
/// <summary>
102109
/// Gets the collection of model objects values of the node.
103110
/// </summary>
@@ -108,7 +115,11 @@ public interface IParseNode
108115
/// Gets the enum value of the node.
109116
/// </summary>
110117
/// <returns>The enum value of the node.</returns>
118+
#if NET5_0_OR_GREATER
119+
T? GetEnumValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]T>() where T : struct, Enum;
120+
#else
111121
T? GetEnumValue<T>() where T : struct, Enum;
122+
#endif
112123
/// <summary>
113124
/// Gets the model object value of the node.
114125
/// </summary>

src/serialization/ISerializationWriter.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
using System;
66
using System.Collections.Generic;
77
using System.IO;
8+
#if NET5_0_OR_GREATER
9+
using System.Diagnostics.CodeAnalysis;
10+
#endif
811

912
namespace Microsoft.Kiota.Abstractions.Serialization
1013
{
@@ -114,7 +117,11 @@ public interface ISerializationWriter : IDisposable
114117
/// </summary>
115118
/// <param name="key">The key to be used for the written value. May be null.</param>
116119
/// <param name="values">The enum values to be written.</param>
120+
#if NET5_0_OR_GREATER
121+
void WriteCollectionOfEnumValues<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]T>(string? key, IEnumerable<T?>? values) where T : struct, Enum;
122+
#else
117123
void WriteCollectionOfEnumValues<T>(string? key, IEnumerable<T?>? values) where T : struct, Enum;
124+
#endif
118125
/// <summary>
119126
/// Writes the specified byte array as a base64 string to the stream with an optional given key.
120127
/// </summary>
@@ -133,7 +140,11 @@ public interface ISerializationWriter : IDisposable
133140
/// </summary>
134141
/// <param name="key">The key to be used for the written value. May be null.</param>
135142
/// <param name="value">The enum value to be written.</param>
143+
#if NET5_0_OR_GREATER
144+
void WriteEnumValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(string? key, T? value) where T : struct, Enum;
145+
#else
136146
void WriteEnumValue<T>(string? key, T? value) where T : struct, Enum;
147+
#endif
137148
/// <summary>
138149
/// Writes a null value for the specified key.
139150
/// </summary>

0 commit comments

Comments
 (0)