From 23f2d2987f79ac550cb43f740c62fbecef2df375 Mon Sep 17 00:00:00 2001 From: Eddy Ashton Date: Thu, 11 Jul 2024 15:35:25 +0100 Subject: [PATCH] Mark all classic gov endpoints as deprecated in generated OpenAPI (#6355) --- doc/schemas/app_openapi.json | 6 +- doc/schemas/gov_openapi.json | 100 +++++++++++++++++++-- doc/schemas/node_openapi.json | 6 +- include/ccf/endpoint.h | 8 ++ samples/apps/logging/logging.cpp | 2 +- src/endpoints/common_endpoint_registry.cpp | 7 +- src/endpoints/endpoint.cpp | 11 +++ src/node/rpc/member_frontend.h | 47 ++++++---- src/node/rpc/node_frontend.h | 2 +- 9 files changed, 154 insertions(+), 35 deletions(-) diff --git a/doc/schemas/app_openapi.json b/doc/schemas/app_openapi.json index 125a1350bc49..2d9ba488f55b 100644 --- a/doc/schemas/app_openapi.json +++ b/doc/schemas/app_openapi.json @@ -263,7 +263,7 @@ "info": { "description": "This CCF sample app implements a simple logging application, securely recording messages at client-specified IDs. It demonstrates most of the features available to CCF apps.", "title": "CCF Sample Logging App", - "version": "2.4.1" + "version": "2.4.2" }, "openapi": "3.0.0", "paths": { @@ -294,7 +294,7 @@ "/app/code": { "get": { "deprecated": true, - "description": "Permitted SGX code identities", + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/service/join-policy", "operationId": "GetAppCode", "responses": { "200": { @@ -311,7 +311,7 @@ "$ref": "#/components/responses/default" } }, - "summary": "This endpoint is deprecated. It is replaced by /gov/kv/nodes/code_ids endpoint", + "summary": "Permitted SGX code identities", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } diff --git a/doc/schemas/gov_openapi.json b/doc/schemas/gov_openapi.json index 5f17a2d971c8..f679b85398b9 100644 --- a/doc/schemas/gov_openapi.json +++ b/doc/schemas/gov_openapi.json @@ -1351,12 +1351,14 @@ "info": { "description": "This API is used to submit and query proposals which affect CCF's public governance tables.", "title": "CCF Governance API", - "version": "4.2.8" + "version": "4.3.0" }, "openapi": "3.0.0", "paths": { "/gov/ack": { "post": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by POST /gov/members/state-digests/{memberId}:ack", "operationId": "PostGovAck", "requestBody": { "content": { @@ -1389,6 +1391,8 @@ }, "/gov/ack/update_state_digest": { "post": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by POST /gov/members/state-digests/{memberId}:update", "operationId": "PostGovAckUpdateStateDigest", "responses": { "200": { @@ -1443,7 +1447,7 @@ "/gov/code": { "get": { "deprecated": true, - "description": "Permitted SGX code identities", + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/service/join-policy", "operationId": "GetGovCode", "responses": { "200": { @@ -1460,7 +1464,7 @@ "$ref": "#/components/responses/default" } }, - "summary": "This endpoint is deprecated. It is replaced by /gov/kv/nodes/code_ids endpoint", + "summary": "Permitted SGX code identities", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1511,6 +1515,8 @@ }, "/gov/encrypted_recovery_share/{member_id}": { "get": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/recovery/encrypted-shares/{memberId}", "operationId": "GetGovEncryptedRecoveryShareMemberId", "responses": { "200": { @@ -1546,6 +1552,7 @@ "/gov/jwt_keys/all": { "get": { "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by POST /gov/service/jwk", "operationId": "GetGovJwtKeysAll", "responses": { "200": { @@ -1562,7 +1569,6 @@ "$ref": "#/components/responses/default" } }, - "summary": "This endpoint is deprecated. It is replaced by /gov/kv/jwt/public_signing_keys_metadata and /gov/kv/jwt/issuers endpoints.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/always" } @@ -1570,6 +1576,7 @@ }, "/gov/kv/constitution": { "get": { + "deprecated": true, "operationId": "GetGovKvConstitution", "responses": { "200": { @@ -1586,6 +1593,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1593,6 +1601,7 @@ }, "/gov/kv/cose_history": { "get": { + "deprecated": true, "operationId": "GetGovKvCoseHistory", "responses": { "200": { @@ -1609,6 +1618,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1616,6 +1626,7 @@ }, "/gov/kv/cose_recent_proposals": { "get": { + "deprecated": true, "operationId": "GetGovKvCoseRecentProposals", "responses": { "200": { @@ -1632,6 +1643,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1639,6 +1651,7 @@ }, "/gov/kv/endpoints": { "get": { + "deprecated": true, "operationId": "GetGovKvEndpoints", "responses": { "200": { @@ -1655,6 +1668,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1662,6 +1676,7 @@ }, "/gov/kv/history": { "get": { + "deprecated": true, "operationId": "GetGovKvHistory", "responses": { "200": { @@ -1678,6 +1693,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1685,6 +1701,7 @@ }, "/gov/kv/interpreter/flush": { "get": { + "deprecated": true, "operationId": "GetGovKvInterpreterFlush", "responses": { "200": { @@ -1701,6 +1718,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1708,6 +1726,7 @@ }, "/gov/kv/js_runtime_options": { "get": { + "deprecated": true, "operationId": "GetGovKvJsRuntimeOptions", "responses": { "200": { @@ -1724,6 +1743,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1731,6 +1751,7 @@ }, "/gov/kv/jwt/issuers": { "get": { + "deprecated": true, "operationId": "GetGovKvJwtIssuers", "responses": { "200": { @@ -1747,6 +1768,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1754,6 +1776,7 @@ }, "/gov/kv/jwt/public_signing_key": { "get": { + "deprecated": true, "operationId": "GetGovKvJwtPublicSigningKey", "responses": { "200": { @@ -1770,6 +1793,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1777,6 +1801,7 @@ }, "/gov/kv/jwt/public_signing_key_issuer": { "get": { + "deprecated": true, "operationId": "GetGovKvJwtPublicSigningKeyIssuer", "responses": { "200": { @@ -1793,6 +1818,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1800,6 +1826,7 @@ }, "/gov/kv/jwt/public_signing_keys_metadata": { "get": { + "deprecated": true, "operationId": "GetGovKvJwtPublicSigningKeysMetadata", "responses": { "200": { @@ -1816,6 +1843,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1823,6 +1851,7 @@ }, "/gov/kv/members/acks": { "get": { + "deprecated": true, "operationId": "GetGovKvMembersAcks", "responses": { "200": { @@ -1839,6 +1868,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1846,6 +1876,7 @@ }, "/gov/kv/members/certs": { "get": { + "deprecated": true, "operationId": "GetGovKvMembersCerts", "responses": { "200": { @@ -1862,6 +1893,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1869,6 +1901,7 @@ }, "/gov/kv/members/encryption_public_keys": { "get": { + "deprecated": true, "operationId": "GetGovKvMembersEncryptionPublicKeys", "responses": { "200": { @@ -1885,6 +1918,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1892,6 +1926,7 @@ }, "/gov/kv/members/info": { "get": { + "deprecated": true, "operationId": "GetGovKvMembersInfo", "responses": { "200": { @@ -1908,6 +1943,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1915,6 +1951,7 @@ }, "/gov/kv/modules": { "get": { + "deprecated": true, "operationId": "GetGovKvModules", "responses": { "200": { @@ -1931,6 +1968,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1938,6 +1976,7 @@ }, "/gov/kv/modules_quickjs_bytecode": { "get": { + "deprecated": true, "operationId": "GetGovKvModulesQuickjsBytecode", "responses": { "200": { @@ -1954,6 +1993,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1961,6 +2001,7 @@ }, "/gov/kv/modules_quickjs_version": { "get": { + "deprecated": true, "operationId": "GetGovKvModulesQuickjsVersion", "responses": { "200": { @@ -1977,6 +2018,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -1984,6 +2026,7 @@ }, "/gov/kv/nodes/code_ids": { "get": { + "deprecated": true, "operationId": "GetGovKvNodesCodeIds", "responses": { "200": { @@ -2000,6 +2043,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2007,6 +2051,7 @@ }, "/gov/kv/nodes/endorsed_certificates": { "get": { + "deprecated": true, "operationId": "GetGovKvNodesEndorsedCertificates", "responses": { "200": { @@ -2023,6 +2068,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2030,6 +2076,7 @@ }, "/gov/kv/nodes/info": { "get": { + "deprecated": true, "operationId": "GetGovKvNodesInfo", "responses": { "200": { @@ -2046,6 +2093,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2053,6 +2101,7 @@ }, "/gov/kv/nodes/snp/host_data": { "get": { + "deprecated": true, "operationId": "GetGovKvNodesSnpHostData", "responses": { "200": { @@ -2069,6 +2118,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2076,6 +2126,7 @@ }, "/gov/kv/nodes/snp/measurements": { "get": { + "deprecated": true, "operationId": "GetGovKvNodesSnpMeasurements", "responses": { "200": { @@ -2092,6 +2143,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2099,6 +2151,7 @@ }, "/gov/kv/nodes/snp/uvm_endorsements": { "get": { + "deprecated": true, "operationId": "GetGovKvNodesSnpUvmEndorsements", "responses": { "200": { @@ -2115,6 +2168,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2122,6 +2176,7 @@ }, "/gov/kv/proposals": { "get": { + "deprecated": true, "operationId": "GetGovKvProposals", "responses": { "200": { @@ -2138,6 +2193,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2145,6 +2201,7 @@ }, "/gov/kv/proposals_info": { "get": { + "deprecated": true, "operationId": "GetGovKvProposalsInfo", "responses": { "200": { @@ -2161,6 +2218,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2168,6 +2226,7 @@ }, "/gov/kv/service/acme_certificates": { "get": { + "deprecated": true, "operationId": "GetGovKvServiceAcmeCertificates", "responses": { "200": { @@ -2184,6 +2243,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2191,6 +2251,7 @@ }, "/gov/kv/service/config": { "get": { + "deprecated": true, "operationId": "GetGovKvServiceConfig", "responses": { "200": { @@ -2207,6 +2268,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2214,6 +2276,7 @@ }, "/gov/kv/service/info": { "get": { + "deprecated": true, "operationId": "GetGovKvServiceInfo", "responses": { "200": { @@ -2230,6 +2293,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2237,6 +2301,7 @@ }, "/gov/kv/service/previous_service_identity": { "get": { + "deprecated": true, "operationId": "GetGovKvServicePreviousServiceIdentity", "responses": { "200": { @@ -2253,6 +2318,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2260,6 +2326,7 @@ }, "/gov/kv/tls/ca_cert_bundles": { "get": { + "deprecated": true, "operationId": "GetGovKvTlsCaCertBundles", "responses": { "200": { @@ -2276,6 +2343,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2283,6 +2351,7 @@ }, "/gov/kv/users/certs": { "get": { + "deprecated": true, "operationId": "GetGovKvUsersCerts", "responses": { "200": { @@ -2299,6 +2368,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2306,6 +2376,7 @@ }, "/gov/kv/users/info": { "get": { + "deprecated": true, "operationId": "GetGovKvUsersInfo", "responses": { "200": { @@ -2322,6 +2393,7 @@ "$ref": "#/components/responses/default" } }, + "summary": "This route is auto-generated from the KV schema.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2330,6 +2402,7 @@ "/gov/members": { "get": { "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/service/members", "operationId": "GetGovMembers", "responses": { "200": { @@ -2346,7 +2419,6 @@ "$ref": "#/components/responses/default" } }, - "summary": "This endpoint is deprecated. It is replaced by /gov/kv/members/certs, /gov/kv/members/encryption_public_keys, /gov/kv/members/info endpoints.", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } @@ -2354,6 +2426,8 @@ }, "/gov/proposals": { "get": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/members/proposals", "operationId": "GetGovProposals", "responses": { "200": { @@ -2376,6 +2450,8 @@ } }, "post": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by POST /gov/members/proposals:create", "operationId": "PostGovProposals", "requestBody": { "content": { @@ -2407,7 +2483,6 @@ "member_cose_sign1": [] } ], - "summary": "Submit a proposed change to the service", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/always" } @@ -2415,6 +2490,8 @@ }, "/gov/proposals/{proposal_id}": { "get": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/members/proposals/{proposalId}", "operationId": "GetGovProposalsProposalId", "responses": { "200": { @@ -2449,6 +2526,8 @@ }, "/gov/proposals/{proposal_id}/actions": { "get": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/members/proposals/{proposalId}/actions", "operationId": "GetGovProposalsProposalIdActions", "responses": { "200": { @@ -2493,6 +2572,8 @@ } ], "post": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by POST /gov/members/proposals/{proposalId}/ballots/{memberId}:submit", "operationId": "PostGovProposalsProposalIdBallots", "requestBody": { "content": { @@ -2532,6 +2613,8 @@ }, "/gov/proposals/{proposal_id}/ballots/{member_id}": { "get": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/members/proposals/{proposalId}/ballots/{memberId}", "operationId": "GetGovProposalsProposalIdBallotsMemberId", "responses": { "200": { @@ -2584,6 +2667,8 @@ } ], "post": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by POST /gov/members/proposals/{proposalId}:withdraw", "operationId": "PostGovProposalsProposalIdWithdraw", "responses": { "200": { @@ -2649,6 +2734,7 @@ "/gov/recovery_share": { "get": { "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/recovery/encrypted-shares/{memberId}", "operationId": "GetGovRecoveryShare", "responses": { "200": { @@ -2676,6 +2762,8 @@ } }, "post": { + "deprecated": true, + "description": "This endpoint is deprecated from 5.0.0. It is replaced by POST /gov/recovery/members/{memberId}:recover", "operationId": "PostGovRecoveryShare", "requestBody": { "content": { diff --git a/doc/schemas/node_openapi.json b/doc/schemas/node_openapi.json index a74b5b253b8e..e7b14490c3a4 100644 --- a/doc/schemas/node_openapi.json +++ b/doc/schemas/node_openapi.json @@ -896,7 +896,7 @@ "info": { "description": "This API provides public, uncredentialed access to service and node state.", "title": "CCF Public Node API", - "version": "4.10.2" + "version": "4.10.3" }, "openapi": "3.0.0", "paths": { @@ -943,7 +943,7 @@ "/node/code": { "get": { "deprecated": true, - "description": "Permitted SGX code identities", + "description": "This endpoint is deprecated from 5.0.0. It is replaced by GET /gov/service/join-policy", "operationId": "GetNodeCode", "responses": { "200": { @@ -960,7 +960,7 @@ "$ref": "#/components/responses/default" } }, - "summary": "This endpoint is deprecated. It is replaced by /gov/kv/nodes/code_ids endpoint", + "summary": "Permitted SGX code identities", "x-ccf-forwarding": { "$ref": "#/components/x-ccf-forwarding/sometimes" } diff --git a/include/ccf/endpoint.h b/include/ccf/endpoint.h index 610f0a073902..7e97cdf0c0d9 100644 --- a/include/ccf/endpoint.h +++ b/include/ccf/endpoint.h @@ -293,6 +293,14 @@ namespace ccf::endpoints */ Endpoint& set_openapi_deprecated(bool is_deprecated); + /** Set the endpoint as deprecated and overwrites the description to include + * deprecation version and point to a replacement endpoint. + * + * @return This Endpoint for further modification + */ + Endpoint& set_openapi_deprecated_replaced( + const std::string& deprecation_version, const std::string& replacement); + /** Whether the endpoint should be omitted from the OpenAPI document. * * @return This Endpoint for further modification diff --git a/samples/apps/logging/logging.cpp b/samples/apps/logging/logging.cpp index 6465aa35116a..e3dd8e30ed29 100644 --- a/samples/apps/logging/logging.cpp +++ b/samples/apps/logging/logging.cpp @@ -454,7 +454,7 @@ namespace loggingapp "recording messages at client-specified IDs. It demonstrates most of " "the features available to CCF apps."; - openapi_info.document_version = "2.4.1"; + openapi_info.document_version = "2.4.2"; index_per_public_key = std::make_shared( PUBLIC_RECORDS, context, 10000, 20); diff --git a/src/endpoints/common_endpoint_registry.cpp b/src/endpoints/common_endpoint_registry.cpp index 907a714728e7..4e1f8f984d1c 100644 --- a/src/endpoints/common_endpoint_registry.cpp +++ b/src/endpoints/common_endpoint_registry.cpp @@ -264,11 +264,8 @@ namespace ccf make_read_only_endpoint( "/code", HTTP_GET, json_read_only_adapter(get_code), no_auth_required) .set_auto_schema() - .set_openapi_summary( - "This endpoint is deprecated. It is replaced by /gov/kv/nodes/code_ids " - "endpoint") - .set_openapi_deprecated(true) - .set_openapi_description("Permitted SGX code identities") + .set_openapi_summary("Permitted SGX code identities") + .set_openapi_deprecated_replaced("5.0.0", "GET /gov/service/join-policy") .install(); auto openapi = [this](auto& ctx) { this->api_endpoint(ctx); }; diff --git a/src/endpoints/endpoint.cpp b/src/endpoints/endpoint.cpp index 279732589fcd..f0a2bc08017d 100644 --- a/src/endpoints/endpoint.cpp +++ b/src/endpoints/endpoint.cpp @@ -106,6 +106,17 @@ namespace ccf::endpoints return *this; } + Endpoint& Endpoint::set_openapi_deprecated_replaced( + const std::string& deprecation_version, const std::string& replacement) + { + openapi_deprecated = true; + openapi_description = fmt::format( + "This endpoint is deprecated from {}. It is replaced by {}", + deprecation_version, + replacement); + return *this; + } + void Endpoint::install() { if (installer == nullptr) diff --git a/src/node/rpc/member_frontend.h b/src/node/rpc/member_frontend.h index 5a0b1a778563..fd97f0c36dde 100644 --- a/src/node/rpc/member_frontend.h +++ b/src/node/rpc/member_frontend.h @@ -571,6 +571,10 @@ namespace ccf endpoint.template set_auto_schema(); } + endpoint.set_openapi_summary( + "This route is auto-generated from the KV schema."); + endpoint.set_openapi_deprecated(true); + endpoint.install(); } @@ -595,7 +599,7 @@ namespace ccf openapi_info.description = "This API is used to submit and query proposals which affect CCF's " "public governance tables."; - openapi_info.document_version = "4.2.8"; + openapi_info.document_version = "4.3.0"; } static std::optional get_caller_member_id( @@ -780,6 +784,8 @@ namespace ccf .set_openapi_summary( "Provide a member endorsement of a service state digest") .set_auto_schema() + .set_openapi_deprecated_replaced( + "5.0.0", "POST /gov/members/state-digests/{memberId}:ack") .install(); //! A member asks for a fresher state digest @@ -834,6 +840,8 @@ namespace ccf .set_openapi_summary( "Update and fetch a service state digest, for the purpose of member " "endorsement") + .set_openapi_deprecated_replaced( + "5.0.0", "POST /gov/members/state-digests/{memberId}:update") .install(); auto get_encrypted_recovery_share = @@ -887,11 +895,9 @@ namespace ccf get_encrypted_recovery_share, member_cert_or_sig_policies("encrypted_recovery_share")) .set_auto_schema() - .set_openapi_deprecated(true) - .set_openapi_summary( - "This endpoint is deprecated. It is replaced by " - "/encrypted_recovery_share/{member_id}") .set_openapi_summary("A member's recovery share") + .set_openapi_deprecated_replaced( + "5.0.0", "GET /gov/recovery/encrypted-shares/{memberId}") .install(); auto get_encrypted_recovery_share_for_member = @@ -939,6 +945,8 @@ namespace ccf ccf::no_auth_required) .set_auto_schema() .set_openapi_summary("A member's recovery share") + .set_openapi_deprecated_replaced( + "5.0.0", "GET /gov/recovery/encrypted-shares/{memberId}") .install(); auto submit_recovery_share = [this]( @@ -1086,6 +1094,8 @@ namespace ccf .set_openapi_summary( "Provide a recovery share for the purpose of completing a service " "recovery") + .set_openapi_deprecated_replaced( + "5.0.0", "POST /gov/recovery/members/{memberId}:recover") .install(); using JWTKeyMap = std::map>; @@ -1109,11 +1119,7 @@ namespace ccf make_endpoint( "/jwt_keys/all", HTTP_GET, json_adapter(get_jwt_keys), no_auth_required) .set_auto_schema() - .set_openapi_deprecated(true) - .set_openapi_summary( - "This endpoint is deprecated. It is replaced by " - "/gov/kv/jwt/public_signing_keys_metadata and /gov/kv/jwt/issuers " - "endpoints.") + .set_openapi_deprecated_replaced("5.0.0", "POST /gov/service/jwk") .install(); auto post_proposals_js = [this](ccf::endpoints::EndpointContext& ctx) { @@ -1364,7 +1370,8 @@ namespace ccf post_proposals_js, member_sig_only_policies("proposal")) .set_auto_schema() - .set_openapi_summary("Submit a proposed change to the service") + .set_openapi_deprecated_replaced( + "5.0.0", "POST /gov/members/proposals:create") .install(); using AllOpenProposals = std::map; @@ -1393,6 +1400,7 @@ namespace ccf .set_auto_schema() .set_openapi_summary( "Proposed changes to the service pending resolution") + .set_openapi_deprecated_replaced("5.0.0", "GET /gov/members/proposals") .install(); auto get_proposal_js = [this]( @@ -1445,6 +1453,8 @@ namespace ccf .set_auto_schema() .set_openapi_summary( "Information about a proposed change to the service") + .set_openapi_deprecated_replaced( + "5.0.0", "GET /gov/members/proposals/{proposalId}") .install(); auto withdraw_js = [this](ccf::endpoints::EndpointContext& ctx) { @@ -1553,6 +1563,8 @@ namespace ccf member_sig_only_policies("withdrawal")) .set_auto_schema() .set_openapi_summary("Withdraw a proposed change to the service") + .set_openapi_deprecated_replaced( + "5.0.0", "POST /gov/members/proposals/{proposalId}:withdraw") .install(); auto get_proposal_actions_js = @@ -1599,6 +1611,8 @@ namespace ccf .set_auto_schema() .set_openapi_summary( "Actions contained in a proposed change to the service") + .set_openapi_deprecated_replaced( + "5.0.0", "GET /gov/members/proposals/{proposalId}/actions") .install(); auto vote_js = [this](ccf::endpoints::EndpointContext& ctx) { @@ -1761,6 +1775,9 @@ namespace ccf .set_auto_schema() .set_openapi_summary( "Submit a ballot for a proposed change to the service") + .set_openapi_deprecated_replaced( + "5.0.0", + "POST /gov/members/proposals/{proposalId}/ballots/{memberId}:submit") .install(); auto get_vote_js = @@ -1815,6 +1832,8 @@ namespace ccf .set_auto_schema() .set_openapi_summary( "Ballot for a given member about a proposed change to the service") + .set_openapi_deprecated_replaced( + "5.0.0", "GET /gov/members/proposals/{proposalId}/ballots/{memberId}") .install(); using AllMemberDetails = std::map; @@ -1861,11 +1880,7 @@ namespace ccf json_read_only_adapter(get_all_members), ccf::no_auth_required) .set_auto_schema() - .set_openapi_deprecated(true) - .set_openapi_summary( - "This endpoint is deprecated. It is replaced by " - "/gov/kv/members/certs, /gov/kv/members/encryption_public_keys, " - "/gov/kv/members/info endpoints.") + .set_openapi_deprecated_replaced("5.0.0", "GET /gov/service/members") .install(); add_kv_wrapper_endpoints(); diff --git a/src/node/rpc/node_frontend.h b/src/node/rpc/node_frontend.h index 9544fc713901..a36df12217d3 100644 --- a/src/node/rpc/node_frontend.h +++ b/src/node/rpc/node_frontend.h @@ -404,7 +404,7 @@ namespace ccf openapi_info.description = "This API provides public, uncredentialed access to service and node " "state."; - openapi_info.document_version = "4.10.2"; + openapi_info.document_version = "4.10.3"; } void init_handlers() override