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

TypeError: Type mismatch in gateway-api v0.3.1 HTTPRouteSpecRulesItems0 #253

Closed
suin opened this issue Oct 31, 2024 · 1 comment · Fixed by #254
Closed

TypeError: Type mismatch in gateway-api v0.3.1 HTTPRouteSpecRulesItems0 #253

suin opened this issue Oct 31, 2024 · 1 comment · Fixed by #254
Labels
bug Something isn't working tool

Comments

@suin
Copy link
Contributor

suin commented Oct 31, 2024

Bug Report

1. Minimal reproduce step (Required)

  1. Create a new KCL module:
kcl mod init
  1. Add gateway-api dependency:
kcl mod add gateway-api
  1. Create a minimal example:
echo 'import gateway_api.v1' > main.k
  1. Run KCL:
kcl run

2. What did you expect to see? (Required)

The gateway-api package should properly compile without any type errors, as it should correctly define the types for HTTPRoute rules to match the Kubernetes Gateway API specification.

3. What did you see instead (Required)

Got a TypeError indicating a type mismatch in the HTTPRoute rules definition:

error[E2G22]: TypeError
--> /Users/suin/.kcl/kpm/gateway-api_0.3.1/v1/gateway_networking_k8s_io_v1_http_route.k:203:5

rules?: [GatewayNetworkingK8sIoV1HTTPRouteSpecRulesItems0] = [{"matches": {"value": [{"path": {"x-order": 0, "value": {"type": {"value": "PathPrefix", "x-order": 0}, "value": {"value": "/", "x-order": 1}}}}], "x-order": 0}}]

expected [GatewayNetworkingK8sIoV1HTTPRouteSpecRulesItems0MatchesItems0], got {str:[{str:{str:int | {str:{str:str | int}}}}] | int}

4. What is your KCL components version? (Required)

  • KCL version: 0.10.7
  • gateway-api package version: 0.3.1
  • OS: macOS
@Peefy
Copy link
Contributor

Peefy commented Oct 31, 2024

There's a bug in the v0.10.7 kcl import tool kcl-lang/kcl-openapi#121 and I've fixed the wrong schema definition in the v0.3.2 gateway-api module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants