Closed lr-conrs closed 4 years ago
working on it. tbh i'd never even though to do this, it's a very innovative use of reslang ;-P i love it when i see people using it in unusual and clever ways
Haha, yeah, it was an attempt at a solution where we wanted to create a resource, but its return structure was substantially different than its request payload. So output
, or even introducing the concept of input
wouldn't work. Plus, they felt sort of like a cheat anyway. I might even go so far as to advocate for its removal or linting against using it more than N times in a structure)
That said, as we iterate on our modelling, we might not actually end up returning the resource here, could always return a custom structure instead that happens to contain the ID for the created resource anyway.
fixed in 0edd270d552572ac55cdb85775c4c0790b0d5d90
Thanks Andrew! Sorry I couldn't help on this one, too many plates to juggle 😅
no worried at all, it relied on some deep internals that i haven't explained yet, so it's all good
During iteration, noticed what may be a problem with Reslang.
As a response to an action, I wish to return a resource. Thus, the response is defined:
However, the OpenApi generated apparently generates a schema for
TheResourceNameOutput
but notTheResourceName
. Thus, this structure generates an invalid open API spec. Attempting to change the above code snippet toTheResourceNameOutput
, however, will cause Reslang to complain.