Skip to content

Incorrectly generated metadata for arrays in Swagger for .NET Core with OData #496

Closed
@Lonli-Lokli

Description

@Lonli-Lokli

Im on 3.0 version,

  1. Add this code to Functions controller
        [HttpGet]
        [ODataRoute( nameof( CountThem ) + "(Vars={vars})" )]
        [ProducesResponseType( typeof( int ), Status200OK )]
        public IActionResult CountThem( [FromODataUri] string[] vars ) => Ok( vars.Length );

And this code to AllConfigurations
builder.Function( "CountThem" ).Returns<int>().CollectionParameter<string>( "Vars" );

  1. Run Swagger
  2. Add multiple parameters line by line
  3. Press Execute

Generated url errors with 404. It looks like this
http://localhost:59918/api/CountThem(Vars={vars})?vars=111&vars=222

While for OData with Parameter Alisases this url should look like this
http://localhost:59918/api/CountThem(Vars=@vars)?@vars=[%27111%27,%27222%27]
or
http://localhost:59918/api/CountThem(Vars=[%27111%27,%27222%27])

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions