Closed Avarei closed 4 months ago
import "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1#/K8sObject.pkl"
import "package://pkg.pkl-lang.org/pkl-pantry/org.openapis.v3@1.0.0#/SchemaGenerator.pkl"
example = SchemaGenerator.generate(K8sObject)
pkl eval k8sObjectGen.pkl -f yaml
Thanks for reporting! Fixed in #30
While trying to turn a Kubernetes CRD into a Pkl Module and then turning it back into a OpenAPIv3Spec I noticed that K8sObjects from pkl-k8s can not be converted.
Resulting in the following Error:
This seems to be due to the ModuleOutput present in k8sObject.
I was able to Fix this by adding another filter for
prop.name != "output"
to: https://github.com/apple/pkl-pantry/blob/8685ad681b4fa54bdb7355ef9b665f61bad84959/packages/org.openapis.v3/SchemaGenerator.pkl#L293-L295As I am quite new to Pkl I am not sure if there is a better way to check if a property is a ModuleOutput. I am also not sure if the output could be used with backticks as a regular property.
If you are interested I'm happy to create a PR.