File tree 3 files changed +60
-5
lines changed
3 files changed +60
-5
lines changed Original file line number Diff line number Diff line change 37
37
"peerDependencies" : {},
38
38
"dependencies" : {
39
39
"@stoplight/json" : " ^3.12.0" ,
40
- "@stoplight/json-schema-merge-allof" : " ^0.7.8 " ,
40
+ "@stoplight/json-schema-merge-allof" : " ^0.8.0 " ,
41
41
"@stoplight/lifecycle" : " ^2.3.2" ,
42
42
"@types/json-schema" : " ^7.0.7" ,
43
43
"magic-error" : " 0.0.1"
Original file line number Diff line number Diff line change @@ -787,6 +787,61 @@ describe('SchemaTree', () => {
787
787
) . toEqual ( '_Everyone_ ~hates~ loves caves' ) ;
788
788
} ) ;
789
789
790
+ it ( 'should not override description reference siblings' , ( ) => {
791
+ const schema = {
792
+ $schema : 'http://json-schema.org/draft-07/schema#' ,
793
+ type : 'object' ,
794
+ properties : {
795
+ AAAAA : {
796
+ allOf : [ { description : 'AAAAA' , type : 'string' } , { examples : [ 'AAAAA' ] } ] ,
797
+ } ,
798
+ BBBBB : {
799
+ allOf : [
800
+ {
801
+ $ref : '#/properties/AAAAA/allOf/0' ,
802
+ description : 'BBBBB' ,
803
+ } ,
804
+ { examples : [ 'BBBBB' ] } ,
805
+ ] ,
806
+ } ,
807
+ } ,
808
+ } ;
809
+
810
+ const tree = new SchemaTree ( schema , { } ) ;
811
+ tree . populate ( ) ;
812
+
813
+ expect ( tree . root ) . toEqual (
814
+ expect . objectContaining ( {
815
+ children : [
816
+ expect . objectContaining ( {
817
+ primaryType : 'object' ,
818
+ types : [ 'object' ] ,
819
+ children : [
820
+ expect . objectContaining ( {
821
+ primaryType : 'string' ,
822
+ subpath : [ 'properties' , 'AAAAA' ] ,
823
+ types : [ 'string' ] ,
824
+ annotations : {
825
+ description : 'AAAAA' ,
826
+ examples : [ 'AAAAA' ] ,
827
+ } ,
828
+ } ) ,
829
+ expect . objectContaining ( {
830
+ primaryType : 'string' ,
831
+ subpath : [ 'properties' , 'BBBBB' ] ,
832
+ types : [ 'string' ] ,
833
+ annotations : {
834
+ description : 'BBBBB' ,
835
+ examples : [ 'BBBBB' ] ,
836
+ } ,
837
+ } ) ,
838
+ ] ,
839
+ } ) ,
840
+ ] ,
841
+ } ) ,
842
+ ) ;
843
+ } ) ;
844
+
790
845
it ( 'node of type array should keep its own description even when referenced node has a description' , ( ) => {
791
846
const schema = {
792
847
definitions : {
Original file line number Diff line number Diff line change 936
936
dependencies :
937
937
eslint-config-prettier "^7.1.0"
938
938
939
- " @stoplight/json-schema-merge-allof@^0.7.8 " :
940
- version "0.7.8 "
941
- resolved "https://registry.yarnpkg.com/@stoplight/json-schema-merge-allof/-/json-schema-merge-allof-0.7.8. tgz#7efe5e0086dff433eb011f617e82f7295c3de061 "
942
- integrity sha512-JTDt6GYpCWQSb7+UW1P91IAp/pcLWis0mmEzWVFcLsrNgtUYK7JLtYYz0ZPSR4QVL0fJ0YQejM+MPq5iNDFO4g ==
939
+ " @stoplight/json-schema-merge-allof@^0.8.0 " :
940
+ version "0.8.0 "
941
+ resolved "https://registry.yarnpkg.com/@stoplight/json-schema-merge-allof/-/json-schema-merge-allof-0.8.0. tgz#62f8116f59d9df5a910d037b1965decd2efab472 "
942
+ integrity sha512-g8e0s43v96Xbzvd8d6KKUuJTO16CS2oJglJrviUi8ASIUxzFvAJqTHWLtGmpTryisQopqg1evXGJfi0+164+Qw ==
943
943
dependencies :
944
944
compute-lcm "^1.1.0"
945
945
json-schema-compare "^0.2.2"
You can’t perform that action at this time.
0 commit comments