richhollis / swagger-docs

Generates swagger-ui json files for Rails APIs with a simple DSL.
MIT License
750 stars 150 forks source link

How to add nested attributes for single record ? #160

Open jaswinder97 opened 7 years ago

jaswinder97 commented 7 years ago

For has_many association we can give array type for nested attributes as:

property :examples_attributes, :array, :required, "A list of examples", { "items" => { "$ref" => "Example" } }

But how add nested attributes for single record if we consider has_one association. I tried by specifying hash type but it didn't work.

property :example_attributes, :hash, :required, "An example", { "item" => { "$ref" => "Example" } }

scepion1d commented 7 years ago

property :example_attributes, :'Example', :required, 'Some description'