Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define a param object in a component? #72

Open
sixties opened this issue Jan 27, 2021 · 1 comment
Open

How to define a param object in a component? #72

sixties opened this issue Jan 27, 2021 · 1 comment

Comments

@sixties
Copy link

sixties commented Jan 27, 2021

Hi,

Maybe a stupid newbie question: I defined an action like this:

api :show, 'return a single instance' do
   param :path, :id, Integer, :req, range: { gt: 0}, desc: 'instance id'
   resp 200, 'success', :json, data: :Instance
end`

I wanted to define the param in a component such as:

components do
  param :instance_id => [
      :path, id: {type: Integer}, desc: 'test']
end

Which gives a syntax error. Could you please give me a hint, how to define a path parameter in a components section?

Best regards,

Udo Eisenbarth

@xhs345
Copy link

xhs345 commented Dec 17, 2021

Something similar we have:

components do
  query :UserIdQry    => [:user_id, String, desc: 'the user identifier']
end

and

api :index, "Description.", id: 'getData' do
  param_ref :UserIdQry
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants