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

Reslang generated swagger does not support Polymorphism properly #200

Closed hatim-ez closed 2 years ago

hatim-ez commented 3 years ago

OPI API specs rely on several polymorphic objects, the OutputMetadata being one of them. However, the clients OpenAPI generates from the reslang-generated-swagger are not properly handling polymorphism:

Our assumption is that this problem is happening because Reslang generates non-polymorphic-compatible Swagger specs. Until Reslang is modified to generate proper Swagger specs, if consumers want to bump their OpenAPI clients so that they get the latest production features, we need to manually fix the specs (by copying changes made by this PR), and merge the PR to publish a new set of clients with valid polymorphism.

Note: we assumed that the above PR changes are correct based on:

To Reproduce

  1. generate dist-api swagger specs from our reslang file
  2. build ruby api client from the generated swagger using OpenAPI codegen tool
  3. call GET '/v1/distribution-requests/{id} for a DSJ through a curl, and notice the presence of an output metadata
  4. call the same method using the generated ruby client, response = DistApiClient::DistributionRequestApi.get(dsjID) and response.output_metadata would be nil

Expected Behavior

We'd want the generated ruby client to be able to parse the polymorphic object from the response

Reslang Version

Master/Latest