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

Actions on sub-resources don't work #6

Closed ajain0184 closed 4 years ago

ajain0184 commented 4 years ago

Currently you can only define an "action" on top-level resources. That's limiting. For one of the APIs on DataSet Management, we need to define an action on a sub-resource.

liveandrew commented 4 years ago

let's chat - there are ways of modeling this - was hoping to avoid arbitrary levels of nesting as it leads to complexity. currently only 2 levels are supported

liveandrew commented 4 years ago

am looking to add infinite levels + a file to restrict depth and provide other checks.

this will probably mean phasing out the subresource keyword

lmossman commented 4 years ago

Commenting here because I asked about this in a slack thread: https://liveramp.slack.com/archives/CF9B53Y64/p1582915700002700 This is referring to the API that Abhishek was talking about in this issue. We have a Dataset resource, which contains Field subresources, which themselves contain Value subresources. This is the clearest way to define the resources for this API, because a single Dataset contains many fields, and a single field contains many values. Therefore, I would like to be able to create subresources of subresources.

We also would like to define actions on the subresources (for this example, we would like to define actions on Fields and on Values).

liveandrew commented 4 years ago

i absolutely will add this, but i'd also point out that REST subresources (especially very nested ones) carry significant limitations. nothing to do with reslang.

e.g. if you model fields as very granular subresources:

/audience/5/field/7/value/2

then it becomes very difficult for someone to bring in all fields and values for a single audience quickly using multigets. you can bring in all values of a field in 1 call, and all fields of an audience in 1 call, but getting all the fields and values of an audience with 100 fields with each having 100 values will involve 101 calls

just saying - this is a modeling question, up to you to support the use cases.

in contracts, modeling audience, field and value all as top level entities allows you to embed a multiget on value that selects by audience

liveandrew commented 4 years ago

fixed in anydepth-mark-2 branch. awaiting merge. https://github.com/LiveRamp/reslang/commit/7472ce48e358dc209c2f79b8053f259df7252d38