diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index f907b6b120..af1972626e 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -17,6 +17,7 @@ jobs: - name: Build OpenAPI spec and events run: nix develop --impure --command just build ${{github.ref_name}} env: + GH_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }} - name: Generate changelog run: bash .github/scripts/generate-changelog.sh diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 95fc989711..ed08ee4b6f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.797.0 +speakeasyVersion: 1.804.0 sources: stacks-source: sourceNamespace: stacks-source @@ -34,6 +34,8 @@ workflow: modelNamespace: orchestration - location: ./components/reconciliation.openapi.yaml modelNamespace: reconciliation + - location: ./components/connectivity.openapi.yaml + modelNamespace: connectivity - location: ./releases/base.yaml overlays: - location: ./releases/overlays/shared.overlay.yaml diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 3e6fe609ea..63ff5df2d3 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -23,6 +23,8 @@ sources: modelNamespace: orchestration - location: ./components/reconciliation.openapi.yaml modelNamespace: reconciliation + - location: ./components/connectivity.openapi.yaml + modelNamespace: connectivity - location: ./releases/base.yaml overlays: - location: ./releases/overlays/shared.overlay.yaml diff --git a/Justfile b/Justfile index 9542fc61d4..4641997e9c 100644 --- a/Justfile +++ b/Justfile @@ -9,10 +9,13 @@ SEARCH_VERSION := "v2.1.0" ORCHESTRATION_VERSION := "v2.6.4" RECONCILIATION_VERSION := "v2.5.0" GATEWAY_VERSION := "v2.3.2" +# Connectivity API releases do not yet publish an OpenAPI asset. +CONNECTIVITY_VERSION := "main" -# Download all component OpenAPI specs from GitHub releases +# Download component OpenAPI specs from GitHub releases or source download-specs: mkdir -p components + gh api -H "Accept: application/vnd.github.raw+json" "repos/formancehq/connectivity/contents/misc/connectivity-api/openapi.yaml?ref={{ CONNECTIVITY_VERSION }}" > components/connectivity.openapi.yaml wget -q https://github.com/formancehq/ledger/releases/download/{{ LEDGER_VERSION }}/openapi.yml -O components/ledger.openapi.yaml wget -q https://github.com/formancehq/ledger/releases/download/{{ LEDGER_V2_VERSION }}/openapi.yaml -O components/ledger-v2.openapi.yaml wget -q https://github.com/formancehq/payments/releases/download/{{ PAYMENTS_VERSION }}/openapi.yaml -O components/payments.openapi.yaml @@ -26,6 +29,7 @@ download-specs: # Prepend API path prefix to each component spec prepend-paths: download-specs + yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/connectivity" + .key) | from_entries) | (.paths[] | .. | select(has("tags")).tags) = ["connectivity.v1"] | .paths."/api/connectivity/_info".get.operationId = "connectivityInfo"' components/connectivity.openapi.yaml yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/auth" + .key) | from_entries)' components/auth.openapi.yaml yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/ledger" + .key) | from_entries) | (.paths[] | .. | select(has("tags")).tags) = ["ledger.v3"]' components/ledger.openapi.yaml yq -i '.paths |= (to_entries | map(select(.key == "/*").key = "/api/ledger" + .key) | from_entries) | del(.paths."/api/ledger/_info")' components/ledger-v2.openapi.yaml @@ -70,7 +74,7 @@ validate-openapi: jq -e '.paths["/api/ledger/v2"] != null and .paths["/api/ledger/v3/"] != null' releases/build/generate.json >/dev/null # Composition cleanups must remain applied when component specs change. jq -e '.components.schemas.auth_Scope == null and .components.schemas.auth_ScopeOptions == null' releases/build/generate.json >/dev/null - jq -e '[.. | objects | select(.enum? != null) | .enum | select(length != (unique | length))] | length == 0' releases/build/generate.json >/dev/null + jq -e '[.. | objects | select(.enum? | type == "array") | .enum | select(length != (unique | length))] | length == 0' releases/build/generate.json >/dev/null # Generate event schemas generate-events: diff --git a/flake.nix b/flake.nix index a9c7e4887a..c73cc302f4 100644 --- a/flake.nix +++ b/flake.nix @@ -68,6 +68,7 @@ default = pkgs.mkShell { packages = [ pkgs.jq + pkgs.gh pkgs.just pkgs.nodejs_22 pkgs.wget diff --git a/releases/base.yaml b/releases/base.yaml index 87c5ac8559..044cdc858b 100644 --- a/releases/base.yaml +++ b/releases/base.yaml @@ -40,6 +40,7 @@ servers: - us-east-1 tags: + - name: connectivity.v1 - name: ledger.v1 - name: ledger.v2 - name: ledger.v3 @@ -64,6 +65,9 @@ components: scopes: {} x-tagGroups: + - name: Connectivity + tags: + - connectivity.v1 - name: Auth tags: - auth.v1