-
-
Notifications
You must be signed in to change notification settings - Fork 158
Routing does not respect custom pluralized resource name #805
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
Merged
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
0800bb2
feat: use resource graph in routing convention rather than formatter
maurei 0d97cba
fix: discovery tests
maurei 10efa97
fix: null ref exception
maurei 6d314aa
fix: client generated id tests
maurei 22d8700
fix: self review 1
maurei 0476228
chore: rename to pluralizedResourceName
maurei af01214
fix: whitespace
maurei c2484e8
fix: enumeration exception
maurei 9ac7456
fix: remove whitespace
maurei 787002a
fix: review
maurei dc0c75a
fix: review
maurei 05f0ad9
test: resource definition discovery test
maurei 28e76fa
docs: update routing related docs
maurei 978e9dd
docs: rephrase
maurei 9d90952
chore: review
maurei d91bf76
Update routing.md
maurei 08ab1ac
Update routing.md
maurei 6496a7f
chore: trigger build
maurei aa3c122
fix: reduce amount of intermediate service providers
maurei 681d2cc
feat: configure MvcOptions in phase two, removal of intermediate serv…
maurei de23e9f
fix: tests
maurei 0b788b5
feat: remove intermediate service providers, consistent middleware co…
maurei 9a7ebe0
fix: remove unnecessary parameter usejsonapi
maurei 6ff5883
fix: review round 31/08
maurei 501e0b7
fix: merge fix attempt 1
maurei a0d4cfc
fix: docs
maurei 60b9640
fix: merge I
maurei 526b0c6
fix: merge II
maurei 21ed990
fix: docs, publicName
maurei f519342
fix: whitespace
maurei c51eea3
chore: review
maurei 234cc86
chore: review 2
maurei 21dfc9b
docs: simplify middleware extensibility docs
maurei 4262410
Changed filters and formatters to async
e9e24eb
docs: simpify routing docs
maurei e016d37
Merge branch 'fix/786' of https://github.com/json-api-dotnet/JsonApiD…
maurei 5c05503
chore: improve diff readability
maurei 685eef8
chore: diff readability, fixes
maurei 9f6a4f6
fix: more diff readability
maurei 6696492
fix: nullcheck
maurei 540bc8a
docs: resource graph builder inaccuracy
maurei 4268be1
fix: broken links markdown
maurei 234e0ec
fix: broken markdown links
maurei 39cfdde
fix: restore whitespace
maurei d60ced3
fix: diff
maurei 1cbd61f
fix: whitespace
maurei 7c65d38
chore: review
maurei e53fe67
fix: typo in docs
maurei 57eb82e
chore: discovery tests fix
maurei cd1222a
docs: improvements
maurei 0b623be
chore: review
maurei 948b72a
chore: casing convention -> naming convention
maurei 911924c
fix: update example in docs
maurei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,40 @@ | ||
# Middleware | ||
Add the following to your Startup.ConfigureServices method. Replace AppDbContext with your DbContext. | ||
|
||
```c3 | ||
services.AddJsonApi<AppDbContext>(); | ||
It is possible to replace JsonApiDotNetCore middleware components by configuring the IoC container and by configuring `MvcOptions`. | ||
|
||
## Configuring the IoC container | ||
|
||
The following example replaces the internal exception filter with a custom implementation. | ||
```c# | ||
/// In Startup.ConfigureServices | ||
services.AddService<IAsyncJsonApiExceptionFilter, CustomAsyncExceptionFilter>() | ||
``` | ||
|
||
Add the middleware to the Startup.Configure method. | ||
## Configuring `MvcOptions` | ||
|
||
The following example replaces all internal filters with a custom filter. | ||
```c# | ||
/// In Startup.ConfigureServices | ||
services.AddSingleton<CustomAsyncQueryStringActionFilter>(); | ||
|
||
var builder = services.AddMvcCore(); | ||
services.AddJsonApi<AppDbContext>(mvcBuilder: builder); | ||
|
||
```c3 | ||
app.UseRouting(); | ||
// Ensure this call is placed after the AddJsonApi call. | ||
builder.AddMvcOptions(mvcOptions => | ||
{ | ||
_postConfigureMvcOptions?.Invoke(mvcOptions); | ||
}); | ||
|
||
/// In Startup.Configure | ||
app.UseJsonApi(); | ||
|
||
// Ensure this call is placed before the UseEndpoints call. | ||
_postConfigureMvcOptions = mvcOptions => | ||
{ | ||
mvcOptions.Filters.Clear(); | ||
mvcOptions.Filters.Insert(0, app.ApplicationServices.GetService<CustomAsyncQueryStringActionFilter>()); | ||
}; | ||
|
||
app.UseEndpoints(endpoints => endpoints.MapControllers()); | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/JsonApiDotNetCore/Configuration/IJsonApiApplicationBuilder.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace JsonApiDotNetCore.Configuration | ||
{ | ||
internal interface IJsonApiApplicationBuilder | ||
{ | ||
public Action<MvcOptions> ConfigureMvcOptions { set; } | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
src/JsonApiDotNetCore/Configuration/IResourceGraphBuilder.cs
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/JsonApiDotNetCore/Configuration/IServiceDiscoveryFacade.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.