Skip to content

Commit 58f5747

Browse files
committed
Auto-generated documentation from 1e8275c
1 parent 154c0d9 commit 58f5747

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

usage/common-pitfalls.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ <h4 id="jsonapi-resources-are-not-dtos-or-viewmodels">JSON:API resources are not
129129
This is only one of the issues you'll run into. Just don't go there.</p>
130130
<p>The right way to model this is by having only <code>Customer</code> instead of <code>WebCustomer</code> and <code>AdminCustomer</code>. And then:</p>
131131
<ul>
132-
<li>Hide the <code>CreditRating</code> property for web users using <a href="https://www.jsonapi.net/usage/extensibility/resource-definitions.html#excluding-fields">this</a> approach.</li>
132+
<li>Hide the <code>CreditRating</code> property for web users using <a href="extensibility/resource-definitions.html#excluding-fields">this</a> approach.</li>
133133
<li>Block web users from setting the <code>CreditRating</code> property from POST/PATCH resource endpoints by either:
134134
<ul>
135135
<li>Detecting if the <code>CreditRating</code> property has changed, such as done <a href="https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/RequestBody/WorkflowDefinition.cs">here</a>.</li>
@@ -162,6 +162,9 @@ <h4 id="stay-away-from-stored-procedures">Stay away from stored procedures</h4>
162162
<h4 id="do-not-use-apicontroller-on-jsonapi-controllers">Do not use <code>[ApiController]</code> on JSON:API controllers</h4>
163163
<p>Although recommended by Microsoft for hard-written controllers, the opinionated behavior of <a href="https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-7.0#apicontroller-attribute"><code>[ApiController]</code></a> violates the JSON:API specification.
164164
Despite JsonApiDotNetCore trying its best to deal with it, the experience won't be as good as leaving it out.</p>
165+
<h4 id="dont-use-auto-generated-controllers-with-shared-models">Don't use auto-generated controllers with shared models</h4>
166+
<p>When model classes are defined in a separate project, the controllers are generated in that project as well, which is probably not what you want.
167+
For details, see <a href="extensibility/controllers.html#auto-generated-controllers">here</a>.</p>
165168
<h4 id="registeroverride-injectable-services">Register/override injectable services</h4>
166169
<p>Register your JSON:API resource services, resource definitions and repositories with <code>services.AddResourceService/AddResourceDefinition/AddResourceRepository()</code> instead of <code>services.AddScoped()</code>.
167170
When using <a href="resource-graph.html#auto-discovery">Auto-discovery</a>, you don't need to register these at all.</p>

0 commit comments

Comments
 (0)