Last active
April 12, 2024 09:46
-
-
Save germainlefebvre4/36180af06e320b1febdf4061171b492b to your computer and use it in GitHub Desktop.
A script to render a digest HTML page to read Kubernetes CRDs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Prerequisites: | |
# - yq: https://github.com/mikefarah/yq | |
# - yaml2json: https://github.com/bronze1man/yaml2json | |
# - generate-schema-doc: https://github.com/coveooss/json-schema-for-humans | |
FILE=$1 | |
if [ ! -d html ] ; then | |
mkdir html | |
fi | |
cat << EOF > render.yaml | |
\$schema: "https://json-schema.org/draft/2020-12/schema" | |
type: "object" | |
description: "" | |
additionalProperties": false | |
EOF | |
yq -r '.spec.versions[0].schema.openAPIV3Schema' ${FILE} >> render.yaml | |
yaml2json < render.yaml > render.json | |
generate-schema-doc --config template_name=js --config with_footer=false --config link_to_reused_ref=true render.json html/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment