Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add @kumahq/kuma-http-api package for housing out HTTP API types #3516

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johncowen
Copy link
Contributor

Adds new @kumahq/kuma-http-api package

Also adds the necessary Makefile scripts to clone/update the remote kuma repository before generating types.

CI integration will be the next step here, which should just be able to call make -C ./packages/kuma-http-api build on a PR kuma itself. I've held off on that final step as I want to evaluate amount of noise, plus possible cyclic dependencies (if kuma submits a PR to us, and then we submit a PR to them etc etc)

Note: The index.d.ts file should really be the same as auto-generated.d.ts, but as time has moved on slightly its not. There were no problems when running make lint in the application though.

@johncowen johncowen requested a review from a team as a code owner February 6, 2025 15:08
@johncowen johncowen requested review from schogges and removed request for a team February 6, 2025 15:08
Copy link

netlify bot commented Feb 6, 2025

Deploy Preview for kuma-gui ready!

Name Link
🔨 Latest commit 6925c7b
🔍 Latest deploy log https://app.netlify.com/sites/kuma-gui/deploys/67a4d0784f808300086969b1
😎 Deploy Preview https://deploy-preview-3516--kuma-gui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@schogges schogges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, love this 🙌
But would like to clarify something first 🙂

Comment on lines +30 to +46
build: types/fetch install ## Regenerate the TS types from kumahq/kuma OpenAPI specs
@npx openapi-typescript \
$(KUMAHQ_HTTP_API)/kuma/docs/generated/openapi.yaml \
-o $(KUMAHQ_HTTP_API)/index.d.ts

types/fetch:
@echo "Fetching latest kumahq/kuma@master..."
@cd $(KUMAHQ_HTTP_API) \
&& \
if [ -d "./kuma/.git" ]; then \
cd ./kuma \
&& git pull; \
else \
git clone https://github.com/kumahq/kuma.git \
--single-branch --branch=master \
--depth 1; \
fi
Copy link
Contributor

@schogges schogges Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason why we are cloning the whole kuma repo while we could just use the remote schema?
I think this would work aswell:

npx openapi-typescript \
  https://raw.githubusercontent.com/kumahq/kuma/refs/heads/master/docs/generated/openapi.yaml \
  -o $(KUMAHQ_HTTP_API)/index.d.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants