Skip to content

Commit 1e5ede0

Browse files
committed
Address PR comments
1 parent ab98e67 commit 1e5ede0

File tree

2 files changed

+122
-50
lines changed

2 files changed

+122
-50
lines changed

src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,106 +10,99 @@ namespace JsonApiDotNetCore.Controllers;
1010
[Flags]
1111
public enum JsonApiEndpoints
1212
{
13+
/// <summary>
14+
/// Represents none of the JSON:API endpoints.
15+
/// </summary>
1316
None = 0,
1417

1518
/// <summary>
16-
/// Endpoint to get a collection of primary resources.
19+
/// Represents the endpoint to get a collection of primary resources. Example: <code><![CDATA[
20+
/// GET /articles HTTP/1.1
21+
/// ]]></code>
1722
/// </summary>
18-
/// <example>
19-
/// <code><![CDATA[GET /articles]]></code>
20-
/// </example>
2123
GetCollection = 1,
2224

2325
/// <summary>
24-
/// Endpoint to get a single primary resource by ID.
26+
/// Represents the endpoint to get a single primary resource by ID. Example: <code><![CDATA[
27+
/// GET /articles/1 HTTP/1.1
28+
/// ]]></code>
2529
/// </summary>
26-
/// <example>
27-
/// <code><![CDATA[GET /articles/1]]></code>
28-
/// </example>
2930
GetSingle = 1 << 1,
3031

3132
/// <summary>
32-
/// Endpoint to get a secondary resource or collection of secondary resources.
33+
/// Represents the endpoint to get a secondary resource or collection of secondary resources. Example: <code><![CDATA[
34+
/// GET /articles/1/author HTTP/1.1
35+
/// ]]></code>
3336
/// </summary>
34-
/// <example>
35-
/// <code><![CDATA[GET /articles/1/author]]></code>
36-
/// </example>
3737
GetSecondary = 1 << 2,
3838

3939
/// <summary>
40-
/// Endpoint to get a relationship value, which can be a <c>null</c>, a single object or a collection.
40+
/// Represents the endpoint to get a relationship value. Example: <code><![CDATA[
41+
/// GET /articles/1/relationships/author HTTP/1.1
42+
/// ]]></code> Example:
43+
/// <code><![CDATA[
44+
/// GET /articles/1/relationships/revisions HTTP/1.1
45+
/// ]]></code>
4146
/// </summary>
42-
/// <example>
43-
/// <code><![CDATA[GET /articles/1/relationships/author]]></code>
44-
/// </example>
45-
/// <example>
46-
/// <code><![CDATA[GET /articles/1/relationships/revisions]]></code>
47-
/// </example>
4847
GetRelationship = 1 << 3,
4948

5049
/// <summary>
51-
/// Endpoint to creates a new resource with attributes, relationships or both.
50+
/// Represents the endpoint to creates a new resource with attributes, relationships or both. Example: <code><![CDATA[
51+
/// POST /articles HTTP/1.1
52+
/// ]]></code>
5253
/// </summary>
53-
/// <example>
54-
/// <code><![CDATA[POST /articles]]></code>
55-
/// </example>
5654
Post = 1 << 4,
5755

5856
/// <summary>
59-
/// Endpoint to add resources to a to-many relationship.
57+
/// Represents the endpoint to add resources to a to-many relationship. Example: <code><![CDATA[
58+
/// POST /articles/1/revisions HTTP/1.1
59+
/// ]]></code>
6060
/// </summary>
61-
/// <example>
62-
/// <code><![CDATA[POST /articles/1/revisions]]></code>
63-
/// </example>
6461
PostRelationship = 1 << 5,
6562

6663
/// <summary>
67-
/// Endpoint to update the attributes and/or relationships of an existing resource.
64+
/// Represents the endpoint to update the attributes and/or relationships of an existing resource. Example: <code><![CDATA[
65+
/// PATCH /articles/1
66+
/// ]]></code>
6867
/// </summary>
69-
/// <example>
70-
/// <code><![CDATA[PATCH /articles/1]]></code>
71-
/// </example>
7268
Patch = 1 << 6,
7369

7470
/// <summary>
75-
/// Endpoint to perform a complete replacement of a relationship on an existing resource.
71+
/// Represents the endpoint to perform a complete replacement of a relationship on an existing resource. Example: <code><![CDATA[
72+
/// PATCH /articles/1/relationships/author HTTP/1.1
73+
/// ]]></code> Example:
74+
/// <code><![CDATA[
75+
/// PATCH /articles/1/relationships/revisions HTTP/1.1
76+
/// ]]></code>
7677
/// </summary>
77-
/// <example>
78-
/// <code><![CDATA[PATCH /articles/1/relationships/author]]></code>
79-
/// </example>
80-
/// <example>
81-
/// <code><![CDATA[PATCH /articles/1/relationships/revisions]]></code>
82-
/// </example>
8378
PatchRelationship = 1 << 7,
8479

8580
/// <summary>
86-
/// Endpoint to delete an existing resource.
81+
/// Represents the endpoint to delete an existing resource. Example: <code><![CDATA[
82+
/// DELETE /articles/1
83+
/// ]]></code>
8784
/// </summary>
88-
/// <example>
89-
/// <code><![CDATA[DELETE /articles/1]]></code>
90-
/// </example>
9185
Delete = 1 << 8,
9286

9387
/// <summary>
94-
/// Endpoint to remove resources from a to-many relationship.
88+
/// Represents the endpoint to remove resources from a to-many relationship. Example: <code><![CDATA[
89+
/// DELETE /articles/1/relationships/revisions
90+
/// ]]></code>
9591
/// </summary>
96-
/// <example>
97-
/// <code><![CDATA[DELETE /articles/1/relationships/revisions]]></code>
98-
/// </example>
9992
DeleteRelationship = 1 << 9,
10093

10194
/// <summary>
102-
/// All read-only endpoints.
95+
/// Represents the set of JSON:API endpoints to query resources and relationships.
10396
/// </summary>
10497
Query = GetCollection | GetSingle | GetSecondary | GetRelationship,
10598

10699
/// <summary>
107-
/// All write endpoints.
100+
/// Represents the set of JSON:API endpoints to change resources and relationships.
108101
/// </summary>
109102
Command = Post | PostRelationship | Patch | PatchRelationship | Delete | DeleteRelationship,
110103

111104
/// <summary>
112-
/// All endpoints.
105+
/// Represents all of the JSON:API endpoints.
113106
/// </summary>
114107
All = Query | Command
115108
}

