Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IVS mutator type does not match backing field type #3487

Closed
gabr0236 opened this issue Sep 25, 2024 · 3 comments
Closed

IVS mutator type does not match backing field type #3487

gabr0236 opened this issue Sep 25, 2024 · 3 comments
Labels
bug This issue is a bug. module/sdk-generated p2 This is a standard priority issue

Comments

@gabr0236
Copy link
Contributor

gabr0236 commented Sep 25, 2024

Describe the bug

Example:

public partial class StreamSessionSummary
{
    private DateTime? _endTime;
...
    public DateTime EndTime
    {
         get { return this._endTime.GetValueOrDefault(); }
         set { this._endTime = value; }
    }
}

As the mutator is non-nullable i am not able to assign null to _endTime and thus not able to mock the different possible responses from the API.

This seems to be a general issue, stemming from how the code is being auto generated.

Or maybe value types are always marked as nullable? In that case i would expect to be able to define the property as nullable in generator/ServiceModels/ivs/ivs-2020-07-14.normal.json

I wanted to look at a fix myself but its not quite clear where/how the autogeneration happens.

Expected Behavior

I would expect the mutator type to match the backing field type to be able to simulate diffrent possible responses from the IVS API.

AWS .NET SDK and/or Package version used

AWSSDK.IVS 3.7.400.23

Targeted .NET Platform

.net 8

Operating System and version

MacOS Sononoma 14.0

@gabr0236 gabr0236 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 25, 2024
@dscpinheiro
Copy link
Contributor

This behavior is expected in the current version of the .NET SDK (i.e. 3.7.x), but we fixed this in the next major version (V4) which is currently in preview and can be tracked in #3362; Here's the relevant section of the announcement blog post:

V4 changes properties on classes used for requests and responses that used value types like int, bool, and DateTime to use the nullable version, essentially changing the type from bool to bool?. This addresses a long standing issue many users had with the SDK in that they could not tell, for example, if a boolean property is false because the service returned false, or if the property is false because that is the default value for bool types.

For example, here's how the EndTime property is defined in V4 (which is available in https://www.nuget.org/packages/AWSSDK.IVS/4.0.0-preview.2):

/// <summary>
/// Gets and sets the property EndTime.
/// <para>
/// Time when the channel went offline. This is an ISO 8601 timestamp; <i>note that this
/// is returned as a string</i>. For live streams, this is <c>NULL</c>.
/// </para>
/// </summary>
public DateTime? EndTime
{
get { return this._endTime; }
set { this._endTime = value; }
}

Copy link

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@ashishdhingra ashishdhingra added module/sdk-generated p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Oct 9, 2024
@ashishdhingra
Copy link
Contributor

@dscpinheiro Thanks for the response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. module/sdk-generated p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants