Skip to content

Commit

Permalink
Merge pull request #139 from microsoft/feature/trimming
Browse files Browse the repository at this point in the history
feature/trimming
  • Loading branch information
baywet authored Oct 23, 2023
2 parents dc816a5 + d54010a commit 75143ba
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.5.0] - 2023-10-19

### Added

- Added dotnet trimming support.

## [1.4.0] - 2023-10-12

### Added
Expand Down
7 changes: 4 additions & 3 deletions src/Microsoft.Kiota.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<AssemblyTitle>Kiota Abstractions Library for dotnet</AssemblyTitle>
<Authors>Microsoft</Authors>
<TargetFrameworks>netstandard2.0;netstandard2.1;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;</TargetFrameworks>
<LangVersion>latest</LangVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
<RepositoryUrl>https://github.com/microsoft/kiota-abstractions-dotnet</RepositoryUrl>
<PackageProjectUrl>https://aka.ms/kiota/docs</PackageProjectUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Deterministic>true</Deterministic>
<VersionPrefix>1.4.0</VersionPrefix>
<VersionPrefix>1.5.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<SignAssembly>false</SignAssembly>
Expand All @@ -33,7 +33,8 @@
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<NoWarn>$(NoWarn);NU5048</NoWarn>
<NoWarn>$(NoWarn);NU5048;NETSDK1138</NoWarn>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand Down
11 changes: 9 additions & 2 deletions src/RequestInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
using System.Linq;
using Microsoft.Kiota.Abstractions.Extensions;
using Microsoft.Kiota.Abstractions.Serialization;
#if NET5_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

namespace Microsoft.Kiota.Abstractions
{
Expand Down Expand Up @@ -101,10 +104,14 @@ public Uri URI
/// Vanity method to add the query parameters to the request query parameters dictionary.
/// </summary>
/// <param name="source">The query parameters to add.</param>
public void AddQueryParameters(object source)
#if NET5_0_OR_GREATER
public void AddQueryParameters<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(T source)
#else
public void AddQueryParameters<T>(T source)
#endif
{
if(source == null) return;
foreach(var property in source.GetType()
foreach(var property in typeof(T)
.GetProperties()
.Select(
x => (
Expand Down
11 changes: 11 additions & 0 deletions src/serialization/IParseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

using System;
using System.Collections.Generic;
#if NET5_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

namespace Microsoft.Kiota.Abstractions.Serialization
{
Expand Down Expand Up @@ -97,7 +100,11 @@ public interface IParseNode
/// Gets the collection of enum values of the node.
/// </summary>
/// <returns>The collection of enum values.</returns>
#if NET5_0_OR_GREATER
IEnumerable<T?> GetCollectionOfEnumValues<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]T>() where T : struct, Enum;
#else
IEnumerable<T?> GetCollectionOfEnumValues<T>() where T : struct, Enum;
#endif
/// <summary>
/// Gets the collection of model objects values of the node.
/// </summary>
Expand All @@ -108,7 +115,11 @@ public interface IParseNode
/// Gets the enum value of the node.
/// </summary>
/// <returns>The enum value of the node.</returns>
#if NET5_0_OR_GREATER
T? GetEnumValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]T>() where T : struct, Enum;
#else
T? GetEnumValue<T>() where T : struct, Enum;
#endif
/// <summary>
/// Gets the model object value of the node.
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions src/serialization/ISerializationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using System;
using System.Collections.Generic;
using System.IO;
#if NET5_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

namespace Microsoft.Kiota.Abstractions.Serialization
{
Expand Down Expand Up @@ -114,7 +117,11 @@ public interface ISerializationWriter : IDisposable
/// </summary>
/// <param name="key">The key to be used for the written value. May be null.</param>
/// <param name="values">The enum values to be written.</param>
#if NET5_0_OR_GREATER
void WriteCollectionOfEnumValues<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]T>(string? key, IEnumerable<T?>? values) where T : struct, Enum;
#else
void WriteCollectionOfEnumValues<T>(string? key, IEnumerable<T?>? values) where T : struct, Enum;
#endif
/// <summary>
/// Writes the specified byte array as a base64 string to the stream with an optional given key.
/// </summary>
Expand All @@ -133,7 +140,11 @@ public interface ISerializationWriter : IDisposable
/// </summary>
/// <param name="key">The key to be used for the written value. May be null.</param>
/// <param name="value">The enum value to be written.</param>
#if NET5_0_OR_GREATER
void WriteEnumValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(string? key, T? value) where T : struct, Enum;
#else
void WriteEnumValue<T>(string? key, T? value) where T : struct, Enum;
#endif
/// <summary>
/// Writes a null value for the specified key.
/// </summary>
Expand Down

0 comments on commit 75143ba

Please sign in to comment.