https://github.com/la-rebelion/kubernetes-pojos
Auto Generated Plain Old Java Objects (POJO) from Kubernetes API Swagger specs (oficial)
https://github.com/la-rebelion/kubernetes-pojos
Last synced: 3 months ago
JSON representation
Auto Generated Plain Old Java Objects (POJO) from Kubernetes API Swagger specs (oficial)
- Host: GitHub
- URL: https://github.com/la-rebelion/kubernetes-pojos
- Owner: la-rebelion
- Created: 2022-12-30T15:44:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T12:49:49.000Z (over 2 years ago)
- Last Synced: 2025-01-20T06:45:51.668Z (5 months ago)
- Language: Java
- Size: 368 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.html
Awesome Lists containing this project
README
Kubernetes POJOs
/* From extension vscode.github */
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.vscode-dark img[src$=\#gh-light-mode-only],
.vscode-light img[src$=\#gh-dark-mode-only] {
display: none;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif;
font-size: 14px;
line-height: 1.6;
}
.task-list-item {
list-style-type: none;
}
.task-list-item-checkbox {
margin-left: -20px;
vertical-align: middle;
pointer-events: none;
}
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

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