From 707bf057abe09b0ae5b254df7d3ced0ca0aa5c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Verdier?= Date: Thu, 14 Dec 2023 17:42:42 -0500 Subject: [PATCH 1/2] Document JsonApiEndpoints --- .../Controllers/JsonApiEndpoints.shared.cs | 88 ++++++++++++++++++- .../JsonApiEndpointsCopy.cs | 88 ++++++++++++++++++- 2 files changed, 174 insertions(+), 2 deletions(-) diff --git a/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs b/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs index a6d11e6093..a25ef7d373 100644 --- a/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs +++ b/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs @@ -7,20 +7,106 @@ namespace JsonApiDotNetCore.Controllers; [Flags] public enum JsonApiEndpoints { + /// + /// Represents none of the JSON:API endpoints. + /// None = 0, + + /// + /// Represents the endpoint to get a collection of primary resources. Example: + /// GetCollection = 1, + + /// + /// Represents the endpoint to get a single primary resource by ID. Example: + /// GetSingle = 1 << 1, + + /// + /// Represents the endpoint to get a secondary resource or collection of secondary resources. Example: + /// Example: + /// GetSecondary = 1 << 2, + + /// + /// Represents the endpoint to get a relationship value. Example: Example: + /// + /// GetRelationship = 1 << 3, + + /// + /// Represents the endpoint to create a new resource with attributes, relationships or both. Example: + /// + /// Post = 1 << 4, + + /// + /// Represents the endpoint to add resources to a to-many relationship. Example: + /// PostRelationship = 1 << 5, + + /// + /// Represents the endpoint to update the attributes and/or relationships of an existing resource. Example: + /// + /// Patch = 1 << 6, + + /// + /// Represents the endpoint to perform a complete replacement of a relationship on an existing resource. Example: + /// Example: + /// + /// PatchRelationship = 1 << 7, + + /// + /// Represents the endpoint to delete an existing resource. Example: + /// Delete = 1 << 8, + + /// + /// Represents the endpoint to remove resources from a to-many relationship. Example: + /// + /// DeleteRelationship = 1 << 9, + /// + /// Represents the set of JSON:API endpoints to query resources and relationships. + /// Query = GetCollection | GetSingle | GetSecondary | GetRelationship, + + /// + /// Represents the set of JSON:API endpoints to change resources and relationships. + /// Command = Post | PostRelationship | Patch | PatchRelationship | Delete | DeleteRelationship, + /// + /// Represents all of the JSON:API endpoints. + /// All = Query | Command -} +} \ No newline at end of file diff --git a/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs b/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs index 911be3f359..2fd7abc682 100644 --- a/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs +++ b/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs @@ -4,20 +4,106 @@ namespace JsonApiDotNetCore.SourceGenerators; [Flags] public enum JsonApiEndpointsCopy { + /// + /// Represents none of the JSON:API endpoints. + /// None = 0, + + /// + /// Represents the endpoint to get a collection of primary resources. Example: + /// GetCollection = 1, + + /// + /// Represents the endpoint to get a single primary resource by ID. Example: + /// GetSingle = 1 << 1, + + /// + /// Represents the endpoint to get a secondary resource or collection of secondary resources. Example: + /// Example: + /// GetSecondary = 1 << 2, + + /// + /// Represents the endpoint to get a relationship value. Example: Example: + /// + /// GetRelationship = 1 << 3, + + /// + /// Represents the endpoint to create a new resource with attributes, relationships or both. Example: + /// + /// Post = 1 << 4, + + /// + /// Represents the endpoint to add resources to a to-many relationship. Example: + /// PostRelationship = 1 << 5, + + /// + /// Represents the endpoint to update the attributes and/or relationships of an existing resource. Example: + /// + /// Patch = 1 << 6, + + /// + /// Represents the endpoint to perform a complete replacement of a relationship on an existing resource. Example: + /// Example: + /// + /// PatchRelationship = 1 << 7, + + /// + /// Represents the endpoint to delete an existing resource. Example: + /// Delete = 1 << 8, + + /// + /// Represents the endpoint to remove resources from a to-many relationship. Example: + /// + /// DeleteRelationship = 1 << 9, + /// + /// Represents the set of JSON:API endpoints to query resources and relationships. + /// Query = GetCollection | GetSingle | GetSecondary | GetRelationship, + + /// + /// Represents the set of JSON:API endpoints to change resources and relationships. + /// Command = Post | PostRelationship | Patch | PatchRelationship | Delete | DeleteRelationship, + /// + /// Represents all of the JSON:API endpoints. + /// All = Query | Command -} +} \ No newline at end of file From 0ee91efc6855eba25e08a460791ad92c30677944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Verdier?= Date: Thu, 14 Dec 2023 17:54:14 -0500 Subject: [PATCH 2/2] Fix coding style --- .../Controllers/JsonApiEndpoints.shared.cs | 5 ++--- .../JsonApiEndpointsCopy.cs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs b/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs index a25ef7d373..e53c619224 100644 --- a/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs +++ b/src/JsonApiDotNetCore.Annotations/Controllers/JsonApiEndpoints.shared.cs @@ -47,8 +47,7 @@ public enum JsonApiEndpoints GetRelationship = 1 << 3, /// - /// Represents the endpoint to create a new resource with attributes, relationships or both. Example: - /// /// @@ -109,4 +108,4 @@ public enum JsonApiEndpoints /// Represents all of the JSON:API endpoints. /// All = Query | Command -} \ No newline at end of file +} diff --git a/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs b/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs index 2fd7abc682..e42e6c99a9 100644 --- a/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs +++ b/src/JsonApiDotNetCore.SourceGenerators/JsonApiEndpointsCopy.cs @@ -44,8 +44,7 @@ public enum JsonApiEndpointsCopy GetRelationship = 1 << 3, /// - /// Represents the endpoint to create a new resource with attributes, relationships or both. Example: - /// /// @@ -106,4 +105,4 @@ public enum JsonApiEndpointsCopy /// Represents all of the JSON:API endpoints. /// All = Query | Command -} \ No newline at end of file +}