diff --git a/lib/schemable/included_schema_generator.rb b/lib/schemable/included_schema_generator.rb index 7c3e02a..1f2ee4c 100644 --- a/lib/schemable/included_schema_generator.rb +++ b/lib/schemable/included_schema_generator.rb @@ -60,9 +60,8 @@ module Schemable properties: { type: { type: :string, default: model_definition.model_name }, id: { type: :string }, - attributes: attributes_schema, - relationships: relationships_schema ? {} : relationships_schema - } + attributes: attributes_schema + }.merge!(relationships_schema.blank? ? {} : { relationships: relationships_schema }) }.compact_blank end end