You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'
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
The text was updated successfully, but these errors were encountered:
## Before this commit
When mapping a Restier route with a non empty route prefix, the generated swagger file does not include the route prefix in the `servers[0].url` property.
```csharp
app.MapRestier(restier => restier.MapApiRoute<EntityFrameworkApi<MyDbContext>>(routeName: "RestierDefault", routePrefix: "api"));
```
❌ The generated url is `http://localhost:5000`, making all requests from SwaggerUI fail with 404 errors.
## After this commit
The route prefix is included in the generated swagger file in the `servers[0].url` property.
✅ The generated url is `http://localhost:5000/api/`, making SwaggerUI usable.
FixesOData#749
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
The text was updated successfully, but these errors were encountered: