2121 expect ( klass . attributes_writable_by_default ) . to eq ( true )
2222 expect ( klass . attributes_sortable_by_default ) . to eq ( true )
2323 expect ( klass . attributes_filterable_by_default ) . to eq ( true )
24+ expect ( klass . attributes_schema_by_default ) . to eq ( true )
2425 expect ( klass . relationships_readable_by_default ) . to eq ( true )
2526 expect ( klass . relationships_writable_by_default ) . to eq ( true )
2627 end
6364 expect ( klass . attributes_writable_by_default ) . to eq ( true )
6465 expect ( klass . attributes_sortable_by_default ) . to eq ( true )
6566 expect ( klass . attributes_filterable_by_default ) . to eq ( true )
67+ expect ( klass . attributes_schema_by_default ) . to eq ( true )
6668 expect ( klass . relationships_readable_by_default ) . to eq ( true )
6769 expect ( klass . relationships_writable_by_default ) . to eq ( true )
6870 end
@@ -147,6 +149,7 @@ def self.name
147149 self . attributes_writable_by_default = false
148150 self . attributes_sortable_by_default = false
149151 self . attributes_filterable_by_default = false
152+ self . attributes_schema_by_default = false
150153 self . relationships_readable_by_default = false
151154 self . relationships_writable_by_default = false
152155 end
@@ -160,6 +163,7 @@ def self.name
160163 expect ( klass . attributes_writable_by_default ) . to eq ( false )
161164 expect ( klass . attributes_sortable_by_default ) . to eq ( false )
162165 expect ( klass . attributes_filterable_by_default ) . to eq ( false )
166+ expect ( klass . attributes_schema_by_default ) . to eq ( false )
163167 expect ( klass . relationships_readable_by_default ) . to eq ( false )
164168 expect ( klass . relationships_writable_by_default ) . to eq ( false )
165169 end
@@ -288,6 +292,7 @@ class TestResourceOverrideSerializer < PORO::ApplicationSerializer
288292 self . attributes_writable_by_default = false
289293 self . attributes_sortable_by_default = false
290294 self . attributes_filterable_by_default = false
295+ self . attributes_schema_by_default = false
291296 self . relationships_readable_by_default = false
292297 self . relationships_writable_by_default = false
293298 end
@@ -301,6 +306,7 @@ class TestResourceOverrideSerializer < PORO::ApplicationSerializer
301306 expect ( klass2 . attributes_writable_by_default ) . to eq ( false )
302307 expect ( klass2 . attributes_sortable_by_default ) . to eq ( false )
303308 expect ( klass2 . attributes_filterable_by_default ) . to eq ( false )
309+ expect ( klass2 . attributes_schema_by_default ) . to eq ( false )
304310 expect ( klass2 . relationships_readable_by_default ) . to eq ( false )
305311 expect ( klass2 . relationships_writable_by_default ) . to eq ( false )
306312 end
@@ -564,6 +570,7 @@ def apply_attribute
564570 expect ( attribute [ :writable ] ) . to eq ( true )
565571 expect ( attribute [ :sortable ] ) . to eq ( true )
566572 expect ( attribute [ :filterable ] ) . to eq ( true )
573+ expect ( attribute [ :schema ] ) . to eq ( true )
567574 end
568575
569576 context "when :only passed" do
@@ -578,6 +585,7 @@ def apply_attribute
578585 expect ( att [ :readable ] ) . to eq ( false )
579586 expect ( att [ :sortable ] ) . to eq ( false )
580587 expect ( att [ :writable ] ) . to eq ( false )
588+ expect ( att [ :schema ] ) . to eq ( true )
581589 end
582590 end
583591
@@ -592,6 +600,7 @@ def apply_attribute
592600 expect ( att [ :readable ] ) . to eq ( false )
593601 expect ( att [ :sortable ] ) . to eq ( true )
594602 expect ( att [ :writable ] ) . to eq ( false )
603+ expect ( att [ :schema ] ) . to eq ( true )
595604 end
596605 end
597606
@@ -607,6 +616,7 @@ def apply_attribute
607616 expect ( att [ :readable ] ) . to eq ( false )
608617 expect ( att [ :sortable ] ) . to eq ( false )
609618 expect ( att [ :writable ] ) . to eq ( false )
619+ expect ( att [ :schema ] ) . to eq ( true )
610620 end
611621 end
612622 end
@@ -623,6 +633,7 @@ def apply_attribute
623633 expect ( att [ :readable ] ) . to eq ( true )
624634 expect ( att [ :sortable ] ) . to eq ( true )
625635 expect ( att [ :writable ] ) . to eq ( false )
636+ expect ( att [ :schema ] ) . to eq ( true )
626637 end
627638 end
628639
@@ -637,6 +648,7 @@ def apply_attribute
637648 expect ( att [ :readable ] ) . to eq ( true )
638649 expect ( att [ :sortable ] ) . to eq ( false )
639650 expect ( att [ :writable ] ) . to eq ( false )
651+ expect ( att [ :schema ] ) . to eq ( true )
640652 end
641653 end
642654 end
@@ -652,6 +664,7 @@ def apply_attribute
652664 expect ( att [ :readable ] ) . to eq ( true )
653665 expect ( att [ :sortable ] ) . to eq ( :admin? )
654666 expect ( att [ :writable ] ) . to eq ( false )
667+ expect ( att [ :schema ] ) . to eq ( true )
655668 end
656669 end
657670
@@ -737,6 +750,7 @@ def apply_attribute
737750 self . attributes_writable_by_default = false
738751 self . attributes_sortable_by_default = false
739752 self . attributes_filterable_by_default = false
753+ self . attributes_schema_by_default = false
740754 end
741755 end
742756
@@ -747,6 +761,7 @@ def apply_attribute
747761 expect ( attribute [ :writable ] ) . to eq ( false )
748762 expect ( attribute [ :sortable ] ) . to eq ( false )
749763 expect ( attribute [ :filterable ] ) . to eq ( false )
764+ expect ( attribute [ :schema ] ) . to eq ( false )
750765 end
751766 end
752767
@@ -812,6 +827,17 @@ def self.name
812827 end
813828 end
814829
830+ context "when explicit schema flag" do
831+ before do
832+ klass . attribute :foo , :string , schema : false
833+ end
834+
835+ it "overrides the default" do
836+ attribute = klass . config [ :attributes ] [ :foo ]
837+ expect ( attribute [ :schema ] ) . to eq ( false )
838+ end
839+ end
840+
815841 context "when readable" do
816842 let ( :serializer ) do
817843 Class . new ( Graphiti ::Serializer )
0 commit comments