src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,101 @@ namespace JsonApiDotNetCore.SourceGenerators;
22

33
// IMPORTANT: A copy of this type exists in the JsonApiDotNetCore project. Keep these in sync when making changes.
44
[Flags]
5-
public enum JsonApiEndpointsCopy
5+
public enum JsonApiEndpoints
66
{
7+
/// <summary>
8+
/// Represents none of the JSON:API endpoints.
9+
/// </summary>
710
None = 0,
11+
12+
/// <summary>
13+
/// Represents the endpoint to get a collection of primary resources. Example: <code><![CDATA[
14+
/// GET /articles HTTP/1.1
15+
/// ]]></code>
16+
/// </summary>
817
GetCollection = 1,
18+
19+
/// <summary>
20+
/// Represents the endpoint to get a single primary resource by ID. Example: <code><![CDATA[
21+
/// GET /articles/1 HTTP/1.1
22+
/// ]]></code>
23+
/// </summary>
924
GetSingle = 1 << 1,
25+
26+
/// <summary>
27+
/// Represents the endpoint to get a secondary resource or collection of secondary resources. Example: <code><![CDATA[
28+
/// GET /articles/1/author HTTP/1.1
29+
/// ]]></code>
30+
/// </summary>
1031
GetSecondary = 1 << 2,
32+
33+
/// <summary>
34+
/// Represents the endpoint to get a relationship value. Example: <code><![CDATA[
35+
/// GET /articles/1/relationships/author HTTP/1.1
36+
/// ]]></code> Example:
37+
/// <code><![CDATA[
38+
/// GET /articles/1/relationships/revisions HTTP/1.1
39+
/// ]]></code>
40+
/// </summary>
1141
GetRelationship = 1 << 3,
42+
43+
/// <summary>
44+
/// Represents the endpoint to creates a new resource with attributes, relationships or both. Example: <code><![CDATA[
45+
/// POST /articles HTTP/1.1
46+
/// ]]></code>
47+
/// </summary>
1248
Post = 1 << 4,
49+
50+
/// <summary>
51+
/// Represents the endpoint to add resources to a to-many relationship. Example: <code><![CDATA[
52+
/// POST /articles/1/revisions HTTP/1.1
53+
/// ]]></code>
54+
/// </summary>
1355
PostRelationship = 1 << 5,
56+
57+
/// <summary>
58+
/// Represents the endpoint to update the attributes and/or relationships of an existing resource. Example: <code><![CDATA[
59+
/// PATCH /articles/1
60+
/// ]]></code>
61+
/// </summary>
1462
Patch = 1 << 6,
63+
64+
/// <summary>
65+
/// Represents the endpoint to perform a complete replacement of a relationship on an existing resource. Example: <code><![CDATA[
66+
/// PATCH /articles/1/relationships/author HTTP/1.1
67+
/// ]]></code> Example:
68+
/// <code><![CDATA[
69+
/// PATCH /articles/1/relationships/revisions HTTP/1.1
70+
/// ]]></code>
71+
/// </summary>
1572
PatchRelationship = 1 << 7,
73+
74+
/// <summary>
75+
/// Represents the endpoint to delete an existing resource. Example: <code><![CDATA[
76+
/// DELETE /articles/1
77+
/// ]]></code>
78+
/// </summary>
1679
Delete = 1 << 8,
80+
81+
/// <summary>
82+
/// Represents the endpoint to remove resources from a to-many relationship. Example: <code><![CDATA[
83+
/// DELETE /articles/1/relationships/revisions
84+
/// ]]></code>
85+
/// </summary>
1786
DeleteRelationship = 1 << 9,
1887

88+
/// <summary>
89+
/// Represents the set of JSON:API endpoints to query resources and relationships.
90+
/// </summary>
1991
Query = GetCollection | GetSingle | GetSecondary | GetRelationship,
92+
93+
/// <summary>
94+
/// Represents the set of JSON:API endpoints to change resources and relationships.
95+
/// </summary>
2096
Command = Post | PostRelationship | Patch | PatchRelationship | Delete | DeleteRelationship,
2197

98+
/// <summary>
99+
/// Represents all of the JSON:API endpoints.
100+
/// </summary>
22101
All = Query | Command
23102
}

0 commit comments

Comments
 (0)