From 05d461f1e018f0aced3665aeeda63854b3fcbcd6 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Fri, 28 Jun 2024 12:21:48 +0200 Subject: [PATCH] releng: add speakeasy setup (#22) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit naively carried over: replaced repo removed publishing (we'll do that via changesets' action, I think) changed the output for the new package This won't work yet 🚧 It's missing our manually-added SDK pieces. But with the action defined, I can play around better with the speakeasy setup. Signed-off-by: Stephan Renatus --- .github/workflows/sdk_generation.yaml | 27 ++++++ .speakeasy/gen.lock | 116 ++++++++++++++++++++++++++ .speakeasy/gen.yaml | 48 +++++++++++ .speakeasy/overlay.yaml | 13 +++ .speakeasy/workflow.lock | 34 ++++++++ .speakeasy/workflow.yaml | 15 ++++ 6 files changed, 253 insertions(+) create mode 100644 .github/workflows/sdk_generation.yaml create mode 100755 .speakeasy/gen.lock create mode 100755 .speakeasy/gen.yaml create mode 100644 .speakeasy/overlay.yaml create mode 100644 .speakeasy/workflow.lock create mode 100644 .speakeasy/workflow.yaml diff --git a/.github/workflows/sdk_generation.yaml b/.github/workflows/sdk_generation.yaml new file mode 100644 index 00000000..fe2f3748 --- /dev/null +++ b/.github/workflows/sdk_generation.yaml @@ -0,0 +1,27 @@ +name: Generate +permissions: + checks: write + contents: write + pull-requests: write + statuses: write +"on": + workflow_dispatch: + inputs: + force: + description: Force generation of SDKs + type: boolean + default: false + schedule: + - cron: 0 0 * * * +jobs: + generate: + uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15 + with: + force: ${{ github.event.inputs.force }} + mode: pr + speakeasy_version: latest + secrets: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + npm_token: ${{ secrets.NPM_TOKEN }} + speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }} + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock new file mode 100755 index 00000000..fdf51ecc --- /dev/null +++ b/.speakeasy/gen.lock @@ -0,0 +1,116 @@ +lockVersion: 2.0.0 +id: 2f8b2839-3001-46b4-b5e0-cec0aad583ed +management: + docChecksum: 04bb432e6968396053d9d2ec5b5ff933 + docVersion: 0.2.0 + speakeasyVersion: 1.318.0 + generationVersion: 2.352.0 + releaseVersion: 1.1.3 + configChecksum: 0fb5e87d7a937b67b9c25494586477f6 + repoURL: https://github.com/StyraInc/opa-typescript.git + installationURL: https://github.com/StyraInc/opa-typescript + published: true +features: + typescript: + additionalDependencies: 0.1.0 + constsAndDefaults: 0.1.5 + core: 3.10.2 + examples: 2.81.4 + flattening: 2.81.1 + globalSecurityCallbacks: 0.1.0 + globalServerURLs: 2.82.4 + responseFormat: 0.2.3 + sdkHooks: 0.1.0 + unions: 2.85.5 +generatedFiles: + - src/sdk/sdk.ts + - .eslintrc.cjs + - RUNTIMES.md + - jsr.json + - package.json + - src/lib/base64.ts + - src/lib/config.ts + - src/lib/encodings.ts + - src/lib/http.ts + - src/lib/is-plain-object.ts + - src/lib/primitives.ts + - src/lib/retries.ts + - src/lib/schemas.ts + - src/lib/sdks.ts + - src/lib/security.ts + - src/lib/url.ts + - src/sdk/index.ts + - src/sdk/models/errors/sdkerror.ts + - src/sdk/models/errors/sdkvalidationerror.ts + - src/types/blobs.ts + - src/types/enums.ts + - src/types/index.ts + - src/types/operations.ts + - src/types/rfcdate.ts + - tsconfig.json + - src/sdk/models/operations/executedefaultpolicywithinput.ts + - src/sdk/models/operations/health.ts + - src/sdk/models/operations/executebatchpolicywithinput.ts + - src/sdk/models/operations/executepolicy.ts + - src/sdk/models/operations/executepolicywithinput.ts + - src/sdk/models/components/result.ts + - src/sdk/models/components/httpmetadata.ts + - src/sdk/models/components/input.ts + - src/sdk/models/components/gzipacceptencoding.ts + - src/sdk/models/components/healthyserver.ts + - src/sdk/models/components/batchmixedresults.ts + - src/sdk/models/components/provenance.ts + - src/sdk/models/components/batchsuccessfulpolicyevaluation.ts + - src/sdk/models/components/successfulpolicyresponse.ts + - src/sdk/models/components/explain.ts + - src/sdk/models/components/gzipcontentencoding.ts + - src/sdk/models/errors/clienterror.ts + - src/sdk/models/errors/servererror.ts + - src/sdk/models/errors/unhealthyserver.ts + - src/sdk/models/errors/batchservererror.ts + - src/sdk/models/errors/index.ts + - src/sdk/models/operations/index.ts + - src/sdk/models/components/index.ts + - docs/sdk/models/operations/executedefaultpolicywithinputrequest.md + - docs/sdk/models/operations/executedefaultpolicywithinputresponse.md + - docs/sdk/models/operations/healthrequest.md + - docs/sdk/models/operations/healthresponse.md + - docs/sdk/models/operations/executebatchpolicywithinputrequestbody.md + - docs/sdk/models/operations/executebatchpolicywithinputrequest.md + - docs/sdk/models/operations/executebatchpolicywithinputresponse.md + - docs/sdk/models/operations/executepolicyrequest.md + - docs/sdk/models/operations/executepolicyresponse.md + - docs/sdk/models/operations/executepolicywithinputrequestbody.md + - docs/sdk/models/operations/executepolicywithinputrequest.md + - docs/sdk/models/operations/executepolicywithinputresponse.md + - docs/sdk/models/components/result.md + - docs/sdk/models/components/httpmetadata.md + - docs/sdk/models/components/input.md + - docs/sdk/models/components/gzipacceptencoding.md + - docs/sdk/models/components/healthyserver.md + - docs/sdk/models/components/location.md + - docs/sdk/models/components/errors.md + - docs/sdk/models/components/servererror.md + - docs/sdk/models/components/responsessuccessfulpolicyresponse.md + - docs/sdk/models/components/responses.md + - docs/sdk/models/components/batchmixedresults.md + - docs/sdk/models/components/revision.md + - docs/sdk/models/components/provenance.md + - docs/sdk/models/components/batchsuccessfulpolicyevaluation.md + - docs/sdk/models/components/successfulpolicyresponse.md + - docs/sdk/models/components/explain.md + - docs/sdk/models/components/gzipcontentencoding.md + - docs/sdk/models/errors/location.md + - docs/sdk/models/errors/errors.md + - docs/sdk/models/errors/clienterror.md + - docs/sdk/models/errors/servererrorlocation.md + - docs/sdk/models/errors/servererrorerrors.md + - docs/sdk/models/errors/servererror.md + - docs/sdk/models/errors/unhealthyserver.md + - docs/sdk/models/errors/batchservererror.md + - docs/sdks/opaapiclient/README.md + - USAGE.md + - .gitattributes + - src/hooks/hooks.ts + - src/hooks/types.ts + - src/hooks/index.ts diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml new file mode 100755 index 00000000..18c8f578 --- /dev/null +++ b/.speakeasy/gen.yaml @@ -0,0 +1,48 @@ +configVersion: 2.0.0 +generation: + sdkClassName: opaApiClient + maintainOpenAPIOrder: true + usageSnippets: + optionalPropertyRendering: withExample + useClassNamesForArrayFields: true + fixes: + nameResolutionDec2023: true + parameterOrderingFeb2024: true + requestResponseComponentNamesFeb2024: true + auth: + oAuth2ClientCredentialsEnabled: false +typescript: + version: 1.1.3 + additionalDependencies: + dependencies: {} + devDependencies: + eslint-plugin-markdown: ^4.0.1 + prettier: 3.2.5 + testcontainers: ^10.7.2 + tsx: ^4.15.6 + typedoc: ^0.25.13 + typedoc-plugin-extras: ^3.0.0 + typedoc-plugin-replace-text: ^3.3.0 + peerDependencies: {} + additionalPackageJSON: + license: Apache-2.0 + author: Styra + clientServerStatusCodesAsErrors: true + enumFormat: enum + flattenGlobalSecurity: true + imports: + option: openapi + paths: + callbacks: sdk/models/callbacks + errors: sdk/models/errors + operations: sdk/models/operations + shared: sdk/models/components + webhooks: sdk/models/webhooks + inputModelSuffix: input + maxMethodParams: 4 + methodArguments: require-security-and-request + outputModelSuffix: output + packageName: '@styra/opa' + responseFormat: envelope-http + templateVersion: v2 + useIndexModules: true diff --git a/.speakeasy/overlay.yaml b/.speakeasy/overlay.yaml new file mode 100644 index 00000000..121484c9 --- /dev/null +++ b/.speakeasy/overlay.yaml @@ -0,0 +1,13 @@ +overlay: 1.0.0 +info: + title: Overlay to test the discriminator for the batch API + version: 0.0.1 +actions: + - target: "$.components..BatchMixedResults..responses.additionalProperties" + description: add a descrimintor + update: + discriminator: + propertyName: http_status_code + mapping: + "200": "#/components/schemas/SuccessfulPolicyResponse" + "500": "#/components/schemas/ServerError" diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock new file mode 100644 index 00000000..f38f3079 --- /dev/null +++ b/.speakeasy/workflow.lock @@ -0,0 +1,34 @@ +speakeasyVersion: 1.318.0 +sources: + openapi: + sourceNamespace: openapi + sourceRevisionDigest: sha256:49c204baa834f49dc7939553e11a3a8664891ba0bd57bdf9757d0cc631673dfe + sourceBlobDigest: sha256:409be84cbd5aff4097f6c56d9ff4fb30a531a8c1da05581bbab8ee735274aaad + tags: + - latest + - sr-batch-eval +targets: + first-target: + source: openapi + sourceNamespace: openapi + sourceRevisionDigest: sha256:49c204baa834f49dc7939553e11a3a8664891ba0bd57bdf9757d0cc631673dfe + sourceBlobDigest: sha256:409be84cbd5aff4097f6c56d9ff4fb30a531a8c1da05581bbab8ee735274aaad + outLocation: /github/workspace/repo +workflow: + workflowVersion: 1.0.0 + speakeasyVersion: latest + sources: + openapi: + inputs: + - location: https://raw.githubusercontent.com/StyraInc/enterprise-opa/main/openapi/openapi.yaml + overlays: + - location: ./.speakeasy/overlay.yaml + registry: + location: registry.speakeasyapi.dev/styra/styra/openapi + targets: + first-target: + target: typescript + source: openapi + publish: + npm: + token: $npm_token diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml new file mode 100644 index 00000000..f4c445ac --- /dev/null +++ b/.speakeasy/workflow.yaml @@ -0,0 +1,15 @@ +workflowVersion: 1.0.0 +speakeasyVersion: latest +sources: + openapi: + inputs: + - location: https://raw.githubusercontent.com/StyraInc/enterprise-opa/main/openapi/openapi.yaml + overlays: + - location: ./.speakeasy/overlay.yaml + registry: + location: registry.speakeasyapi.dev/styra/styra/openapi +targets: + first-target: + target: typescript + source: openapi + output: packages/opa