Closed sergey-litvinov-work closed 4 years ago
@sergey-litvinov-work do you think this is now ready to be merged? I don't see anything wrong with it, but not sure if you're working on it still.
@joukevandermaas yep, i think it's ready to be merged. i tested it for our case and it works great. if something would be missing i'll make another PR but for now it looks great Thanks!
Hi Jouke,
here is the change that i mentioned in #241 . basically i made
The first one called in
Saule/Http/PreprocessingDelegatingHandler.cs
and it creates a specific provider based on the current http request. And then it uses createdIApiResourceProvider
and passes it toSaule/Serialization/ResourceGraph.cs
andSaule/Serialization/ResourceSerializer.cs
. And they are calling it with current data object and it returnsApiResource
.In the default implementation it uses the same
request.Properties.TryGetValue(Constants.PropertyNames.ResourceDescriptor, out object resource)
and then it always returns it. But potentially if consumer wants, it can have custom implementation that won't depend onReturnsResourceAttribute
and can makeApiResource
based on own rules.In our case we are creating specific resource based on the specific type.
I added 3 new unit tests
Tests/Integration/JsonApiFormatterInheritenceTests.cs
that validates it. And also as i changedApiResource
parameter toIApiResourceProvider
inResourceSerializer
- i updated a bunch of unit tests to wrap existingApiResource
providerI'll check it tomorrow to be sure that i didn't miss something but it should be ready for the review