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

int array parameter issue #4840

Open
MoeHamdan opened this issue Mar 28, 2024 · 4 comments
Open

int array parameter issue #4840

MoeHamdan opened this issue Mar 28, 2024 · 4 comments

Comments

@MoeHamdan
Copy link

MoeHamdan commented Mar 28, 2024

Hello

I have an action in controller that have array parameter with the following signature.
Task<IEnumerable<ChildBasic>> GetChildrenBasicInfo([FromRoute] int[] childrenIds)
Version 14 of NwagStudio has a problem generating the client it is generating as follows:

`
public virtual async System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable> GetChildrenBasicInfoAsync(System.Collections.Generic.IEnumerable childrenIds, System.Threading.CancellationToken cancellationToken)
{
if (childrenIds == null)
throw new System.ArgumentNullException("childrenIds");

        var client_ = _httpClient;
        var disposeClient_ = false;
        try
        {
            using (var request_ = new System.Net.Http.HttpRequestMessage())
            {
                request_.Method = new System.Net.Http.HttpMethod("GET");
                request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));

                var urlBuilder_ = new System.Text.StringBuilder();
            
                // Operation Path: "api/v2/Children/children-basic/{childrenIds}"
                urlBuilder_.Append("api/v2/Children/children-basic/");
                for (var i = 0; i < childrenIds.Length; i++)
                {
                    if (i > 0) urlBuilder_.Append(',');
                    urlBuilder_.Append(ConvertToString(childrenIds[i], System.Globalization.CultureInfo.InvariantCulture));
                }

`

It is using IEnumerable as parameter and then using ".Length" against it, the IEnumerable does not have .Length property.

Kindly advise.

@MoeHamdan
Copy link
Author

@RicoSuter may you please help our APIs are broken now.

@jacekcendrzak
Copy link

jacekcendrzak commented Apr 8, 2024

Hi,

I noticed the same issue.
Here is a snap of how the generated code has changed between versions:
image

@Nergy101
Copy link

Nergy101 commented Apr 18, 2024

Hi,

I've noticed the same and cant get around it with any settings or options.
Looks to me like a small oversight, and this should be breaking everybody's clients right?
As long as they use lists/collections/arrays somewhere in their API...

Hoping it will be fixed soon.

In the 13.20 release this works though.

@Myliak
Copy link

Myliak commented Apr 30, 2024

This is broken on our side too, seems like major bug to not be adressed asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants