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

Enums are not translated to types #10

Closed
giovanni-orciuolo opened this issue May 5, 2022 · 3 comments
Closed

Enums are not translated to types #10

giovanni-orciuolo opened this issue May 5, 2022 · 3 comments

Comments

@giovanni-orciuolo
Copy link

giovanni-orciuolo commented May 5, 2022

In my JSON schema I have this:

"CodeIdType": {
    "type": "string",
    "enum": [
      "Proxy",
      "Multisig",
      "Govec",
      "Staking"
    ]
}

CodeIdType is referenced in the generated TS, but the type itself is not generated. I expect to have something like:

export type CodeIdType = "Proxy" | "Multisig" | "Govec" | "Staking";

Just like string aliases are currently translated, for example:

"Addr": {
    "type": "string"
}

Becomes

export type Addr = string;
@pyramation
Copy link
Collaborator

I do think we should consider writing this from scratch, for reasons such as this. I just want to mention that, this may be a PR suited for json-schema-to-typescript, however, I'm super open to exploring parsing types from scratch, as I've started to document here: #7

@pyramation
Copy link
Collaborator

enums are exported correctly now

export type CodeIdType = "Proxy" | "Multisig";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants