From f7af68813686b7579891772b758e116034f37c50 Mon Sep 17 00:00:00 2001 From: Phil Leggetter Date: Mon, 2 Sep 2024 11:32:49 +0100 Subject: [PATCH 1/2] refactor: bring OpenAPI spec to top-level --- .github/workflows/{poll-openapi.yml => check-openapi.yml} | 4 +--- fern/generators.yml | 2 +- fern/openapi/openapi.json => openapi.json | 0 3 files changed, 2 insertions(+), 4 deletions(-) rename .github/workflows/{poll-openapi.yml => check-openapi.yml} (94%) rename fern/openapi/openapi.json => openapi.json (100%) diff --git a/.github/workflows/poll-openapi.yml b/.github/workflows/check-openapi.yml similarity index 94% rename from .github/workflows/poll-openapi.yml rename to .github/workflows/check-openapi.yml index 4cabdcc..0451111 100644 --- a/.github/workflows/poll-openapi.yml +++ b/.github/workflows/check-openapi.yml @@ -1,8 +1,6 @@ -name: Fetch Hookdeck OpenAPI +name: Check Hookdeck OpenAPI for Changes on: workflow_dispatch: # Manually trigger the workflow - schedule: - - cron: "*/15 * * * *" permissions: contents: write diff --git a/fern/generators.yml b/fern/generators.yml index d9d22b4..ab81d25 100644 --- a/fern/generators.yml +++ b/fern/generators.yml @@ -1,5 +1,5 @@ api: - path: ./openapi/openapi.json + path: ../openapi.json overrides: ../overrides.yml origin: https://api.hookdeck.com/latest/openapi/fern groups: diff --git a/fern/openapi/openapi.json b/openapi.json similarity index 100% rename from fern/openapi/openapi.json rename to openapi.json From cc4ed6726af57ae45e4f3eea3846ad2be079cdc3 Mon Sep 17 00:00:00 2001 From: Phil Leggetter Date: Mon, 2 Sep 2024 11:38:28 +0100 Subject: [PATCH 2/2] chore(docs): update README --- README.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1f3a79d..3f62b51 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,20 @@ # Hookdeck OpenAPI Schema -In addition to the standard uses of OpenAPI schema, the Hookdeck OpenAPI schema is used to generate our SDKS: +In addition to the standard uses of OpenAPI schema, the Hookdeck OpenAPI schema is used to generate our SDKS using [Fern](https://www.buildwithfern.com/?ref=hookdeck): - [Go SDK](https://github.com/hookdeck/hookdeck-go-sdk) - [TypeScript SDK](https://github.com/hookdeck/hookdeck-typescript-sdk) -- _More SDKs to come..._ ## What is in this repository? This repository contains -- Hookdeck's Fern API Definition which lives in the [OpenApi](./fern/openapi/) folder -- Generators (see [generators.yml](./fern/generators.yml)) +- Hookdeck's API Definition which lives in the root directory and contains some Fern specific extensions +- Generators used to generate the SDK (see [generators.yml](./fern/generators.yml)) + +## About Fern + +Fern is used to generate our SDKs from the OpenAPI specification. In order to make sure that the definition is valid, you can use the Fern CLI. @@ -20,11 +23,11 @@ npm install -g fern-api # Installs CLI fern check # Checks if the definition is valid ``` -## What are Generators? +### What are Generators? Generators read in your API Definition and output files or code (i.e. the TypeScript SDK Generator) and are tracked in [generators.yml](./fern/generators.yml). -### Local preview +#### Local preview You can preview the generated code in the `./local/go/generated/hookdeck-go-sdk` directory by running the following command: @@ -32,7 +35,7 @@ You can preview the generated code in the `./local/go/generated/hookdeck-go-sdk` fern generate --group local ``` -## Validating your API Definition +### Validating your API Definition To validate your API, run: ```sh @@ -40,7 +43,7 @@ npm install -g fern-api # only required once fern check ``` -## Updating your SDKs +### Updating your SDKs To update your SDKs, run `fern generate`.