question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[REQ][Java] support anyOf Enum

See original GitHub issue

3GPP R15 has defined a set of standards in the form of OpenAPI specification files.

The files are often lengthy and consist of oneOf, anyOf, allOf keywords.

The following definition that combines anyOf with enum has been consistently poping up and it will break the openapi-generator

    RequestTrigger:
      anyOf:
      - type: string
        enum:
          - LOC_CH
          - PRA_CH
          - SERV_AREA_CH
          - RFSP_CH
          - ALLOWED_NSSAI_CH
          - UE_AMBR_CH

The issue has been raised in #798 The solution was just workaround the spec files.

However it would be nice if we can instead add an option to the generator to simply ignore the anyOf. Ideally we want the generator to work without any alteration to the spec files.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
lwlee2608commented, Nov 15, 2019

I’ll be making a PR to address anyOf + enum described in this ticket soon. I am also facing a separate issues cause by oneOf here. I will create another ticket to track that.

0reactions
janankit20commented, Feb 10, 2022

@lwlee2608 ,

I see ignoreAnyOfInEnum flag is mentioned in openapi generators document as config. Also i see PR changes are present in master.

But when i am trying to work with openapi generator 5.4.0 version , AnyOf tag is not getting ignored. Do you see other way ( like changes no present on 5.4.0 version?

I even tried to work with 5.0.0 , but there were issues in generated code like import was missing , in the generated code.

Help highly appreciated !!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding Support for Enums in oneOf and anyOf in Java SDKs
Java SDKs now support enum types defined as oneOf/anyOf types. You can define as many distinct enum types as required with this support....
Read more >
Validations for Enum Types - Baeldung
Learn how to build validations for enums using Java custom annotations. ... enumClass(); String message() default "must be any of enum ...
Read more >
Mocking Java enum to add a value to test fail case
Here is a complete example. The code is almost like your original (just simplified better test validation): public enum MyEnum {A, B} public...
Read more >
Enums - Swagger
Enums. You can use the enum keyword to specify possible values of a request parameter or a model property. For example, the sort...
Read more >
Enum in Java - DigitalOcean
Technical tutorials, Q&A, events — This is an inclusive place where developers can find or lend support and discover new ways to contribute ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found