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

Top/Skip field for OData querying becomes required after one usage #1419

Open
LiDmYr opened this issue Sep 3, 2021 · 0 comments
Open

Top/Skip field for OData querying becomes required after one usage #1419

LiDmYr opened this issue Sep 3, 2021 · 0 comments

Comments

@LiDmYr
Copy link

LiDmYr commented Sep 3, 2021

VERSION:

6.2.1

STEPS TO REPRODUCE:

  1. please clone https://github.com/dotnet/aspnet-api-versioning
  2. Run VisualStudio 2019, and Set as Startup project 'SwaggerODataSample'.
  3. modify a method SwaggerODataSample.FunctionsController.GetSalesTaxRate to the next state:
    [HttpGet]
    [ProducesResponseType( typeof( IQueryable ), Status200OK )]
    [ODataRoute( "GetSalesTaxRate(PostalCode={postalCode})" )]
    [EnableQuery( AllowedQueryOptions = AllowedQueryOptions.Top | AllowedQueryOptions.Skip | AllowedQueryOptions.Count )]
    public IQueryable GetSalesTaxRate( int postalCode )
    {
    return Enumerable.Repeat( "A", postalCode ).AsQueryable();
    }
  4. Run Solution (we already set the project 'SwaggerODataSample' as Startup).

Steps to reproduce the behavior:

  1. Go to '​/api​/GetSalesTaxRate(PostalCode={postalCode})'
  2. Click on 'Try it out'
  3. Fill 'postalCode' field with value '1'
  4. Fill 'top' field with value '1'
  5. Click on 'Execute' - should be ok response
    image
  6. Delete the value from field 'top'
  7. Click on 'Execute'
  8. See error - validation for field 'top' requires value with validation popup text 'Value must be an integer'.
    image

*BTW: 'skip' field has the same behavior.

EXPECTED RESULT:

The second 'Execute' should return values form backend.

ACTUAL RESULT:

See above in -> 'STEPS TO REPRODUCE' 8. See error - validation for field 'top' requires value with validation popup text 'Value must be an integer'.

ADDITIONAL DETAILS

I know that it can be UI issue (you wrote that it's not your responsibility), but I just use https://editor.swagger.io/ and it's not reproducible and saw that UI version is 3.52
there, but last swashbuckle uses 3.42 and it might be somehow related to the issue.
And also, it's very strange why calls without setting top or skip are working well all the time (screenshot below), but after 'top' field is used once it becomes broken, might some swashbuckle code influences on that.
image

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

1 participant