Commit f0d638f
Bart Koelman
Nullable reference types (#1095)
* Renamed TryXXX resource graph lookup methods to FindXXX, throwing on incoming null (not empty). Made non-public TryXXX methods tolerant against incoming nulls.
* Added directive to disable NRT in all source files
* Turn on NRT globally
* Annotated JsonApiDotNetCore library
* Use alternate public name for attribute, to improve test coverage
* Annotated example projects
* Annotated benchmark project
- Removed LinkBuilderGetNamespaceFromPathBenchmarks, we don't have such code anymore
- Cleanup query string benchmark
* Enhanced rendering of error.source.pointer on ModelState validation errors
* Respect configured MaxModelValidationErrors in operations
* Added docs for nullable reference types
* Automated cleanup code
* Fixed: do not fail when clearing a required to-many relationship
* Annotated controllers in integration tests
* Annotated DbContexts in integration tests
* Annotated fakers in integration tests
* Annotated TestBuildingBlocks
* Use Should() replacements that flow nullability
* Re-align similar testsets
* Annotated test projects, use fakers for non-trivial models in integration tests, FluentAssertions everywhere
* Fixed: make faker dates deterministic
See https://giters.com/bchavez/Bogus/issues/247
* Enable ASP.NET ModelState validation by default
Due to recent enhancements, this produces better error messages for missing required relationships and avoids 500 errors due to foreign key constraint violations.
* Check off roadmap entry
* Documented required one-to-one relationships mapping
* Added missing HEAD routes
* Prefer IDictionary<,>.TryGetValue() over .Contains() followed by indexer lookup
* Optimized response rendering time when no sparse fieldset is requested. This relies on the fact that the resource model is frozen after building the resource graph.
| Method | Mean | Error | StdDev |
| ------------------------------------ | -------- | ------- | ------- |
| SerializeOperationsResponse (before) | 168.6 us | 1.74 us | 1.63 us |
| SerializeOperationsResponse (after) | 148.5 us | 1.06 us | 0.99 us |
| SerializeResourceResponse (before) | 123.7 us | 1.12 us | 1.05 us |
| SerializeResourceResponse (after) | 119.6 us | 1.05 us | 0.98 us |
This makes SerializeOperationsResponse 12% faster and SerializeResourceResponse 3% faster. What the benchmark does not show is the performance improvement on subsequent requests, so in practice the gain in higher.
* Fixed: handle nulls in request body
* Workaround for crash in cibuild
* Update to latest JetBrains tools
In the past, [cibuild hung after update to the latest version](#1045).
Since then, the codebase has changed and a new minor version was released. These result in the cibuild no longer hanging.
Stats from my laptop (old=v2021.1.4, new=v2021.2.2):
```
master, inspectcode (old): 2:59
master, inspectcode (new): 2:00
nrt, inspectcode (old): 3:04
nrt, inspectcode (new): 2:33
master, cleanupcode (old): 11:06
master, cleanupcode (new): 5:39
nrt, cleanupcode (old): 11:59
nrt, cleanupcode (new): 6:34
```
So the newer versions got faster. And cleanupcode still takes the most time.
In this PR, 722 of 1020 files have changed, which is 70% of the total codebase.
Because during PR cibuild, we run cleanupcode only on changed files (in chunks), this PR takes very long and sometimes times out.
This is an exceptional case, future PRs shouldn't touch so many files. So in the end, I believe this update is the best way forward.
* Package updates
* Review non-public TryXXX methods
* Addressed review feedback1 parent 4a2abe9 commit f0d638f
File tree
710 files changed
+9787
-6729
lines changed- .config
- benchmarks
- Deserialization
- LinkBuilding
- QueryString
- Serialization
- docs
- getting-started
- internals
- usage
- extensibility
- resources
- writing
- src
- Examples
- GettingStarted
- Controllers
- Data
- Models
- JsonApiDotNetCoreExample
- Controllers
- Data
- Definitions
- Models
- MultiDbContextExample
- Controllers
- Data
- Models
- Properties
- NoEntityFrameworkExample
- Controllers
- Data
- Models
- Properties
- Services
- ReportsExample
- Controllers
- Models
- Properties
- Services
- JsonApiDotNetCore
- AtomicOperations
- Processors
- Configuration
- Controllers
- Annotations
- Diagnostics
- Errors
- Middleware
- Queries
- Expressions
- Internal
- Parsing
- QueryableBuilding
- QueryStrings
- Internal
- Repositories
- Resources
- Annotations
- Internal
- Serialization
- JsonConverters
- Objects
- Request
- Adapters
- Response
- Services
- test
- DiscoveryTests
- JsonApiDotNetCoreTests
- IntegrationTests
- Archiving
- AtomicOperations
- Controllers
- Creating
- Deleting
- Links
- LocalIds
- Meta
- Mixed
- ModelStateValidation
- QueryStrings
- ResourceDefinitions
- Serialization
- SparseFieldSets
- Transactions
- Updating
- Relationships
- Resources
- CompositeKeys
- ContentNegotiation
- ControllerActionResults
- CustomRoutes
- EagerLoading
- ExceptionHandling
- HostingInIIS
- IdObfuscation
- InputValidation
- ModelState
- RequestBody
- Links
- Logging
- Meta
- Microservices
- FireAndForgetDelivery
- Messages
- TransactionalOutboxPattern
- MultiTenancy
- NamingConventions
- NonJsonApiControllers
- QueryStrings
- Filtering
- Includes
- Pagination
- Sorting
- SparseFieldSets
- ReadWrite
- Creating
- Deleting
- Fetching
- Updating
- Relationships
- Resources
- RequiredRelationships
- ResourceConstructorInjection
- ResourceDefinitions
- Reading
- Serialization
- ResourceInheritance
- RestrictedControllers
- Serialization
- SoftDeletion
- ZeroKeys
- Startups
- UnitTests
- Configuration
- Links
- ModelStateValidation
- QueryStringParameters
- Serialization
- Response
- Models
- MultiDbContextTests
- NoEntityFrameworkTests
- TestBuildingBlocks
- UnitTests
- Builders
- Controllers
- Extensions
- Graph
- Internal
- Middleware
- Models
- TestModels
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
710 files changed
+9787
-6729
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
This file was deleted.
0 commit comments