You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider an API endpoint which returns a different entity depending on the current user. Is it possible to specify those different return entities in Grape DSL? Something like the following?
desc'Return user details'dosuccessEntities::BasicUser,Entities::FullUserendget'users'doifis_adminpresentusers,with: Entities::FullUserelsepresentusers,with: Entities::BasicUserendend
The text was updated successfully, but these errors were encountered:
Generally I don't recommend APIs that return two different things. But I think this should be possible - give it a try, if not it should be a feature request.
short answer: actual it isn't possible, and it isn't recommended longer answer: it should not be possible
why not?
have in mind what this means …
a logic would be implemented for this feature, ok
but this logic must also be handled on the consumer and documentation side,
cause it is common sense to expect one resource and changes,
which removes common behaviour are breaking changes,
means exactly: please make also feature request for:
Consider an API endpoint which returns a different entity depending on the current user. Is it possible to specify those different return entities in Grape DSL? Something like the following?
The text was updated successfully, but these errors were encountered: