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'm having an issue when trying to define the schema following jsonapi spec, particularly with the "included" array where someone can specify objects related to the primary data, an array that can have different model/schema types.
I currently have a schema defined for an Article and then a schema for the Author and the Comments. If i try to relate this two last schemas (Author and Comments) on the 'included' array of the Article block it doesn't work. I tried with bot these two forms
property :included, type: :array do
items do
key :'$ref', :Comment
end
items do
key :'$ref', :Author
end
end
And with
property :included, type: :array do
items do
key :'$ref', :Comment
key :'$ref', :Author
end
end
The full Article, Comment and Author schemas are something like these
module Swagger::ArticleSchema
extend ActiveSupport::Concern
include Swagger::Blocks
included do
swagger_schema :Article do
property :id do
key :type, :integer
end
property :type do
key :type, :string
end
property :attributes, type: :object do
property :text do
key :type, :string
end
end
property :included, type: :array do
items do
key :'$ref', :Comment
end
items do
key :'$ref', :Author
end
end #end included
end
end
end
module Swagger::CommentSchema
extend ActiveSupport::Concern
include Swagger::Blocks
included do
swagger_schema :Article do
property :id do
key :type, :integer
end
property :type do
key :type, :string
end
property :attributes, type: :object do
property :text do
key :type, :string
end
end
end
end
end
module Swagger::AuthorSchema
extend ActiveSupport::Concern
include Swagger::Blocks
included do
swagger_schema :Article do
property :id do
key :type, :integer
end
property :type do
key :type, :string
end
property :attributes, type: :object do
property :full_name do
key :type, :string
end
end
end
end
end
Is there any way to get them working with $ref? Or i need to manually specify all the 'included' relations manually?
Thanks!
The text was updated successfully, but these errors were encountered:
Hello thanks for this awesome gem!
I'm having an issue when trying to define the schema following jsonapi spec, particularly with the "included" array where someone can specify objects related to the primary data, an array that can have different model/schema types.
I currently have a schema defined for an Article and then a schema for the Author and the Comments. If i try to relate this two last schemas (Author and Comments) on the 'included' array of the Article block it doesn't work. I tried with bot these two forms
And with
The full Article, Comment and Author schemas are something like these
Is there any way to get them working with $ref? Or i need to manually specify all the 'included' relations manually?
Thanks!
The text was updated successfully, but these errors were encountered: