Skip to content

Commit 662675c

Browse files
alanconwayzhuje
authored andcommitted
refactor: Generated client and data types from korrel8r spec.
Need to extend the korrel8r client, would like to use a swagger/openapi code generator with the korrel8r swagger spec to make it easy to keep up with future changes. Here is one possible generated client. There are several possibilities, requesting feedback: 1. Use this generated client as-is to replace the existing client and cancellablefetch 2. Use only the generated model/ with the existing client. 3. Use some other generator (please suggest which one) Other changes: - Add custom headers by creating and using a named client - Fix default api domain for API calls to include korrel8r api path - Update useKorrel8r to use new format - Fix error handling using new type - Replace query.types with generated client/model types.
1 parent bda62bc commit 662675c

32 files changed

Lines changed: 1570 additions & 97 deletions

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,11 @@ deploy: test-frontend ## Build and push image, reinstall on cluster using helm.
6262
helm uninstall troubleshooting-panel-console-plugin -n troubleshooting-panel-console-plugin || true
6363
PUSH=1 scripts/build-image.sh
6464
helm install troubleshooting-panel-console-plugin charts/openshift-console-plugin -n troubleshooting-panel-console-plugin --create-namespace --set plugin.image=$(IMAGE)
65+
66+
## Code generation
67+
gen-client: web/src/korrel8r/client
68+
69+
# NOTE: copied from https://github.com/korrel8r/korrel8r/blob/main/pkg/rest/docs/swagger.json
70+
web/src/korrel8r/client: korrel8r/swagger.json
71+
cd web && npx openapi-typescript-codegen --input ../$< --output ../$@ --name Korrel8rClient
72+
@touch $@

0 commit comments

Comments
 (0)