Closed MikailBag closed 3 years ago
I have not written any documentation yet. What is the best location for docs?
Well -codegen
has been an "internal" tool up to this point, with the other crates being the point of the repo. But we can change that of course.
Just add it to k8s-openapi-codegen/README.md
To summarize, using the
VERSIONS
environment variable user can:
It would be better to take it as CLI args:
# Generate all with built-in URLs
k8s-openapi-codegen
# Only generate 1.19 and 1.20 with built-in URLs
k8s-openapi-codegen --generate 1.19 --generate 1.20
# Only generate 1.19 and 1.20, and override URL for 1.20
k8s-openapi-codegen --generate 1.19 --generate 1.20:http://foo.bar/spec.json
(Use structopt
please.)
I fixed a few things and pushed to https://github.com/Arnavion/k8s-openapi/compare/pr/90
Some incorrect whitespace - spaces indentation, trailing whitespace.
The --version
parsing was broken because it expected the parameter to contain the v
prefix. Since --version=v1.20
would look redundant, I changed the SupportedVersion::name()
function to not have the v
prefix.
The --version
parsing was broken because it used split(':')
instead of splitn(2, ':')
, so URLs would truncate after the protocol and be invalid.
Tweaked the helptext and error message to be more explanatory.
Does that branch look okay to you?
Also, I remembered why I suggested --generate
instead of --version
- --version
already has a use for getting the binary version (as pointless as it is for an "internal" tool like this), and I don't want to override it. So I've renamed it to --generate
Does that branch look okay to you?
Yes, sure. Thanks for your review and fixes.
Usage example:
This change is not useful on its own, but it eventually it should allow support non-builtin API groups, such as
metrics.k8s.io
.I have not written any documentation yet. What is the best location for docs?
To summarize, using the
VERSIONS
environment variable user can: 1) Request that only a subset of kubernetes versions should be handled 2) For each version they can provide custom specification URL E.g.:VERSIONS=v.19,v1.20=http://foo.bar/spec.json
Here codegen will generate v1.19 (using spec from k/k github repository) and v1.20 (using spec fromhttp://foo.bar/spec.json
)