-
Notifications
You must be signed in to change notification settings - Fork 158
Add raw openapi schema to typescript client #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: schrodit The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @schrodit! |
/assign brendandburns |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
ref: kubernetes-client/javascript#2384
This PR adds the original raw openapi schema to the generated typescript models. This is required to include the Kubernetes specific extension
x-kubernetes-group-version-kind
that includes the group version and kind of the resource.Only adding that field is not possible because the
modelJson
variable is a raw string that I was unable to correctly parse with mustache (the templating engine used by the openapi generator).In order to use a dedicated template, the template was added to a new subfolder of the structure
openapi/templates/$CLIENT_TYPE
. That subfolder is automtically mounted to the generator container at/template
if it is defined.Doing it like makes it easy for other language to add templates in the future if required.
The newly generated modals look like this example of a
Secret
resource:the formatting of the
OPENAPI_SCHEMA
is a bit broken because indentation is not possible via mustache.An alternative would be to have the schema in a variable for readability. But not sure if this is worth adding on a anyway generated file.
e.g.