From 5f5fbd3f33b8c984e38fc471b849d7f7a2e8b7a0 Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Mon, 5 Aug 2024 14:09:36 -0400 Subject: [PATCH 1/6] CBG-4143 add redocly targets for capella --- .redocly.yaml | 4 ++++ docs/api/admin-capella.yaml | 43 ++++++++++++++++++++++++++++++++++++ docs/api/metric-capella.yaml | 32 +++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 docs/api/admin-capella.yaml create mode 100644 docs/api/metric-capella.yaml diff --git a/.redocly.yaml b/.redocly.yaml index 2403cc1275..287e2095c2 100644 --- a/.redocly.yaml +++ b/.redocly.yaml @@ -15,6 +15,8 @@ apis: remove-x-internal: on admin-internal: root: "./docs/api/admin.yaml" + admin-capella: + root: "./docs/api/admin-capella.yaml" public: root: "./docs/api/public.yaml" decorators: @@ -27,6 +29,8 @@ apis: remove-x-internal: on metric-internal: root: "./docs/api/metric.yaml" + metric-capella: + root: "./docs/api/metric-capella.yaml" diagnostic: root: "./docs/api/diagnostic.yaml" decorators: diff --git a/docs/api/admin-capella.yaml b/docs/api/admin-capella.yaml new file mode 100644 index 0000000000..c21c952f24 --- /dev/null +++ b/docs/api/admin-capella.yaml @@ -0,0 +1,43 @@ +# Copyright 2022-Present Couchbase, Inc. +# +# Use of this software is governed by the Business Source License included +# in the file licenses/BSL-Couchbase.txt. As of the Change Date specified +# in that file, in accordance with the Business Source License, use of this +# software will be governed by the Apache License, Version 2.0, included in +# the file licenses/APL2.txt. + +openapi: 3.0.3 +info: + title: Sync Gateway + description: Sync Gateway manages access and synchronization between Couchbase Lite and Couchbase Server + version: 3.3.0 + license: + name: Business Source License 1.1 (BSL) + url: 'https://github.com/couchbase/sync_gateway/blob/master/LICENSE' +servers: + - url: 'https://{hostname}:4985' + description: Admin API + variables: + hostname: + description: The hostname to use + default: localhost +paths: + '/{db}/_session': + $ref: './paths/admin/db-_session.yaml' + x-capella: true + '/{db}/_session/{sessionid}': + $ref: './paths/admin/db-_session-sessionid.yaml' + '/{db}/_user/{name}': + $ref: './paths/admin/db-_user-name.yaml' + '/{db}/_user/{name}/_session': + $ref: './paths/admin/db-_user-name-_session.yaml' + '/{db}/_user/{name}/_session/{sessionid}': + $ref: './paths/admin/db-_user-name-_session-sessionid.yaml' + '/{db}/_role/': + $ref: './paths/admin/db-_role-.yaml' + '/{db}/_role/{name}': + $ref: './paths/admin/db-_role-name.yaml' + +externalDocs: + description: Manage App Services for Mobile and Edge | Couchbase Docs + url: 'https://docs.couchbase.com/cloud/app-services/index.html' diff --git a/docs/api/metric-capella.yaml b/docs/api/metric-capella.yaml new file mode 100644 index 0000000000..fa9939f577 --- /dev/null +++ b/docs/api/metric-capella.yaml @@ -0,0 +1,32 @@ +# Copyright 2022-Present Couchbase, Inc. +# +# Use of this software is governed by the Business Source License included +# in the file licenses/BSL-Couchbase.txt. As of the Change Date specified +# in that file, in accordance with the Business Source License, use of this +# software will be governed by the Apache License, Version 2.0, included in +# the file licenses/APL2.txt. + +openapi: 3.0.3 +info: + title: Sync Gateway + description: Sync Gateway manages access and synchronization between Couchbase Lite and Couchbase Server + version: 3.3.0 + license: + name: Business Source License 1.1 (BSL) + url: 'https://github.com/couchbase/sync_gateway/blob/master/LICENSE' +servers: + - url: 'https://{hostname}:4986' + description: Metrics API + variables: + hostname: + description: The hostname to use + default: localhost +paths: + /_metrics: + $ref: ./paths/metric/metrics.yaml +tags: + - name: Prometheus + description: Endpoints for use with Prometheus +externalDocs: + description: Manage App Services for Mobile and Edge | Couchbase Docs + url: 'https://docs.couchbase.com/cloud/app-services/index.html' From 10446c6046ebddaf41d3e9c12a606d81894af917 Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Mon, 5 Aug 2024 14:39:29 -0400 Subject: [PATCH 2/6] mark capella metrics port as 4988 and url as :4988/metrics --- docs/api/metric-capella.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/metric-capella.yaml b/docs/api/metric-capella.yaml index fa9939f577..d8446432f6 100644 --- a/docs/api/metric-capella.yaml +++ b/docs/api/metric-capella.yaml @@ -15,14 +15,14 @@ info: name: Business Source License 1.1 (BSL) url: 'https://github.com/couchbase/sync_gateway/blob/master/LICENSE' servers: - - url: 'https://{hostname}:4986' + - url: 'https://{hostname}:4988' description: Metrics API variables: hostname: description: The hostname to use default: localhost paths: - /_metrics: + /metrics: $ref: ./paths/metric/metrics.yaml tags: - name: Prometheus From 045ddbbf166c2f8eb42ca1e7a370fcd26a2ac81e Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Tue, 6 Aug 2024 11:30:18 -0400 Subject: [PATCH 3/6] wip --- .redocly.yaml | 11 ++ docs/api/admin-capella.yaml | 1 - .../decorators/replace-servers-capella.js | 9 ++ docs/api/plugins/plugin.js | 13 +++ docs/api/public-capella.yaml | 108 ++++++++++++++++++ docs/api/public.yaml | 3 + docs/api/replace-servers-capella.js | 14 +++ 7 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 docs/api/plugins/decorators/replace-servers-capella.js create mode 100644 docs/api/plugins/plugin.js create mode 100644 docs/api/public-capella.yaml create mode 100644 docs/api/replace-servers-capella.js diff --git a/.redocly.yaml b/.redocly.yaml index 287e2095c2..35cdc76909 100644 --- a/.redocly.yaml +++ b/.redocly.yaml @@ -23,6 +23,14 @@ apis: remove-x-internal: on public-internal: root: "./docs/api/public.yaml" + public-capella: + root: "./docs/api/public.yaml" + decorators: + filter-out: + property: x-capella + value: false + plugin/replace-servers-capella: + serverUrl: 'https://{hostname}:4984' metric: root: "./docs/api/metric.yaml" decorators: @@ -38,6 +46,9 @@ apis: diagnostic-internal: root: "./docs/api/diagnostic.yaml" +plugins: + - './docs/api/plugins/plugin.js' + extends: - minimal rules: diff --git a/docs/api/admin-capella.yaml b/docs/api/admin-capella.yaml index c21c952f24..425f756975 100644 --- a/docs/api/admin-capella.yaml +++ b/docs/api/admin-capella.yaml @@ -24,7 +24,6 @@ servers: paths: '/{db}/_session': $ref: './paths/admin/db-_session.yaml' - x-capella: true '/{db}/_session/{sessionid}': $ref: './paths/admin/db-_session-sessionid.yaml' '/{db}/_user/{name}': diff --git a/docs/api/plugins/decorators/replace-servers-capella.js b/docs/api/plugins/decorators/replace-servers-capella.js new file mode 100644 index 0000000000..1d77ba1c16 --- /dev/null +++ b/docs/api/plugins/decorators/replace-servers-capella.js @@ -0,0 +1,9 @@ +module.exports = ReplaceServersCapella; +require("console"); +/** @type {import('@redocly/cli').OasDecorator} */ + +function ReplaceServersCapella({ serverUrl }) { + return Server: { + leave(Server) + }; +} diff --git a/docs/api/plugins/plugin.js b/docs/api/plugins/plugin.js new file mode 100644 index 0000000000..503c44d899 --- /dev/null +++ b/docs/api/plugins/plugin.js @@ -0,0 +1,13 @@ +const ReplaceServersCapella = import("./decorators/replace-servers-capella.js"); +const id = "plugin"; + +const decorators = { + oas3: { + "replace-servers-capella": ReplaceServersCapella, + }, +}; + +module.exports = { + decorators, + id, +}; diff --git a/docs/api/public-capella.yaml b/docs/api/public-capella.yaml new file mode 100644 index 0000000000..34ca2117b5 --- /dev/null +++ b/docs/api/public-capella.yaml @@ -0,0 +1,108 @@ +# Copyright 2022-Present Couchbase, Inc. +# +# Use of this software is governed by the Business Source License included +# in the file licenses/BSL-Couchbase.txt. As of the Change Date specified +# in that file, in accordance with the Business Source License, use of this +# software will be governed by the Apache License, Version 2.0, included in +# the file licenses/APL2.txt. + +openapi: 3.0.3 +info: + title: Sync Gateway + description: Sync Gateway manages access and synchronization between Couchbase Lite and Couchbase Server + version: 3.3.0 + license: + name: Business Source License 1.1 (BSL) + url: 'https://github.com/couchbase/sync_gateway/blob/master/LICENSE' +servers: + - url: '{protocol}://{hostname}:4984' + description: Public API + variables: + protocol: + description: The protocol to use (HTTP or HTTPS) + default: http + enum: + - http + - https + hostname: + description: The hostname to use + default: localhost +paths: + '/{db}/_session': + $ref: './paths/public/db-_session.yaml' + '/{targetdb}/': + $ref: './paths/public/targetdb-.yaml' + '/{db}/': + $ref: './paths/public/db-.yaml' + /: + $ref: ./paths/public/-.yaml + /_ping: + $ref: ./paths/common/_ping.yaml + '/{keyspace}/': + $ref: './paths/admin/keyspace-.yaml' + '/{keyspace}/_all_docs': + $ref: './paths/public/keyspace-_all_docs.yaml' + '/{keyspace}/_bulk_docs': + $ref: './paths/public/keyspace-_bulk_docs.yaml' + '/{keyspace}/_bulk_get': + $ref: './paths/public/keyspace-_bulk_get.yaml' + '/{keyspace}/_changes': + $ref: './paths/public/keyspace-_changes.yaml' + '/{db}/_design/{ddoc}': + $ref: './paths/public/db-_design-ddoc.yaml' + '/{db}/_design/{ddoc}/_view/{view}': + $ref: './paths/public/db-_design-ddoc-_view-view.yaml' + '/{db}/_ensure_full_commit': + $ref: './paths/public/db-_ensure_full_commit.yaml' + '/{keyspace}/_revs_diff': + $ref: './paths/public/keyspace-_revs_diff.yaml' + '/{keyspace}/_local/{docid}': + $ref: './paths/public/keyspace-_local-docid.yaml' + '/{keyspace}/{docid}': + $ref: './paths/public/keyspace-docid.yaml' + '/{keyspace}/{docid}/{attach}': + $ref: './paths/public/keyspace-docid-attach.yaml' + '/{db}/_facebook': + $ref: './paths/public/db-_facebook.yaml' + '/{db}/_google': + $ref: './paths/public/db-_google.yaml' + '/{db}/_oidc': + $ref: './paths/public/db-_oidc.yaml' + '/{db}/_oidc_challenge': + $ref: './paths/public/db-_oidc_challenge.yaml' + '/{db}/_oidc_callback': + $ref: './paths/public/db-_oidc_callback.yaml' + '/{db}/_oidc_refresh': + $ref: './paths/public/db-_oidc_refresh.yaml' + '/{db}/_oidc_testing/.well-known/openid-configuration': + $ref: './paths/public/db-_oidc_testing-.well-known-openid-configuration.yaml' + '/{db}/_oidc_testing/authorize': + $ref: './paths/public/db-_oidc_testing-authorize.yaml' + '/{db}/_oidc_testing/token': + $ref: './paths/public/db-_oidc_testing-token.yaml' + '/{db}/_oidc_testing/certs': + $ref: './paths/public/db-_oidc_testing-certs.yaml' + '/{db}/_oidc_testing/authenticate': + $ref: './paths/public/db-_oidc_testing-authenticate.yaml' + '/{db}/_blipsync': + $ref: './paths/public/db-_blipsync.yaml' +tags: + - name: Server + description: Manage server activities + - name: Database Management + description: Create and manage Sync Gateway databases + - name: Session + description: Manage user sessions + - name: Authentication + description: Manage OpenID Connect Authentication + - name: Document + description: Create and manage documents + - name: Document Attachment + description: Create and manage document attachments + - name: Replication + description: Create and manage inter-Sync Gateway replications + - name: Unsupported + description: Endpoints that are not supported by Sync Gateway +externalDocs: + description: Sync Gateway Quickstart | Couchbase Docs + url: 'https://docs.couchbase.com/sync-gateway/current/index.html' diff --git a/docs/api/public.yaml b/docs/api/public.yaml index 34ca2117b5..bddbc57a05 100644 --- a/docs/api/public.yaml +++ b/docs/api/public.yaml @@ -50,8 +50,10 @@ paths: $ref: './paths/public/keyspace-_changes.yaml' '/{db}/_design/{ddoc}': $ref: './paths/public/db-_design-ddoc.yaml' + x-capella: false '/{db}/_design/{ddoc}/_view/{view}': $ref: './paths/public/db-_design-ddoc-_view-view.yaml' + x-capella: false '/{db}/_ensure_full_commit': $ref: './paths/public/db-_ensure_full_commit.yaml' '/{keyspace}/_revs_diff': @@ -103,6 +105,7 @@ tags: description: Create and manage inter-Sync Gateway replications - name: Unsupported description: Endpoints that are not supported by Sync Gateway + x-capella: false externalDocs: description: Sync Gateway Quickstart | Couchbase Docs url: 'https://docs.couchbase.com/sync-gateway/current/index.html' diff --git a/docs/api/replace-servers-capella.js b/docs/api/replace-servers-capella.js new file mode 100644 index 0000000000..493037b7f5 --- /dev/null +++ b/docs/api/replace-servers-capella.js @@ -0,0 +1,14 @@ +module.exports = ReplaceServersCapella; + +/** @type {import('@redocly/cli').OasDecorator} */ + +function ReplaceServersCapella({ serverUrl }) { + return { + Server: { + leave(Server) { + Server.url = serverUrl; + delete Server.protocol; + }, + }, + }; +} From 456edbb5805c40e92096a4f84cada47caa26e1d6 Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Tue, 6 Aug 2024 16:06:01 -0400 Subject: [PATCH 4/6] add public-capella target create decorators to do munging in https://github.com/couchbase/docs-capella/pull/58 --- .redocly.yaml | 11 ++++++- docs/api/admin-capella.yaml | 4 +-- docs/api/metric-capella.yaml | 4 +-- .../plugins/decorators/excise-rbac-capella.js | 32 +++++++++++++++++++ .../decorators/replace-description-capella.js | 30 +++++++++++++++++ .../decorators/replace-info-capella.js | 31 ++++++++++++++++++ .../decorators/replace-server-capella.js | 24 ++++++++++++++ .../decorators/replace-servers-capella.js | 9 ------ docs/api/plugins/plugin.js | 31 ++++++++++++------ docs/api/public.yaml | 1 + docs/api/replace-servers-capella.js | 10 ++++++ 11 files changed, 164 insertions(+), 23 deletions(-) create mode 100644 docs/api/plugins/decorators/excise-rbac-capella.js create mode 100644 docs/api/plugins/decorators/replace-description-capella.js create mode 100644 docs/api/plugins/decorators/replace-info-capella.js create mode 100644 docs/api/plugins/decorators/replace-server-capella.js delete mode 100644 docs/api/plugins/decorators/replace-servers-capella.js diff --git a/.redocly.yaml b/.redocly.yaml index 35cdc76909..f0318ba1ce 100644 --- a/.redocly.yaml +++ b/.redocly.yaml @@ -17,6 +17,8 @@ apis: root: "./docs/api/admin.yaml" admin-capella: root: "./docs/api/admin-capella.yaml" + decorators: + remove-x-internal: on public: root: "./docs/api/public.yaml" decorators: @@ -26,11 +28,14 @@ apis: public-capella: root: "./docs/api/public.yaml" decorators: + remove-x-internal: on filter-out: property: x-capella value: false - plugin/replace-servers-capella: + plugin/replace-server-capella: serverUrl: 'https://{hostname}:4984' + plugin/replace-info-capella: + title: "App Services Public API" metric: root: "./docs/api/metric.yaml" decorators: @@ -39,6 +44,10 @@ apis: root: "./docs/api/metric.yaml" metric-capella: root: "./docs/api/metric-capella.yaml" + decorators: + plugin/excise-rbac-capella: on + plugin/replace-description-capella: on + remove-x-internal: on diagnostic: root: "./docs/api/diagnostic.yaml" decorators: diff --git a/docs/api/admin-capella.yaml b/docs/api/admin-capella.yaml index 425f756975..8042a4f19b 100644 --- a/docs/api/admin-capella.yaml +++ b/docs/api/admin-capella.yaml @@ -8,8 +8,8 @@ openapi: 3.0.3 info: - title: Sync Gateway - description: Sync Gateway manages access and synchronization between Couchbase Lite and Couchbase Server + title: App Services Admin API + description: 'App Services manages access and synchronization between Couchbase Lite and Couchbase Capella' version: 3.3.0 license: name: Business Source License 1.1 (BSL) diff --git a/docs/api/metric-capella.yaml b/docs/api/metric-capella.yaml index d8446432f6..286ff63913 100644 --- a/docs/api/metric-capella.yaml +++ b/docs/api/metric-capella.yaml @@ -8,8 +8,8 @@ openapi: 3.0.3 info: - title: Sync Gateway - description: Sync Gateway manages access and synchronization between Couchbase Lite and Couchbase Server + title: App Services Metrics API + description: 'App Services manages access and synchronization between Couchbase Lite and Couchbase Capella' version: 3.3.0 license: name: Business Source License 1.1 (BSL) diff --git a/docs/api/plugins/decorators/excise-rbac-capella.js b/docs/api/plugins/decorators/excise-rbac-capella.js new file mode 100644 index 0000000000..49a9be4078 --- /dev/null +++ b/docs/api/plugins/decorators/excise-rbac-capella.js @@ -0,0 +1,32 @@ +/** + * Copyright 2024-Present Couchbase, Inc. + * + * Use of this software is governed by the Business Source License included + * in the file licenses/BSL-Couchbase.txt. As of the Change Date specified + * in that file, in accordance with the Business Source License, use of this + * software will be governed by the Apache License, Version 2.0, included in + * the file licenses/APL2.txt. + */ + +/** + * Removes the RBAC roles from capella API docs. This expects the RBAC information to be at the end of the documentation string. This is not a robust way of doing this. + * @module ExciseRBACCapella + */ + +module.exports = ExciseRBACCapella; + +const re = new RegExp("Required Sync Gateway RBAC roles"); + +/** @type {import('@redocly/cli').OasDecorator} */ +function ExciseRBACCapella() { + return { + Operation: { + leave(Operation) { + idx = Operation.description.search(re); + if (idx > 0) { + Operation.description = Operation.description.substr(0, idx); + } + }, + }, + }; +} diff --git a/docs/api/plugins/decorators/replace-description-capella.js b/docs/api/plugins/decorators/replace-description-capella.js new file mode 100644 index 0000000000..252d3947fb --- /dev/null +++ b/docs/api/plugins/decorators/replace-description-capella.js @@ -0,0 +1,30 @@ +/** + * Copyright 2024-Present Couchbase, Inc. + * + * Use of this software is governed by the Business Source License included + * in the file licenses/BSL-Couchbase.txt. As of the Change Date specified + * in that file, in accordance with the Business Source License, use of this + * software will be governed by the Apache License, Version 2.0, included in + * the file licenses/APL2.txt. + */ + +/** + * Does a string replacement on all operations (GET,PUT,POST,etc) to replace Sync Gateway with App Services. + * @module ReplaceDescriptionCapella + */ + +module.exports = ReplaceDescriptionCapella; + +/** @type {import('@redocly/cli').OasDecorator} */ +function ReplaceDescriptionCapella() { + return { + Operation: { + leave(Operation) { + Operation.description = Operation.description.replace( + "Sync Gateway", + "App Services", + ); + }, + }, + }; +} diff --git a/docs/api/plugins/decorators/replace-info-capella.js b/docs/api/plugins/decorators/replace-info-capella.js new file mode 100644 index 0000000000..189f804a04 --- /dev/null +++ b/docs/api/plugins/decorators/replace-info-capella.js @@ -0,0 +1,31 @@ +/** + * Copyright 2024-Present Couchbase, Inc. + * + * Use of this software is governed by the Business Source License included + * in the file licenses/BSL-Couchbase.txt. As of the Change Date specified + * in that file, in accordance with the Business Source License, use of this + * software will be governed by the Apache License, Version 2.0, included in + * the file licenses/APL2.txt. + */ + +/** + * Modifies the title of openapi object to value passed in. + * @module ReplaceInfoCapella + */ + +module.exports = ReplaceInfoCapella; + +/** @type {import('@redocly/cli').OasDecorator} */ +function ReplaceInfoCapella({ title }) { + return { + Info: { + leave(Info) { + if (title) { + Info.title = title; + } + Info.description = + "App Services manages access and synchronization between Couchbase Lite and Couchbase Capella"; + }, + }, + }; +} diff --git a/docs/api/plugins/decorators/replace-server-capella.js b/docs/api/plugins/decorators/replace-server-capella.js new file mode 100644 index 0000000000..6bd4808a38 --- /dev/null +++ b/docs/api/plugins/decorators/replace-server-capella.js @@ -0,0 +1,24 @@ +/** + * Copyright 2024-Present Couchbase, Inc. + * + * Use of this software is governed by the Business Source License included + * in the file licenses/BSL-Couchbase.txt. As of the Change Date specified + * in that file, in accordance with the Business Source License, use of this + * software will be governed by the Apache License, Version 2.0, included in + * the file licenses/APL2.txt. + */ + +module.exports = ReplaceServersCapella; + +/** @type {import('@redocly/cli').OasDecorator} */ +function ReplaceServersCapella({ serverUrl }) { + return { + Server: { + leave(Server) { + if (serverUrl) { + Server.url = serverUrl; + } + }, + }, + }; +} diff --git a/docs/api/plugins/decorators/replace-servers-capella.js b/docs/api/plugins/decorators/replace-servers-capella.js deleted file mode 100644 index 1d77ba1c16..0000000000 --- a/docs/api/plugins/decorators/replace-servers-capella.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = ReplaceServersCapella; -require("console"); -/** @type {import('@redocly/cli').OasDecorator} */ - -function ReplaceServersCapella({ serverUrl }) { - return Server: { - leave(Server) - }; -} diff --git a/docs/api/plugins/plugin.js b/docs/api/plugins/plugin.js index 503c44d899..2e422b5248 100644 --- a/docs/api/plugins/plugin.js +++ b/docs/api/plugins/plugin.js @@ -1,13 +1,26 @@ -const ReplaceServersCapella = import("./decorators/replace-servers-capella.js"); -const id = "plugin"; +/** + * Copyright 2024-Present Couchbase, Inc. + * + * Use of this software is governed by the Business Source License included + * in the file licenses/BSL-Couchbase.txt. As of the Change Date specified + * in that file, in accordance with the Business Source License, use of this + * software will be governed by the Apache License, Version 2.0, included in + * the file licenses/APL2.txt. + */ -const decorators = { - oas3: { - "replace-servers-capella": ReplaceServersCapella, - }, -}; +const ExciseRBACCapella = require("./decorators/excise-rbac-capella.js"); +const ReplaceDescriptionCapella = require("./decorators/replace-description-capella.js"); +const ReplaceInfoCapella = require("./decorators/replace-info-capella.js"); +const ReplaceServerCapella = require("./decorators/replace-server-capella.js"); module.exports = { - decorators, - id, + decorators: { + oas3: { + "excise-rbac-capella": ExciseRBACCapella, + "replace-description-capella": ReplaceDescriptionCapella, + "replace-info-capella": ReplaceInfoCapella, + "replace-server-capella": ReplaceServerCapella, + }, + }, + id: "plugin", }; diff --git a/docs/api/public.yaml b/docs/api/public.yaml index bddbc57a05..faba4520bb 100644 --- a/docs/api/public.yaml +++ b/docs/api/public.yaml @@ -103,6 +103,7 @@ tags: description: Create and manage document attachments - name: Replication description: Create and manage inter-Sync Gateway replications + x-capella: false - name: Unsupported description: Endpoints that are not supported by Sync Gateway x-capella: false diff --git a/docs/api/replace-servers-capella.js b/docs/api/replace-servers-capella.js index 493037b7f5..7bbadb9f1d 100644 --- a/docs/api/replace-servers-capella.js +++ b/docs/api/replace-servers-capella.js @@ -1,3 +1,13 @@ +/** + * Copyright 2024-Present Couchbase, Inc. + * + * Use of this software is governed by the Business Source License included + * in the file licenses/BSL-Couchbase.txt. As of the Change Date specified + * in that file, in accordance with the Business Source License, use of this + * software will be governed by the Apache License, Version 2.0, included in + * the file licenses/APL2.txt. + */ + module.exports = ReplaceServersCapella; /** @type {import('@redocly/cli').OasDecorator} */ From e649b1b5bbdafe09ccbef6b2eecceb356cad23ed Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Wed, 7 Aug 2024 13:43:36 -0400 Subject: [PATCH 5/6] use built in info-override decorator --- .redocly.yaml | 7 +++-- .../plugins/decorators/excise-rbac-capella.js | 1 + .../decorators/replace-info-capella.js | 31 ------------------- docs/api/plugins/plugin.js | 2 -- 4 files changed, 5 insertions(+), 36 deletions(-) delete mode 100644 docs/api/plugins/decorators/replace-info-capella.js diff --git a/.redocly.yaml b/.redocly.yaml index f0318ba1ce..0c218a629a 100644 --- a/.redocly.yaml +++ b/.redocly.yaml @@ -28,14 +28,15 @@ apis: public-capella: root: "./docs/api/public.yaml" decorators: - remove-x-internal: on filter-out: property: x-capella value: false + info-override: + description: "App Services manages access and synchronization between Couchbase Lite and Couchbase Capella" + plugin/replace-description-capella: on plugin/replace-server-capella: serverUrl: 'https://{hostname}:4984' - plugin/replace-info-capella: - title: "App Services Public API" + remove-x-internal: on metric: root: "./docs/api/metric.yaml" decorators: diff --git a/docs/api/plugins/decorators/excise-rbac-capella.js b/docs/api/plugins/decorators/excise-rbac-capella.js index 49a9be4078..afe1feef3e 100644 --- a/docs/api/plugins/decorators/excise-rbac-capella.js +++ b/docs/api/plugins/decorators/excise-rbac-capella.js @@ -22,6 +22,7 @@ function ExciseRBACCapella() { return { Operation: { leave(Operation) { + // remove all text after first regex match idx = Operation.description.search(re); if (idx > 0) { Operation.description = Operation.description.substr(0, idx); diff --git a/docs/api/plugins/decorators/replace-info-capella.js b/docs/api/plugins/decorators/replace-info-capella.js deleted file mode 100644 index 189f804a04..0000000000 --- a/docs/api/plugins/decorators/replace-info-capella.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2024-Present Couchbase, Inc. - * - * Use of this software is governed by the Business Source License included - * in the file licenses/BSL-Couchbase.txt. As of the Change Date specified - * in that file, in accordance with the Business Source License, use of this - * software will be governed by the Apache License, Version 2.0, included in - * the file licenses/APL2.txt. - */ - -/** - * Modifies the title of openapi object to value passed in. - * @module ReplaceInfoCapella - */ - -module.exports = ReplaceInfoCapella; - -/** @type {import('@redocly/cli').OasDecorator} */ -function ReplaceInfoCapella({ title }) { - return { - Info: { - leave(Info) { - if (title) { - Info.title = title; - } - Info.description = - "App Services manages access and synchronization between Couchbase Lite and Couchbase Capella"; - }, - }, - }; -} diff --git a/docs/api/plugins/plugin.js b/docs/api/plugins/plugin.js index 2e422b5248..e2c875af07 100644 --- a/docs/api/plugins/plugin.js +++ b/docs/api/plugins/plugin.js @@ -10,7 +10,6 @@ const ExciseRBACCapella = require("./decorators/excise-rbac-capella.js"); const ReplaceDescriptionCapella = require("./decorators/replace-description-capella.js"); -const ReplaceInfoCapella = require("./decorators/replace-info-capella.js"); const ReplaceServerCapella = require("./decorators/replace-server-capella.js"); module.exports = { @@ -18,7 +17,6 @@ module.exports = { oas3: { "excise-rbac-capella": ExciseRBACCapella, "replace-description-capella": ReplaceDescriptionCapella, - "replace-info-capella": ReplaceInfoCapella, "replace-server-capella": ReplaceServerCapella, }, }, From 2ccb8792cc7c2a72c0501e37c459e4d4dfcd443a Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Thu, 8 Aug 2024 10:00:59 -0400 Subject: [PATCH 6/6] remove unused public-capella.yaml and use x-capella filtering on on all capella docs --- .redocly.yaml | 6 ++ docs/api/public-capella.yaml | 108 ----------------------------------- 2 files changed, 6 insertions(+), 108 deletions(-) delete mode 100644 docs/api/public-capella.yaml diff --git a/.redocly.yaml b/.redocly.yaml index 0c218a629a..c8e29f87e3 100644 --- a/.redocly.yaml +++ b/.redocly.yaml @@ -18,6 +18,9 @@ apis: admin-capella: root: "./docs/api/admin-capella.yaml" decorators: + filter-out: + property: x-capella + value: false remove-x-internal: on public: root: "./docs/api/public.yaml" @@ -46,6 +49,9 @@ apis: metric-capella: root: "./docs/api/metric-capella.yaml" decorators: + filter-out: + property: x-capella + value: false plugin/excise-rbac-capella: on plugin/replace-description-capella: on remove-x-internal: on diff --git a/docs/api/public-capella.yaml b/docs/api/public-capella.yaml deleted file mode 100644 index 34ca2117b5..0000000000 --- a/docs/api/public-capella.yaml +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2022-Present Couchbase, Inc. -# -# Use of this software is governed by the Business Source License included -# in the file licenses/BSL-Couchbase.txt. As of the Change Date specified -# in that file, in accordance with the Business Source License, use of this -# software will be governed by the Apache License, Version 2.0, included in -# the file licenses/APL2.txt. - -openapi: 3.0.3 -info: - title: Sync Gateway - description: Sync Gateway manages access and synchronization between Couchbase Lite and Couchbase Server - version: 3.3.0 - license: - name: Business Source License 1.1 (BSL) - url: 'https://github.com/couchbase/sync_gateway/blob/master/LICENSE' -servers: - - url: '{protocol}://{hostname}:4984' - description: Public API - variables: - protocol: - description: The protocol to use (HTTP or HTTPS) - default: http - enum: - - http - - https - hostname: - description: The hostname to use - default: localhost -paths: - '/{db}/_session': - $ref: './paths/public/db-_session.yaml' - '/{targetdb}/': - $ref: './paths/public/targetdb-.yaml' - '/{db}/': - $ref: './paths/public/db-.yaml' - /: - $ref: ./paths/public/-.yaml - /_ping: - $ref: ./paths/common/_ping.yaml - '/{keyspace}/': - $ref: './paths/admin/keyspace-.yaml' - '/{keyspace}/_all_docs': - $ref: './paths/public/keyspace-_all_docs.yaml' - '/{keyspace}/_bulk_docs': - $ref: './paths/public/keyspace-_bulk_docs.yaml' - '/{keyspace}/_bulk_get': - $ref: './paths/public/keyspace-_bulk_get.yaml' - '/{keyspace}/_changes': - $ref: './paths/public/keyspace-_changes.yaml' - '/{db}/_design/{ddoc}': - $ref: './paths/public/db-_design-ddoc.yaml' - '/{db}/_design/{ddoc}/_view/{view}': - $ref: './paths/public/db-_design-ddoc-_view-view.yaml' - '/{db}/_ensure_full_commit': - $ref: './paths/public/db-_ensure_full_commit.yaml' - '/{keyspace}/_revs_diff': - $ref: './paths/public/keyspace-_revs_diff.yaml' - '/{keyspace}/_local/{docid}': - $ref: './paths/public/keyspace-_local-docid.yaml' - '/{keyspace}/{docid}': - $ref: './paths/public/keyspace-docid.yaml' - '/{keyspace}/{docid}/{attach}': - $ref: './paths/public/keyspace-docid-attach.yaml' - '/{db}/_facebook': - $ref: './paths/public/db-_facebook.yaml' - '/{db}/_google': - $ref: './paths/public/db-_google.yaml' - '/{db}/_oidc': - $ref: './paths/public/db-_oidc.yaml' - '/{db}/_oidc_challenge': - $ref: './paths/public/db-_oidc_challenge.yaml' - '/{db}/_oidc_callback': - $ref: './paths/public/db-_oidc_callback.yaml' - '/{db}/_oidc_refresh': - $ref: './paths/public/db-_oidc_refresh.yaml' - '/{db}/_oidc_testing/.well-known/openid-configuration': - $ref: './paths/public/db-_oidc_testing-.well-known-openid-configuration.yaml' - '/{db}/_oidc_testing/authorize': - $ref: './paths/public/db-_oidc_testing-authorize.yaml' - '/{db}/_oidc_testing/token': - $ref: './paths/public/db-_oidc_testing-token.yaml' - '/{db}/_oidc_testing/certs': - $ref: './paths/public/db-_oidc_testing-certs.yaml' - '/{db}/_oidc_testing/authenticate': - $ref: './paths/public/db-_oidc_testing-authenticate.yaml' - '/{db}/_blipsync': - $ref: './paths/public/db-_blipsync.yaml' -tags: - - name: Server - description: Manage server activities - - name: Database Management - description: Create and manage Sync Gateway databases - - name: Session - description: Manage user sessions - - name: Authentication - description: Manage OpenID Connect Authentication - - name: Document - description: Create and manage documents - - name: Document Attachment - description: Create and manage document attachments - - name: Replication - description: Create and manage inter-Sync Gateway replications - - name: Unsupported - description: Endpoints that are not supported by Sync Gateway -externalDocs: - description: Sync Gateway Quickstart | Couchbase Docs - url: 'https://docs.couchbase.com/sync-gateway/current/index.html'