swaggard icon indicating copy to clipboard operation
swaggard copied to clipboard

Array Object

Open analyn-cajocson opened this issue 7 years ago • 3 comments

Hi! I am now using this gem for my API. However, I'm having a hard time adding some parameters like array object.

This is my sample parameter on postman and I want to try this on swaggard. screen shot 2017-03-28 at 4 19 40 pm

But I ended up having this: screen shot 2017-03-28 at 4 21 29 pm

and this is my codes

#products_controller.rb

# Create product # # @body_parameter [string] sku # @body_parameter [array] product_category_attributes def create product = Product.new(product_params) if product.save @http_response = product @http_status = 200 else @http_response = product.errors end render :json => @http_response, :status => @http_status end

# strong parameters def product_params params.permit( :sku, product_category_attributes: [ :id, :category_id, :product_id,:_destroy ] ) end

Looking forward for the fast response. Thank you!

analyn-cajocson avatar Mar 28 '17 08:03 analyn-cajocson

Hey, if want to document input parameters you need to define a class and add it to the models that are scanned by swaggard.

You can check this https://github.com/adrian-gomez/swaggard/issues/21 for an example

@analyn34 Sorry for the late response

adrian-gomez avatar Jul 18 '17 15:07 adrian-gomez

ok. I'll check this. thanks @adrian-gomez

analyn-cajocson avatar Sep 28 '17 02:09 analyn-cajocson

@analyn34, I have the same issue. Did you get it work using the example? If so, could you please post your code? Thanks.

Seralto avatar Dec 19 '17 19:12 Seralto