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

Include a parameter only in PATCH and GET calls #71

Closed khardaw closed 4 years ago

khardaw commented 4 years ago

I'd like to define a deleted: boolean parameter on a resource. This parameter can only be modified through PATCH but should also be retrieved through GET. The idea is that a PATCH to change this parameter and mark the resource as deleted should be intentional. This parameter should not be visible through POST however as there is no reason to create a new resource with deleted = true.

The best way I could think to support this is to change the behavior of using both mutable and output. When both are specified, mutable should take precedence over the "output" parameter for PUT and PATCH endpoints. This means mutable output parameters will appear in PUT, PATCH, GET, and MULTIGET but not in POST.

Or maybe this is a bad pattern and I should implement this a different way?

liveandrew commented 4 years ago

i added a "flag" modifier for attributes. flags can also be optional.

e.g.

deleted: boolean optional flag

means that it will be included on GET, MULTIGET, PATCH & POST. if it's optional, well, it will be also marked as optional ;-P