Skip to content

Conversation

@atiratree
Copy link
Member

@atiratree atiratree commented Jun 20, 2019

just a showcase PR: to decide which direction to take:

This adds a complete types with documentation for all kubernetes/openshift/kubevirt objects.

The types are generated (using autorest) from OpenAPI specification taken from

types could live in:

Please let me know if somebody has a better alternative where the types could live or how to better approach this issue

this PR showcases the usage in @kubevirt plugin

depends on:

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: suomiy
To complete the pull request process, please assign alecmerdler
You can assign the PR to them by writing /assign @alecmerdler in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Contributor

Hi @suomiy. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 20, 2019
vmi?: VMIKind;
vm: V1VirtualMachine;
pods?: V1Pod[];
migrations?: V1VirtualMachineInstanceMigration[];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise it would be quite tedious to create all the new types.

+ the whole console & other plugins could benefit from the usual openshift objects

@atiratree
Copy link
Member Author

To see generated example please search for export interface V1Pod { in https://raw.githubusercontent.com/suomiy/openshift-typescript-api/master/lib/models/index.ts

@spadgett spadgett added this to the v4.2 milestone Jun 20, 2019
@atiratree
Copy link
Member Author

After offline discussion, it was concluded the best solution would be to have the types in separate package inside the console.

I will start working on introducing such a package together with generation script.

@spadgett
Copy link
Member

I really like the idea of generating the types so we're always correct and current.

Is there a way to improve the names? Names like Comgithubopenshiftapiappsv1CustomDeploymentStrategyParams are unwieldy.

cc @alecmerdler @christianvogt @vojtechszocs

@atiratree
Copy link
Member Author

atiratree commented Jun 20, 2019

Is there a way to improve the names? Names like Comgithubopenshiftapiappsv1CustomDeploymentStrategyParams are unwieldy.

I agree. This is the biggest problem so far. I would prefer to remove the namespacing where possible and leaving only the version, i.e.V1CustomDeploymentStrategyParams

I already did that for almost all of the types in my repo https://github.com/suomiy/openshift-typescript-api.

The main problem is that there are some conflicts (Iok8sapirbacv1beta1PolicyRule vs Comgithubopenshiftapiauthorizationv1PolicyRule).

We could either:

  • leave the conflicts fully namespaced
  • leave only the shortest distinct prefix (could have a problem with future conflicts)
  • leave only one of them (handpicked?) without namespace and leaving all the other ones (and future ones) with full namespace (Comgithubopenshiftapiappsv1...)
Other problems:

I found few type inconsistencies in the kubevirt swagger.json where are few unresolvable (by autorest) types like.

"type": [
    "string",
    "number"
]

I will try to find a solution for these.

@atiratree atiratree changed the title Introduce TC types for OpenShift / KubeVirt Introduce TS types for OpenShift / KubeVirt Jun 21, 2019
@atiratree
Copy link
Member Author

closing in favor of #1813

@atiratree atiratree closed this Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants