-
Notifications
You must be signed in to change notification settings - Fork 199
OpenApiResponseWithBody and aliased Dictionary type triggers error: Index was outside the bounds of the array #313
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
Comments
Same issue here. just tried to use following type as bodyType Did you already find a workaround? |
Yeah - not having aliased types. Not so much a workaround really NSwag generated the type in question and we could do some work there to help |
I'm having the same issue using a class with a Dictionary property:
|
Having same problem with a class that contains:
v4 AF, .Net 6, VS 2022 |
@johnnyreilly Can you give a short hint please, how you manipulated the code produced by Nswag to not contain those alias types? |
I think it's the one below @Epstone : var settings = new CSharpClientGeneratorSettings
{
ClassName = "MyClient",
UseBaseUrl = false,
CSharpGeneratorSettings =
{
Namespace = "My.App",
GenerateNullableReferenceTypes = true,
GenerateOptionalPropertiesAsNullable = true,
GenerateNativeRecords = true,
InlineNamedDictionaries = true, // might have been this
InlineNamedArrays = true,
RequiredPropertiesMustBeDefined = true,
}
};
var generator = new CSharpClientGenerator(document, settings);
var code = generator
.GenerateFile() |
I'm not sure reading through the thread was the resolution/workaround is for this? I have an existing API that uses several alias such as... public class ParameterValueCollection : Dictionary<string, string> How can I get these data types to be serialized correctly. I too get the error mentioned above. [2022-09-28T00:56:47.840Z] swagger.json was requested. |
Facing similar exception while using System.Text.Json as the serialization/deserialization library. Is there any solution for this yet. |
I'd really like to see a solution for this issue. My use case is that in CI, we update OAS3 specs for our APIs in APIM, but one of our endpoints returns a |
Hi team, this issue still causes production issues for us, has the issue been triaged? |
Uh oh!
There was an error while loading. Please reload this page.
Describe the issue
See minimal repro at https://github.com/johnnyreilly/azure-functions-openapi-extension-error-repro
Consider the following:
IsWorking
andIsBroken
are effectively the same. But they trigger different behaviour when used in concert withOpenApiResponseWithBody
. Here isIsBroken
:When you request the
swagger.json
you receive:However
IsWorking
... works.To Reproduce
There's a reproduction repo here: https://github.com/johnnyreilly/azure-functions-openapi-extension-error-repro
Expected behavior
IsBroken
should have the same behaviour asIsWorking
- it should not trigger the "Index was outside the bounds of the array" errorScreenshots
N/A
Environment (please complete the following information, if applicable):
N/A
Additional context
Having tested historic versions of the package, it looks like it broke between
0.8.1-preview
and0.9.0-preview
. Rolling back to0.8.1-preview
makes things work.I wonder if #247 might be the cause?
The text was updated successfully, but these errors were encountered: