Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Conversation

@philipp-kaiser
Copy link

Although i added some union implementations before, there were still bugs with union handling.

  • Multiple inline unions of same type in one object
  • Inheritance of inline unions
  • Arrays in Unions

Following a raml example with all upper problems in one:

one:
  type: object
  properties:
    mem1: string | nil
    mem2: string | nil

second:
  type: one
  properties:
    mem3: number[] | string[] | nil

This Pull Request fixes all of these bugs. But there are some breaking changes:

  • Changed naming of Unions from Type1Type2Union to FieldnameUnion (BREAKING CHANGE)
  • Changed default type of Arrays from java.util.List to Type[ ] (BREAKING CHANGE)
  • Added Array implementation to Unions (e.g. number[] | string[] | nil)
    • Changed Plugin "core.asArray" to "core.asList" (to retain original behaviour)
    • Unions with Lists are not working, as we are losing Type Parameters due to java's type erasure and Jackson does not know if we have a list of numbers or a list of strings.
  • Check object members of type union to be inherited, do not create union class if already exists in parent, but use parent's union as type
  • Fixed enum naming to be UPPER_UNDERSCORE (BREAKING CHANGE)
  • Adjusted results of unions in all tests
  • Added some missing dependency (Eclipse projekt error)

I don't know, if this project is still alive, but we needed these features and I implemented them for us. As we gain lots of profit from this project, I want to share my results. It's up to you to accept them.

Best regards
Philipp

@jstoiko
Copy link
Contributor

jstoiko commented Apr 13, 2021

Thank you for your contribution @Kaiser1989. Unfortunately this project is no longer maintained and should have been archived. I will notify the owners. This project originally spawned out of RAML for JAX-RS which has been archived. Please feel free to reach out if you need assistance/guidance in maintaining a fork.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants