File tree 5 files changed +53
-2
lines changed
src/JsonApiDotNetCore/Builders
5 files changed +53
-2
lines changed Original file line number Diff line number Diff line change 1
- # PLACEHOLDER
2
- TODO: Add .NET projects to the * src* folder and run ` docfx ` to generate ** REAL** * API Documentation* !
1
+ # API
2
+
3
+ This section documents the package API and is generated from the XML source comments.
4
+
5
+ ## Common APIs
6
+
7
+ - [ ` JsonApiOptions ` ] ( JsonApiDotNetCore.Configuration.JsonApiOptions.html )
8
+ - [ ` IResourceGraph ` ] ( JsonApiDotNetCore.Internal.IResourceGraph.html )
9
+ - [ ` ResourceDefinition<T> ` ] ( JsonApiDotNetCore.Models.ResourceDefinition-1.html )
10
+ - [ ` IQueryAccessor ` ] ( JsonApiDotNetCore.Services.IQueryAccessor.html )
Original file line number Diff line number Diff line change @@ -81,8 +81,10 @@ public class ResourceGraphBuilder : IResourceGraphBuilder
81
81
private bool _usesDbContext ;
82
82
private IResourceNameFormatter _resourceNameFormatter = JsonApiOptions . ResourceNameFormatter ;
83
83
84
+ /// <inheritdoc />
84
85
public Link DocumentLinks { get ; set ; } = Link . All ;
85
86
87
+ /// <inheritdoc />
86
88
public IResourceGraph Build ( )
87
89
{
88
90
// this must be done at build so that call order doesn't matter
Original file line number Diff line number Diff line change 9
9
10
10
namespace JsonApiDotNetCore . Builders
11
11
{
12
+ /// <inheritdoc />
12
13
public class DocumentBuilder : IDocumentBuilder
13
14
{
14
15
private readonly IJsonApiContext _jsonApiContext ;
@@ -30,6 +31,7 @@ public DocumentBuilder(
30
31
_scopedServiceProvider = scopedServiceProvider ;
31
32
}
32
33
34
+ /// <inheritdoc />
33
35
public Document Build ( IIdentifiable entity )
34
36
{
35
37
var contextEntity = _resourceGraph . GetContextEntity ( entity . GetType ( ) ) ;
@@ -49,6 +51,7 @@ public Document Build(IIdentifiable entity)
49
51
return document ;
50
52
}
51
53
54
+ /// <inheritdoc />
52
55
public Documents Build ( IEnumerable < IIdentifiable > entities )
53
56
{
54
57
var entityType = entities . GetElementType ( ) ;
@@ -110,6 +113,7 @@ private List<ResourceObject> AppendIncludedObject(List<ResourceObject> includedO
110
113
public ResourceObject GetData ( ContextEntity contextEntity , IIdentifiable entity )
111
114
=> GetData ( contextEntity , entity , resourceDefinition : null ) ;
112
115
116
+ /// <inheritdoc />
113
117
public ResourceObject GetData ( ContextEntity contextEntity , IIdentifiable entity , IResourceDefinition resourceDefinition = null )
114
118
{
115
119
var data = new ResourceObject
Original file line number Diff line number Diff line change 1
1
namespace JsonApiDotNetCore . Builders
2
2
{
3
+ /// <summary>
4
+ /// Options used to configure how a model gets serialized into
5
+ /// a json:api document.
6
+ /// </summary>
3
7
public struct DocumentBuilderOptions
4
8
{
9
+ /// <param name="omitNullValuedAttributes">
10
+ /// Do not serialize attributes with null values.
11
+ /// </param>
5
12
public DocumentBuilderOptions ( bool omitNullValuedAttributes = false )
6
13
{
7
14
this . OmitNullValuedAttributes = omitNullValuedAttributes ;
8
15
}
9
16
17
+ /// <summary>
18
+ /// Prevent attributes with null values from being included in the response.
19
+ /// This type is mostly internal and if you want to enable this behavior, you
20
+ /// should do so on the <see ref="JsonApiDotNetCore.Configuration.JsonApiOptions" />.
21
+ /// </summary>
22
+ /// <example>
23
+ /// <code>
24
+ /// options.NullAttributeResponseBehavior = new NullAttributeResponseBehavior(true);
25
+ /// </code>
26
+ /// </example>
10
27
public bool OmitNullValuedAttributes { get ; private set ; }
11
28
}
12
29
}
Original file line number Diff line number Diff line change @@ -7,11 +7,31 @@ namespace JsonApiDotNetCore.Builders
7
7
{
8
8
public interface IDocumentBuilder
9
9
{
10
+ /// <summary>
11
+ /// Builds a json:api document from the provided resource instance.
12
+ /// </summary>
13
+ /// <param name="entity">The resource to convert.</param>
10
14
Document Build ( IIdentifiable entity ) ;
15
+
16
+ /// <summary>
17
+ /// Builds a json:api document from the provided resource instances.
18
+ /// </summary>
19
+ /// <param name="entities">The collection of resources to convert.</param>
11
20
Documents Build ( IEnumerable < IIdentifiable > entities ) ;
12
21
13
22
[ Obsolete ( "You should specify an IResourceDefinition implementation using the GetData/3 overload." ) ]
14
23
ResourceObject GetData ( ContextEntity contextEntity , IIdentifiable entity ) ;
24
+
25
+ /// <summary>
26
+ /// Create the resource object for the provided resource.
27
+ /// </summary>
28
+ /// <param name="contextEntity">The metadata for the resource.</param>
29
+ /// <param name="entity">The resource instance.</param>
30
+ /// <param name="resourceDefinition">
31
+ /// The resource definition (optional). This can be used for filtering out attributes
32
+ /// that should not be exposed to the client. For example, you might want to limit
33
+ /// the exposed attributes based on the authenticated user's role.
34
+ /// </param>
15
35
ResourceObject GetData ( ContextEntity contextEntity , IIdentifiable entity , IResourceDefinition resourceDefinition = null ) ;
16
36
}
17
37
}
You can’t perform that action at this time.
0 commit comments