Skip to content
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

import: support enums in JSON schema #196

Closed
eladb opened this issue May 24, 2020 · 0 comments · Fixed by #210
Closed

import: support enums in JSON schema #196

eladb opened this issue May 24, 2020 · 0 comments · Fixed by #210
Assignees
Labels
feature-request New/Enhanced functionality wanted

Comments

@eladb
Copy link
Contributor

eladb commented May 24, 2020

Respect enum in the JSON schema when importing CRDs and APIs.

For example, this schema:

"reclaimPolicy": {
    "description": "ReclaimPolicy specifies what will happen to this managed resource when its resource claim is deleted",
    "enum": [
        "Retain",
        "Delete"
    ],
    "type": "string"
}

Should be imported as:

interface Foo {
  readonly reclaimPolicy: ReclaimPolicy;
}

enum ReclaimPolicy {
  RETAIN = 'Retain',
  DELETE = 'Delete
}
@eladb eladb added feature-request New/Enhanced functionality wanted needs-triage Priority and effort undetermined yet labels May 24, 2020
@eladb eladb changed the title Import enums import: support enums in JSON schema May 24, 2020
eladb pushed a commit that referenced this issue May 26, 2020
When a JSON schema includes an `enum` string value list, generate a typescript `enum` to offer usability.

Resolves #196

BREAKING CHANGE: enum string values are now proper enums instead of just `string`s.
@SomayaB SomayaB added in-progress and removed needs-triage Priority and effort undetermined yet labels May 27, 2020
@mergify mergify bot closed this as completed in #210 May 27, 2020
mergify bot pushed a commit that referenced this issue May 27, 2020
When a JSON schema includes an `enum` string value list, generate a typescript `enum` to offer usability.

Resolves #196

BREAKING CHANGE: enum string values are now proper enums instead of just `string`s.

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New/Enhanced functionality wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants