LiveRamp / reslang

A language for describing resource-oriented APIs & turning them into Swagger or resource diagrams. Oriented around the concepts we want to expose in the APIs.
Apache License 2.0
23 stars 7 forks source link

OpenAPI spec doesn't include "oneOf" for union type #138

Closed ChristianHansen closed 3 years ago

ChristianHansen commented 3 years ago

Marking this as "high" based on my understanding that incorrect OpenAPI specs are being generated. I might just be misunderstanding how unions should work, in which case I'm happy to lower the priority or just make a PR to update the documentation.

Describe The Bug OpenAPI component schemas for unions include a discriminator but not the oneOf property. The Reslang reference suggests that oneOf should be used in unions.

For example, Treatment here was generated from the Treatment union, but the generated Component Schema doesn't include oneOf.

To Reproduce

  1. Check out this file: https://github.com/LiveRamp/api-specs/blob/ingest-2290%2Cproposal-for-field-mapper/specs-draft/field-mapper/field-mapping.reslang#L208
  2. run ./generate-specs.sh specs-draft/field-mapper

Expected Behavior

I'd expect the oneOf keyword (if that's the right term to use) to be present in the output

Reslang Version

Master/Latest

ChristianHansen commented 3 years ago

Based on this thread it sounds like the current behavior wit the way allOf is used is intentional and works, but just doesn't line up with what the reference describes.

ChristianHansen commented 3 years ago

Created PR https://github.com/LiveRamp/reslang/pull/139

ChristianHansen commented 3 years ago

Closing this now that PR #139 is merged.