-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
Redesign conversion between JSON objects and ASP.NET models #1091
Commits on Sep 20, 2021
-
Bart Koelman committed
Sep 20, 2021 Configuration menu - View commit details
-
Copy full SHA for 8534c41 - Browse repository at this point
Copy the full SHA 8534c41View commit details
Commits on Sep 29, 2021
-
Fixed: do not duplicate the list of JSON:API errors in meta stack tra…
…ce, but do write them when logging
Bart Koelman committedSep 29, 2021 Configuration menu - View commit details
-
Copy full SHA for f502628 - Browse repository at this point
Copy the full SHA f502628View commit details -
Breaking: Added option to write request body in meta when unable to r…
…ead it (false by default)
Bart Koelman committedSep 29, 2021 Configuration menu - View commit details
-
Copy full SHA for afe119d - Browse repository at this point
Copy the full SHA afe119dView commit details -
Breaking: Added option to allow unknown attribute/relationship keys i…
…n request body (false by default)
Bart Koelman committedSep 29, 2021 Configuration menu - View commit details
-
Copy full SHA for 2b47438 - Browse repository at this point
Copy the full SHA 2b47438View commit details -
Bart Koelman committed
Sep 29, 2021 Configuration menu - View commit details
-
Copy full SHA for 2b1c32b - Browse repository at this point
Copy the full SHA 2b1c32bView commit details
Commits on Sep 30, 2021
-
Rewrite of reading the request body and converting it into models.
The existing validation logic inside controllers, JsonApiReader and RequestDeserializer/BaseDeserializer has been consolidated into a set of adapters that delegate to each other, passing along the current state. The dependency on `HttpContext` has been removed and similar errors are now grouped, in preparation to unify them. Because in this commit we always track the location of errors and write them to `error.source.pointer`, the error messages can be unified and simplified in future commits. In this commit, I've gone through great lenghts to preserve the existing error messages in our tests as much as possible, while keeping all tests green. All error tests in ReadWrite and Operations now have assertions on the source pointer. Added tests for missing/invalid 'data' in resource requests. Removed outdated unit tests and added new one for handling attributes of various CLR types. Updated benchmark code. The synthetic BenchmarkDotNet reports it has become 3-7% slower (we're talking microseconds here) compared to the old code. But when running full requests with our pipeline-instrumentation turned on, the difference falls in the range of background noise and is thus unmeasurable. ``` BEFORE: Read request body ............................... 0:00:00:00.0000167 ... 1.08% } 167 + 434 = 601 JsonSerializer.Deserialize .................... 0:00:00:00.0000560 ... 3.62% + Deserializer.Build (single) ................... 0:00:00:00.0000434 ... 2.80% } AFTER: Read request body ............................... 0:00:00:00.0000511 ... 3.43% JsonSerializer.Deserialize .................... 0:00:00:00.0000537 ... 3.61% ```
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for 0192e39 - Browse repository at this point
Copy the full SHA 0192e39View commit details -
Updated error message for unknown attribute/relationship
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for d247ba2 - Browse repository at this point
Copy the full SHA d247ba2View commit details -
Updated error message for unknown resource type
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for 8dbafd2 - Browse repository at this point
Copy the full SHA 8dbafd2View commit details -
Unified error messages about the absense or presense of 'id' and 'lid'
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for d243dc3 - Browse repository at this point
Copy the full SHA d243dc3View commit details -
Unified error messages about the absense of 'type'
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for 4c3bf71 - Browse repository at this point
Copy the full SHA 4c3bf71View commit details -
Unified error messages about incompatible types
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for 1700c00 - Browse repository at this point
Copy the full SHA 1700c00View commit details -
Revert the use of different exception, because this way the request b…
…ody does not get added to the error response meta
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for d4549e8 - Browse repository at this point
Copy the full SHA d4549e8View commit details -
Unified error messages about mismatches in 'id' and 'lid' values
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for c2e31d3 - Browse repository at this point
Copy the full SHA c2e31d3View commit details -
Additional unification of error messages
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for 5ea961f - Browse repository at this point
Copy the full SHA 5ea961fView commit details -
Unified error messages for failed type conversion
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for 6244ef7 - Browse repository at this point
Copy the full SHA 6244ef7View commit details -
Bart Koelman committed
Sep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for 72f02b0 - Browse repository at this point
Copy the full SHA 72f02b0View commit details -
Unified error messages about data presense and its value: null/object…
…/array
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for fe10147 - Browse repository at this point
Copy the full SHA fe10147View commit details -
Unified remaining error messages
Bart Koelman committedSep 30, 2021 Configuration menu - View commit details
-
Copy full SHA for 2322ac8 - Browse repository at this point
Copy the full SHA 2322ac8View commit details
Commits on Oct 1, 2021
-
Sealed types and reduced dependencies
Bart Koelman committedOct 1, 2021 Configuration menu - View commit details
-
Copy full SHA for d254ac9 - Browse repository at this point
Copy the full SHA d254ac9View commit details -
Bart Koelman committed
Oct 1, 2021 Configuration menu - View commit details
-
Copy full SHA for 0923c8b - Browse repository at this point
Copy the full SHA 0923c8bView commit details -
- IOperationsDocumentAdapter -> IDocumentInOperationsRequestAdapter - IResourceDocumentAdapter -> IDocumentInResourceOrRelationshipRequestAdapter - IOperationResourceDataAdapter -> IResourceDataInOperationsRequestAdapter
Bart Koelman committedOct 1, 2021 Configuration menu - View commit details
-
Copy full SHA for 6e0d287 - Browse repository at this point
Copy the full SHA 6e0d287View commit details -
Added missing assertions on request body in error meta
Bart Koelman committedOct 1, 2021 Configuration menu - View commit details
-
Copy full SHA for 169acc7 - Browse repository at this point
Copy the full SHA 169acc7View commit details
Commits on Oct 4, 2021
-
- Changed deserializer to accept Error(s) instead of Document (used to be ErrorDocument, but they were merged) - Write request body in error meta instead of top-level meta - Fixed: Log at Error instead of Info when processing an operation throws unknown error
Bart Koelman committedOct 4, 2021 Configuration menu - View commit details
-
Copy full SHA for 317f293 - Browse repository at this point
Copy the full SHA 317f293View commit details -
Enhanced existing tests: Assert on resource type when
included
cont……ains mixed types
Bart Koelman committedOct 4, 2021 Configuration menu - View commit details
-
Copy full SHA for 65b1f03 - Browse repository at this point
Copy the full SHA 65b1f03View commit details
Commits on Oct 5, 2021
-
Fixed the number of resource definition callbacks for sparse fieldsets
Bart Koelman committedOct 5, 2021 Configuration menu - View commit details
-
Copy full SHA for 5198265 - Browse repository at this point
Copy the full SHA 5198265View commit details -
Refactor: removed OperationContainer.Kind because IJsonApiRequest.Wri…
…teOperation is now populated consistently; applied c# pattern usage
Bart Koelman committedOct 5, 2021 Configuration menu - View commit details
-
Copy full SHA for 64cc4e2 - Browse repository at this point
Copy the full SHA 64cc4e2View commit details -
Added test to capture the current behavior to return data:null for vo…
…id operations. The spec allows an empty object too, but I don't consider this important enough to add yet another JSON converter with all its overhead.
Bart Koelman committedOct 5, 2021 Configuration menu - View commit details
-
Copy full SHA for 1e6d18e - Browse repository at this point
Copy the full SHA 1e6d18eView commit details
Commits on Oct 6, 2021
-
Bart Koelman committed
Oct 6, 2021 Configuration menu - View commit details
-
Copy full SHA for cab3dc6 - Browse repository at this point
Copy the full SHA cab3dc6View commit details -
Rewrite of rendering the response body from models
- Added temporary bridge class to toggle between old/new code - Fixed: Missing top-level link in error- and operations response - Fixed: `ILinkBuilder.GetResourceLinks` was also used to render relationship links - IJsonApiRequest management: restore backup after processing operations - Refreshed serialization benchmarks Measurement results for GET http://localhost:14140/api/v1/todoItems?include=owner,assignee,tags: Write response body ............................ 0:00:00:00.0010385 -> 0:00:00:00.0013343 = 130% Measurement results for GET http://localhost:14140/api/v1/todoItems?filter=and(startsWith(description,'T'),equals(priority,'Low'),not(equals(owner,null)),not(equals(assignee,null))): Write response body ............................ 0:00:00:00.0006601 -> 0:00:00:00.0004624 = 70% Measurement results for POST http://localhost:14140/api/v1/operations (10x add-resource): Write response body ............................ 0:00:00:00.0003432 -> 0:00:00:00.0003289 = 95% | Method | Mean | Error | StdDev | |---------------------------------- |---------:|--------:|--------:| | SerializeOperationsResponse | 153.8 us | 0.72 us | 0.60 us | | LegacySerializeOperationsResponse | 239.0 us | 3.17 us | 2.81 us | | Method | Mean | Error | StdDev | |-------------------------------- |---------:|--------:|--------:| | SerializeResourceResponse | 101.3 us | 0.31 us | 0.29 us | | LegacySerializeResourceResponse | 177.6 us | 0.56 us | 0.50 us |
Bart Koelman committedOct 6, 2021 Configuration menu - View commit details
-
Copy full SHA for d8510aa - Browse repository at this point
Copy the full SHA d8510aaView commit details -
Avoid closure in hot code path to reduce allocations
Bart Koelman committedOct 6, 2021 Configuration menu - View commit details
-
Copy full SHA for 055b93f - Browse repository at this point
Copy the full SHA 055b93fView commit details -
Bart Koelman committed
Oct 6, 2021 Configuration menu - View commit details
-
Copy full SHA for a7c6009 - Browse repository at this point
Copy the full SHA a7c6009View commit details
Commits on Oct 8, 2021
-
Bart Koelman committed
Oct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for 428b06b - Browse repository at this point
Copy the full SHA 428b06bView commit details -
Fixed: crash in test serializer on assertion failure
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for 05f155e - Browse repository at this point
Copy the full SHA 05f155eView commit details -
Removed RequestScopedServiceProvider
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for fbdcefb - Browse repository at this point
Copy the full SHA fbdcefbView commit details -
Use sets for include expressions
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for 7fcb58e - Browse repository at this point
Copy the full SHA 7fcb58eView commit details -
Fixed: return Content-Length header in HEAD response
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for f8d71f2 - Browse repository at this point
Copy the full SHA f8d71f2View commit details -
Reorganized JADNC.Serialization namespace
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for ff763f1 - Browse repository at this point
Copy the full SHA ff763f1View commit details -
Created custom exception for remaining errors
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for 80fe2b2 - Browse repository at this point
Copy the full SHA 80fe2b2View commit details -
Fixed: call ResourceDefinition.OnApplyIncludes for all children, even…
… when empty
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for f6caf3a - Browse repository at this point
Copy the full SHA f6caf3aView commit details -
Renamed ResourceContext to ResourceType and exposed it through relati…
…onship left/right. This enabled to reduce many resource graph lookups from the codebase.
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for 0efde1b - Browse repository at this point
Copy the full SHA 0efde1bView commit details -
Moved logic to build resource graph from DbContext into ResourceGraph…
…Builder for easier reuse.
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for f7e7da4 - Browse repository at this point
Copy the full SHA f7e7da4View commit details -
Opened up ResponseModelAdapter for extensibility
Bart Koelman committedOct 8, 2021 Configuration menu - View commit details
-
Copy full SHA for 3d98057 - Browse repository at this point
Copy the full SHA 3d98057View commit details
Commits on Oct 11, 2021
-
Bart Koelman committed
Oct 11, 2021 Configuration menu - View commit details
-
Copy full SHA for 2e3659f - Browse repository at this point
Copy the full SHA 2e3659fView commit details
Commits on Oct 20, 2021
-
Bart Koelman committed
Oct 20, 2021 Configuration menu - View commit details
-
Copy full SHA for 2c4e75c - Browse repository at this point
Copy the full SHA 2c4e75cView commit details
Commits on Oct 25, 2021
-
Bart Koelman committed
Oct 25, 2021 Configuration menu - View commit details
-
Copy full SHA for 7158595 - Browse repository at this point
Copy the full SHA 7158595View commit details -
Added extra test for data:null in relationship
Bart Koelman committedOct 25, 2021 Configuration menu - View commit details
-
Copy full SHA for 7c6684f - Browse repository at this point
Copy the full SHA 7c6684fView commit details -
Added test for broken resource linkage
Bart Koelman committedOct 25, 2021 Configuration menu - View commit details
-
Copy full SHA for 4a8bfdd - Browse repository at this point
Copy the full SHA 4a8bfddView commit details
Commits on Oct 26, 2021
-
Ported existing unit tests and changed how included[] is built.
It now always emits related resources in relationship declaration order, even in deeply nested circular chains where a subsequent inclusion chain is deeper and adds more relationships to an already converted resource. Performance impact, summary: - In the endpoint test, this commit improves performance for rendering includes, while slightly decreasing it for the other two scenarios. All are still faster or the same compared to the master branch. - In BenchmarkDotNet, this commit slightly increases rendering time, compared to earlier commits in this PR, but it is still faster than the master branch. Measurement results for GET http://localhost:14140/api/v1/todoItems?include=owner,assignee,tags: Write response body ............................. 0:00:00:00.0010385 -> 0:00:00:00.0008060 ... 77% (was: 130%) Measurement results for GET http://localhost:14140/api/v1/todoItems?filter=and(startsWith(description,'T'),equals(priority,'Low'),not(equals(owner,null)),not(equals(assignee,null))): Write response body ............................. 0:00:00:00.0006601 -> 0:00:00:00.0005629 ... 85% (was: 70%) Measurement results for POST http://localhost:14140/api/v1/operations (10x add-resource): Write response body ............................. 0:00:00:00.0003432 -> 0:00:00:00.0003411 ... 99% (was: 95%) | Method | Mean | Error | StdDev | |---------------------------------- |---------:|--------:|--------:| | LegacySerializeOperationsResponse | 239.0 us | 3.17 us | 2.81 us | | SerializeOperationsResponse | 153.8 us | 0.72 us | 0.60 us | | (new) SerializeOperationsResponse | 168.6 us | 1.74 us | 1.63 us | | Method | Mean | Error | StdDev | |-------------------------------- |---------:|--------:|--------:| | LegacySerializeResourceResponse | 177.6 us | 0.56 us | 0.50 us | | SerializeResourceResponse | 101.3 us | 0.31 us | 0.29 us | | (new) SerializeResourceResponse | 123.7 us | 1.12 us | 1.05 us |
Bart Koelman committedOct 26, 2021 Configuration menu - View commit details
-
Copy full SHA for 0f41f85 - Browse repository at this point
Copy the full SHA 0f41f85View commit details -
Bart Koelman committed
Oct 26, 2021 Configuration menu - View commit details
-
Copy full SHA for 5dfb6ea - Browse repository at this point
Copy the full SHA 5dfb6eaView commit details