@@ -18,7 +18,7 @@ For pre-releases, add the [MyGet](https://www.myget.org/feed/Details/research-in
1818(https://www.myget.org/F/research-institute/api/v3/index.json )
1919to your nuget configuration.
2020
21- # Generators
21+ ## Generators
2222
2323You can install the [ Yeoman generators] ( https://github.com/Research-Institute/json-api-dotnet-core-generators )
2424to make building applications much easier.
@@ -34,7 +34,7 @@ You need to do 3 things:
3434I recommend reading the details below, but once you're familiar with the
3535setup, you can use the Yeoman generator to generate the required classes.
3636
37- ## Middleware and Services
37+ ### Middleware and Services
3838
3939Add the following to your ` Startup.ConfigureServices ` method.
4040Replace ` AppDbContext ` with your DbContext.
@@ -51,7 +51,7 @@ so there is no need to add that as well.
5151app .UseJsonApi ();
5252```
5353
54- ## Defining Models
54+ ### Defining Models
5555
5656Your models should inherit ` Identifiable<TId> ` where ` TId ` is the type of the primary key, like so:
5757
@@ -62,7 +62,7 @@ public class Person : Identifiable<Guid>
6262}
6363```
6464
65- ### Specifying Public Attributes
65+ #### Specifying Public Attributes
6666
6767If you want an attribute on your model to be publicly available,
6868add the ` AttrAttribute ` and provide the outbound name.
@@ -77,7 +77,7 @@ public class Person : Identifiable<int>
7777}
7878```
7979
80- ### Relationships
80+ #### Relationships
8181
8282In order for navigation properties to be identified in the model,
8383they should be labeled as virtual.
@@ -110,7 +110,7 @@ public class TodoItem : Identifiable<int>
110110}
111111```
112112
113- ## Defining Controllers
113+ ### Defining Controllers
114114
115115You need to create controllers that inherit from ` JsonApiController<TEntity> ` or ` JsonApiController<TEntity, TId> `
116116where ` TEntity ` is the model that inherits from ` Identifiable<TId> ` .
@@ -128,7 +128,7 @@ public class ThingsController : JsonApiController<Thing>
128128}
129129```
130130
131- ### Non-Integer Type Keys
131+ #### Non-Integer Type Keys
132132
133133If your model is using a type other than ` int ` for the primary key,
134134you should explicitly declare it in the controller
@@ -147,7 +147,7 @@ public class ThingsController : JsonApiController<Thing, Guid>
147147}
148148```
149149
150- ## Routing
150+ ### Routing
151151
152152By default the library will configure routes for each controller.
153153Based on the [ recommendations] ( http://jsonapi.org/recommendations/ )
@@ -158,7 +158,7 @@ outlined in the JSONAPI spec, routes are hyphenated. For example:
158158NOT /todoItems
159159```
160160
161- ### Namespacing and Versioning URLs
161+ #### Namespacing and Versioning URLs
162162
163163You can add a namespace to the URL by specifying it in ` ConfigureServices ` :
164164
@@ -167,7 +167,7 @@ services.AddJsonApi<AppDbContext>(
167167 opt => opt .Namespace = " api/v1" );
168168```
169169
170- ## Defining Custom Data Access Methods
170+ ### Defining Custom Data Access Methods
171171
172172You can implement custom methods for accessing the data by creating an implementation of
173173` IEntityRepository<TEntity, TId> ` . If you only need minor changes you can override the
@@ -205,7 +205,7 @@ public class MyAuthorizedEntityRepository : DefaultEntityRepository<MyEntity>
205205}
206206```
207207
208- ## Pagination
208+ ### Pagination
209209
210210Resources can be paginated.
211211The following query would set the page size to 10 and get page 2.
@@ -222,7 +222,7 @@ when setting up the services:
222222 opt => opt .DefaultPageSize = 10 );
223223```
224224
225- ## Filtering
225+ ### Filtering
226226
227227You can filter resources by attributes using the ` filter ` query parameter.
228228By default, all attributes are filterable.
@@ -243,7 +243,7 @@ identifier):
243243?filter[attribute]=ge:value
244244```
245245
246- ## Sorting
246+ ### Sorting
247247
248248Resources can be sorted by an attribute:
249249
@@ -252,9 +252,7 @@ Resources can be sorted by an attribute:
252252?sort=-attribute // descending
253253```
254254
255- # Tests
256-
257- ## Running
255+ ## Tests
258256
259257I am using DotNetCoreDocs to generate sample requests and documentation.
260258
0 commit comments