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

String literal union type - Resolver error at components.schemas.<MyClass>.properties.<MyProperty>.$ref #118

Open
nick-infinitegiving opened this issue Aug 6, 2024 · 2 comments

Comments

@nick-infinitegiving
Copy link

nick-infinitegiving commented Aug 6, 2024

Ran into this error below and was wondering if anyone has a recommendation how to proceed? -Thx

@column()
// @enum(pending, active, deleted)
public status: 'pending' | 'active' | 'deleted'

Resolver error at components.schemas..properties..$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/'pending' does not exist in document

Fails with and without the enum tag.

@Ovoda
Copy link

Ovoda commented Aug 16, 2024

I know it's not ideal but have you tried the following ?

@column()
// @enum(pending, active, deleted)
public status: string

@nick-infinitegiving
Copy link
Author

nick-infinitegiving commented Aug 19, 2024

Hi @Ovoda - Yes we did however our goal was to maintain the typing. We did hack it in so that if a property is tagged as an enum it automatically sets the type in the definition to string. Thank you for the suggestion!

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