-
-
Notifications
You must be signed in to change notification settings - Fork 158
Optimize IIdentifiable to ResourceObject conversion #1028
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
Comments
Should delete |
Should also remove |
The order of resources in After that change, |
Additional changes as part of these refactorings:
|
As part of this, should fix the broken |
In JADNC, what we call the "serialization layer" actually consists of two steps: converting between
IIdentifiable
andResourceObject
and converting betweenResourceObject
and JSON. This issue concerns refactoring/redesigning/optimizing the first part, as follow-up work to #664.Goals are to optimize performance, as well as improve code clarity and reducing dependencies.
We'll need to decide what to do with the
JsonApiDotNetCore.Serialization.Client.Internal
namespace, which contains facilities to serialize a request body and deserialize a response body using the resource graph. We used this internally in the past for writing integration tests, but have stepped away from it because it hides the actual JSON data structure that goes over the wire. And it does not support all JSON:API features (such as links and meta, simply because anIIdentitiable
does not provide storage for this information).Zooming out a bit, what are the use cases for such a client library?
For integration tests, we don't need/want it anymore, because we prefer a resource-graph-agnostic approach that enables us to use the full JSON:API data structure. For example, it enables to compose invalid requests and assert the right error message is returned. Also if we break our serialization layer, we want existing tests to fail instead of silently hiding the change.
N/A. There are existing libraries at https://jsonapi.org/implementations/#client-libraries. We're investigating to add support for OpenAPI that produces a typed model based on the resource graph, but it is complicated and is going to take a while before we can deliver that.
This means the resource graph is unavailable, so we cannot provide any better experience than what existing serialization libraries such as this one already provide.
[EagerLoad]
is used. Another thing is that we take dependencies on the request execution context to make the right translation, such asHttpContext
for resolving ASP.NET routes, query strings usage, targeted fields in the JSON request body, and various other subtle details. In the API Server context, we have all these available, which enables JADNC to "understand" what is going on and produce helpful error messages, such as "ID cannot be specified in POST, unlessAllowClientGeneratedIds
is turned on". But in the API Client context, we'll need to add various pluggable extensibility points so that callers can feed in all the details. This is a lot of work to implement, but also a cumbersome experience when using it.Therefore we'd like to delete the
JsonApiDotNetCore.Serialization.Client.Internal
namespace as part of this work.The text was updated successfully, but these errors were encountered: