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

Observe the route prefix in RestierSwaggerProvider #755

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Jan 25, 2024

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.

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.

Fixes #749

## 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.

Fixes OData#749
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

Successfully merging this pull request may close these issues.

Restier Swagger not applying route prefix
1 participant