Skip to content

Auto Generated Plain Old Java Objects (POJO) from Kubernetes API Swagger specs (oficial)

Notifications You must be signed in to change notification settings

la-rebelion/kubernetes-pojos

Repository files navigation

Kubernetes POJOs

Auto-Generated Plain Old Java Objects (POJO) from Kubernetes API Swagger specs (official) with jsonschema2pojo.

cat k8s-api-swagger.json | yq -P > k8s-api-swagger.yaml
io.k8s((\.)([a-zA-Z|1]+))+ > io_k8s_$3
# grep all types
grep -E "io.k8s((\.)([a-z|1-2|\-]+))+((\.)([a-zA-Z]+):)" k8s-api-swagger-definitions-only.yaml | wc -l
508
# definitions and usages
grep -E "io.k8s((\.)([a-z|1-2|\-]+))+((\.)([a-zA-Z]+))" k8s-api-swagger-definitions-only.yaml | wc -l
1377
# canonical names
grep -E "io.k8s((\.)([a-z|1-2|\-]+))+((\.)([a-zA-Z]+):)" k8s-api-swagger-definitions-only.yaml | grep -E "io.k8s((\.)([a-z|1-2|\-]+))+"
# just the packages
grep -E "io.k8s((\.)([a-z|1-2|\-]+))+((\.)([a-zA-Z]+):)" ../k8s-api-swagger-definitions-only.yaml | grep -Eo "io.k8s((\.)([a-z|1-2|\-]+))+" | sort --unique > packages.txt
mkdir -p `cat ../packages.txt`

# VS Code - just the class name
io.k8s((?<dot>\.)(\w+))+ --> $3

For JSON Schema to POJO, two files are needed; the definitions (from Swagger: k8s-api-swagger-definitions-only.json) and the referenced schema (what I need/want) to "force" the generation of code (k8s-api-schema.json).

jsonschema2pojo --source k8s-api-schema.json --target java-gen -a JACKSON2 -R --package la.rebelion.k8s.api --include-dynamic-accessors --generate-constructors --constructors-include-copy-constructor

License

Creative Commons License
Kubernetes POJOs by La Rebelion Labs is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Based on a work at https://github.com/la-rebelion/kubernetes-pojos.

References

About

Auto Generated Plain Old Java Objects (POJO) from Kubernetes API Swagger specs (oficial)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages