RESTier icon indicating copy to clipboard operation
RESTier copied to clipboard

Restier Swagger not applying route prefix

Open DennyFiguerres opened this issue 2 years ago • 2 comments

i configured by Restier with a route prefix of 'odata' and this works when i use it directly but the swagger ui does not seem to have that and errors. example from swagger ui of wrong example: curl -X 'GET' \ 'https://localhost:7221/Addresses?%24top=100' \ -H 'accept: application/json'

it should be: curl -X 'GET' \ 'https://localhost:7221/odata/Addresses?%24top=100' \ -H 'accept: application/json'

also actual output shows :

{ "@odata.context": "https://localhost:7221/odata/$metadata#Addresses", "value": [ { "Id": 1, ... } ] }

Assemblies affected

restier swagger 1.1.0

Reproduce steps

use the sample for noerthwind and just add routprefix and try it. from my code: app.UseEndpoints(endpoints => { endpoints.Select().Expand().Filter().OrderBy().MaxTop(100).Count().SetTimeZoneInfo(TimeZoneInfo.Utc); endpoints.MapRestier(builder => { builder.MapApiRoute<RiaODataController>("v1", "odata", true); }); });

Expected result

swagger ui would show the route as curl -X 'GET' \ 'https://localhost:7221/odata/Addresses?%24top=100' \ -H 'accept: application/json' and the ui "try it" button would return data

Actual result

http error 404 - not found

DennyFiguerres avatar Nov 29 '23 18:11 DennyFiguerres

I just submitted #755 which will fix this issue.

0xced avatar Jan 25 '24 14:01 0xced