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

Error getting values from Enum when using Groovy #6760

Closed
ilopmar opened this issue Jan 14, 2022 · 2 comments · Fixed by #6763
Closed

Error getting values from Enum when using Groovy #6760

ilopmar opened this issue Jan 14, 2022 · 2 comments · Fixed by #6763
Labels
lang: groovy Issues or features specific to Groovy
Milestone

Comments

@ilopmar
Copy link
Contributor

ilopmar commented Jan 14, 2022

Expected Behavior

When using Groovy and getting the values from an enum having an EnumElement, Micronaut should return the right values.

Actual Behaviour

Given the following Groovy Enum:

enum Type {
    DOG, CAT
}

When processing it in micronaut-openapi to get the values, Micronaut returns DOG, CAT, MIN_VALUE and MAX_VALUE and it should only return DOG and CAT.

The issues is here https://github.com/micronaut-projects/micronaut-core/blob/3.2.x/inject-groovy/src/main/groovy/io/micronaut/ast/groovy/visitor/GroovyEnumElement.java#L56-L60 but while debugging I can't find a way to differentiate those extra values from the "right" ones.

This only happens with Groovy, it works properly with Java.

Related Micronaut OpenAPI issue that should be closed when this is fixed micronaut-projects/micronaut-openapi#358

Steps To Reproduce

No response

Environment Information

Linux Mint 20.3
JDK 8

Example Application

No response

Version

3.2.6

@yawkat
Copy link
Member

yawkat commented Jan 14, 2022

Could just hard-code the exclusion for MIN_VALUE and MAX_VALUE

@ilopmar
Copy link
Contributor Author

ilopmar commented Jan 14, 2022

I though about it but it feels dirty... If there is no other way, I can do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: groovy Issues or features specific to Groovy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants