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

feat: Added function type for enum #2852

Closed
wants to merge 1 commit into from

Conversation

eyeamkd
Copy link

@eyeamkd eyeamkd commented Feb 23, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #2786

What is the new behavior?

Allows enum to have functions that return array of Records ( string or num )

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@eyeamkd eyeamkd mentioned this pull request Feb 23, 2024
1 task
@@ -57,6 +59,13 @@ describe('SchemaObjectFactory', () => {

@ApiProperty({ enum: Ranking, enumName: 'Ranking', isArray: true })
rankings: Ranking[];

@ApiProperty({
enum: getAvailableUserRoles(),
Copy link

Choose a reason for hiding this comment

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

I think here you need to change this to be

Suggested change
enum: getAvailableUserRoles(),
enum: getAvailableUserRoles,

Otherwise the function will be called on import 😄

Copy link

Choose a reason for hiding this comment

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

My guess would be that you will also need to therefore change schema-object-factory.

Let me know if I can help

Copy link
Author

@eyeamkd eyeamkd Feb 28, 2024

Choose a reason for hiding this comment

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

Thank you for pointing it out @slukes. I'll let you know if I need any help changing it.

@kamilmysliwiec
Copy link
Member

#2935

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

Successfully merging this pull request may close these issues.

None yet

3 participants