mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
885681da9a
## Description Adds `metadata.openapi.json` to version control. Adds a Buildkite job that verifies the spec is up-to-date on server changes, and fails the CI pipeline if not. Adds scaffolding for a new Typescript project that consumes that OpenAPI spec, and produces Typescript types. This is adapted from the similar existing data connectors project in `dc-agents/dc-api-types/`. Generated code is *not* committed to version control. Instead there is a script to generate code on-demand at publishing time. There are plans to incorporate publishing the generated project to NPM using a forthcoming pipeline that the Console team is working on. For the moment the Typescript project is under `metadata-api-types/typescript/`. The plan is to move the project in a future PR to the frontend sub-monorepo. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7525 GitOrigin-RevId: dc27a807e52af117636f3aa6c2c289a0be87ade1
31 lines
965 B
Makefile
31 lines
965 B
Makefile
SHELL := bash -e -u -o pipefail
|
|
|
|
SCHEMA_FILE := $(abspath ../metadata.openapi.json)
|
|
TYPESCRIPT_ROOT := typescript
|
|
TYPESCRIPT_SRC := ${TYPESCRIPT_ROOT}/src
|
|
PATCHES := $(wildcard ${TYPESCRIPT_ROOT}/patches/*.patch)
|
|
|
|
# default target
|
|
.PHONY: help
|
|
## help: prints help message
|
|
help:
|
|
@echo "Usage:"
|
|
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
|
|
|
|
.PHONY: generate-types
|
|
## generate-types: Generate the TypeScript types for working with the Metadata API
|
|
generate-types: ${TYPESCRIPT_SRC}
|
|
|
|
.PHONY: typecheck
|
|
## typecheck: Typechecks generated type definitions
|
|
typecheck: typecheck-metadata-api-types
|
|
|
|
${TYPESCRIPT_SRC}: ${SCHEMA_FILE} ${TYPESCRIPT_ROOT}/package.json ${TYPESCRIPT_ROOT}/package-lock.json ${PATCHES}
|
|
./scripts/generate-types.sh "${SCHEMA_FILE}"
|
|
|
|
.PHONY: typecheck-metadata-api-types
|
|
## typecheck-metadata-api-types: Typechecks the metadata-api-types
|
|
typecheck-metadata-api-types:
|
|
cd ${TYPESCRIPT_ROOT} && \
|
|
npm run typecheck
|