kcl-lang/kcl-openapi

[Bug] Wrong schema attribute default values with `value` and `x-order` fields

Closed this issue · 0 comments

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

We can use the gateway-api CRD to reproduce this issue.

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
--> ~/.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 v0.10.7

Related issue: kcl-lang/modules#253