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

number enums generate non-compiling code #715

Closed
Shohou opened this issue Apr 30, 2024 · 3 comments · Fixed by #720
Closed

number enums generate non-compiling code #715

Shohou opened this issue Apr 30, 2024 · 3 comments · Fixed by #720
Labels

Comments

@Shohou
Copy link

Shohou commented Apr 30, 2024

Got to integration-tests/enum-property/src/main/openapi/enum-property.yaml. Change type for enum from string to number and enum values from 'text' to 1:

components:
  schemas:
    Echo:
      type: object
      properties:
        echoedMsgType:
          type: string
    Message:
      type: object
      required:
        - msgType
      properties:
        msgType:
          type: number    <---
          enum:
            - 1          <---

Compile it and check generated org.openapi.quarkus.enum_property_yaml.model.Message class. It will contain enum value -

@JsonIgnoreProperties(ignoreUnknown = true)
public class Message  {


    public enum MsgTypeEnum {
        NUMBER_1(BigDecimal.valueOf(new BigDecimal("1")));    // THIS IS NOT COMPILING

        // caching enum access
        private static final java.util.EnumSet<MsgTypeEnum> values = java.util.EnumSet.allOf(MsgTypeEnum.class);

        BigDecimal value;

BigDecimal.valueOf(new BigDecimal("1")) this part can not compile

@ricardozanini
Copy link
Member

Can you send a PR to fix this? Just change the pojo.qute template file to verify if the enum is a number and generate it correctly. What's the compilation error?

Shohou pushed a commit to Shohou/quarkus-openapi-generator that referenced this issue May 16, 2024
@hbelmiro hbelmiro linked a pull request May 16, 2024 that will close this issue
Copy link
Contributor

github-actions bot commented Jul 8, 2024

@ricardozanini @hbelmiro This is being labeled as Stale.

@github-actions github-actions bot added the Stale label Jul 8, 2024
Copy link
Contributor

@ricardozanini @hbelmiro This is being closed due to inactivity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2024
fjtirado added a commit that referenced this issue Aug 5, 2024
BigDecimal value fix in enums (#715)
FelixScherzinger pushed a commit to FelixScherzinger/quarkus-openapi-generator that referenced this issue Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants