-
Notifications
You must be signed in to change notification settings - Fork 45
Document alternative way to integrate with AspNetCore #58
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
base: master
Are you sure you want to change the base?
Conversation
|
@btecu Looks promising. But i get the following error: Do you have any idea where this comes from? |
|
@svschannak are you importing |
|
I think the i.e It is a pretty slick way to configure it, certainly a lot simpler than the currently documented way. If you update the PR with the correct code and include the |
|
The generated Json is incorrect when rendered by my Action when I do it this way. The method here #35 (comment) works as expected for me. |
|
I also developed an alternative way for integrating with AspNetCore. With this you can do: I created a fork and added a new project to keep the core project clean of other external dependencies. @alex-davies What do you think? (tag @btecu ) edit: With this you can do content negotiation (https://docs.microsoft.com/en-us/aspnet/core/web-api/advanced/formatting?view=aspnetcore-2.2#content-negotiation) based on the Accept header provided by the caller. So instead of overriding the JsonFormatter implementation, a new JsonApiFormatter is added which will respond on application/vnd.api+json and the original JsonFormatter will respond on application/json. Ofcourse Mvc allows you to force a particular format (https://docs.microsoft.com/en-us/aspnet/core/web-api/advanced/formatting?view=aspnetcore-2.2#forcing-a-particular-format) |
This is how I have it working in my project. I never set it the way it's currently documented and I'm not completely sure if there's any difference.
Both input and output work for me.