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 exported from type files. #98

Open
cyanid opened this issue Oct 12, 2022 · 2 comments
Open

Enums are not exported from type files. #98

cyanid opened this issue Oct 12, 2022 · 2 comments

Comments

@cyanid
Copy link

cyanid commented Oct 12, 2022

I have enums in my type files, for example:

export enum DeliveryType {
HOME_DELIVERY = "homedelivery",
POST_PICKUP_POINT = "post_pickup_point",
CARGO_HOME_DELIVERY = "cargo_homedelivery",
}

If I import generated JSON to editor.swagger.io, following error is produced:

Semantic error at definitions.ShipmentDeliveryMethod.properties.deliveryType.$ref
$refs must reference a valid location in the document

The snippet from JSON which causes the error is:

"deliveryType": {
"$ref": "#/definitions/DeliveryType",
"title": "ShipmentDeliveryMethod.deliveryType"
}

@bfaulk96
Copy link
Collaborator

I believe this is a problem with typeconv, which is the library we use to define the JSON schemas. I have found that for enums, I have to just do something like

type DeliveryType = 'homedelivery' | 'post_pickup_point' | 'cargo_homedelivery';, which is less than ideal, but I'm not sure there's much we can do about it.

@lmanerich
Copy link

Sad thing that is not even possible to use:

type DeliveryType = keyof typeof DeliveryTypeEnum

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

3 participants