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
I can't nest an embedded resource description like so:
public_api :GET, "/users/:name/regions", "Get a user's regions"
param :name, String, desc: "Name of the user"
returns code: 200, desc: "Returns the user's regions" do
property :data, Array, of: Region
end
def regions
# some logic here
end
where Region is a model that has the self.describe_own_properties defined.
It only works if Region is returned at the top level of the returns block:
returns code: 200, array_of: Region, desc: "Returns the user's regions"
This is not ideal because we have some classes that we'd like to reuse across our controllers as resource descriptions.
The text was updated successfully, but these errors were encountered:
I'm very interested in this feature as well. ATM the only workaround I have is to do:
public_api :GET, "/users/:name/regions", "Get a user's regions"
param :name, String, desc: "Name of the user"
returns code: 200, desc: "Returns the user's regions" do
property :data, array_of: Hash do
param_group: Region
end
end
def regions
# some logic here
end
However what doesn't work is that on the open API documentation, it doesn't pass the param_group as a reference but spreads/duplicates the whole definition. It would be amazing to factorize it so that the param groups are defined only once and reused in all APIs they are used. This is especially useful when using Swagger clients with typescript definitions of an API.
I can't nest an embedded resource description like so:
where
Region
is a model that has theself.describe_own_properties
defined.It only works if
Region
is returned at the top level of thereturns
block:This is not ideal because we have some classes that we'd like to reuse across our controllers as resource descriptions.
The text was updated successfully, but these errors were encountered: