Skip to content

ODataModelBuilder EntitySet.EntityType.Page() does not result in $top or $skip params being included in ApiExplorer (Swagger) #702

Closed
@engenb

Description

@engenb

Hello again,

Been appreciating the help I've been getting so far! Two issues here which I can split if that's more helpful.

The main issue (for which I don't have a workaround) is when I configure an EntityTypeConfiguration with .Page(), the corresponding $top and $skip query parameters are not presented in the ApiExplorer/Swagger.

var fooType = builder.EntitySet<Foo>("Foos").EntityType;

fooType.HasMany(x => x.Bars);

fooType.HasKey(x => x.Id)
	.Count()
	.Page()
	.Select()
	.Filter()
	.Expand(SelectExpandType.Allowed)
	.OrderBy();

...

[ApiVersion("1")]
[ODataRoutePrefix("Foos")]
[Consumes("application/json")]
[Produces("application/json")]
public class FoosController : ODataController
{		
	[HttpGet]
	[ODataRoute]
	[Produces("application/json")]
	[ProducesResponseType(typeof(ODataValue<IEnumerable<Foo>>), Status200OK)]
	public IActionResult Get(ODataQueryOptions<Foo> options)
	{
		...
	}
}

In the above example, $select, $expand, $filter, $orderby, and $count all show up, but $top and $skip do not.

Sample project here.

The second issue I noticed can be demonstrated in the FoosController in the above project as well. If the method Get above is named GetFoos it doesn't show up in ApiExplorer/Swagger as I would expect, based on documented routing conventions. These docs don't mention usage of ODataQueryOptions<> so maybe this behavior doesn't apply? Just thought I'd mention this in case it's an issue. My main priority is the $top/$skip issue as a working Swagger app for every API at my company is a table-stakes requirement.

Thanks again!

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions