@@ -65,45 +65,6 @@ function getFoldersByVersion(folder30Path, folder31Path) {
65
65
66
66
describe ( 'Validate with servers' , function ( ) {
67
67
68
- it ( 'Should convert and validate allOf properties for string schema' , function ( ) {
69
- const openAPI = path . join ( __dirname , VALID_OPENAPI_FOLDER_PATH + '/all_of_property.json' ) ,
70
- openAPIData = fs . readFileSync ( openAPI , 'utf8' ) ,
71
- expectedRequestBody = '{\n "id": "3",\n "name": "Contract.pdf"\n}' ,
72
- options = {
73
- requestParametersResolution : 'Example' ,
74
- exampleParametersResolution : 'Example' ,
75
- showMissingInSchemaErrors : true ,
76
- strictRequestMatching : true ,
77
- ignoreUnresolvedVariables : true ,
78
- validateMetadata : true ,
79
- suggestAvailableFixes : true ,
80
- detailedBlobValidation : false
81
- } ,
82
- schemaPack = new Converter . SchemaPack ( { type : 'string' , data : openAPIData } , options ) ;
83
- schemaPack . convert ( ( err , conversionResult ) => {
84
- expect ( err ) . to . be . null ;
85
- expect ( conversionResult . result ) . to . equal ( true ) ;
86
- expect ( conversionResult . output [ 0 ] . data . item [ 0 ] . response [ 0 ] . body ) . to . equal ( expectedRequestBody ) ;
87
-
88
- let historyRequest = [ ] ;
89
-
90
- getAllTransactions ( conversionResult . output [ 0 ] . data , historyRequest ) ;
91
-
92
- schemaPack . validateTransaction ( historyRequest , ( err , result ) => {
93
- expect ( err ) . to . be . null ;
94
- expect ( result ) . to . be . an ( 'object' ) ;
95
-
96
- let requestIds = Object . keys ( result . requests ) ;
97
- expect ( err ) . to . be . null ;
98
- expect ( result . missingEndpoints . length ) . to . eq ( 0 ) ;
99
- requestIds . forEach ( ( requestId ) => {
100
- expect ( result . requests [ requestId ] . endpoints [ 0 ] ) . to . not . be . undefined ;
101
- expect ( result . requests [ requestId ] . endpoints [ 0 ] . matched ) . to . be . true ;
102
- } ) ;
103
- } ) ;
104
- } ) ;
105
- } ) ;
106
-
107
68
it ( 'Fix for GITHUB#496: Should identify url with fragment' , function ( ) {
108
69
const openAPI = path . join ( __dirname , VALID_OPENAPI_FOLDER_PATH + '/explicit_server_in_path.json' ) ,
109
70
openAPIData = fs . readFileSync ( openAPI , 'utf8' ) ,
@@ -1653,3 +1614,45 @@ describe('validateTransaction method. Path variables matching validation (issue
1653
1614
} ) ;
1654
1615
} ) ;
1655
1616
} ) ;
1617
+
1618
+ describe ( 'validateTransaction convert and validate schemas with allOf' , function ( ) {
1619
+ it ( 'Should convert and validate allOf properties for string schema' , function ( ) {
1620
+ const openAPI = path . join ( __dirname , VALID_OPENAPI_FOLDER_PATH + '/all_of_property.json' ) ,
1621
+ openAPIData = fs . readFileSync ( openAPI , 'utf8' ) ,
1622
+ expectedRequestBody = '{\n "id": "3",\n "name": "Contract.pdf"\n}' ,
1623
+ options = {
1624
+ requestParametersResolution : 'Example' ,
1625
+ exampleParametersResolution : 'Example' ,
1626
+ showMissingInSchemaErrors : true ,
1627
+ strictRequestMatching : true ,
1628
+ ignoreUnresolvedVariables : true ,
1629
+ validateMetadata : true ,
1630
+ suggestAvailableFixes : true ,
1631
+ detailedBlobValidation : false
1632
+ } ,
1633
+ schemaPack = new Converter . SchemaPack ( { type : 'string' , data : openAPIData } , options ) ;
1634
+ schemaPack . convert ( ( err , conversionResult ) => {
1635
+ expect ( err ) . to . be . null ;
1636
+ expect ( conversionResult . result ) . to . equal ( true ) ;
1637
+ expect ( conversionResult . output [ 0 ] . data . item [ 0 ] . response [ 0 ] . body ) . to . equal ( expectedRequestBody ) ;
1638
+
1639
+ let historyRequest = [ ] ;
1640
+
1641
+ getAllTransactions ( conversionResult . output [ 0 ] . data , historyRequest ) ;
1642
+
1643
+ schemaPack . validateTransaction ( historyRequest , ( err , result ) => {
1644
+ expect ( err ) . to . be . null ;
1645
+ expect ( result ) . to . be . an ( 'object' ) ;
1646
+
1647
+ let requestIds = Object . keys ( result . requests ) ;
1648
+ expect ( err ) . to . be . null ;
1649
+ expect ( result . missingEndpoints . length ) . to . eq ( 0 ) ;
1650
+ requestIds . forEach ( ( requestId ) => {
1651
+ expect ( result . requests [ requestId ] . endpoints [ 0 ] ) . to . not . be . undefined ;
1652
+ expect ( result . requests [ requestId ] . endpoints [ 0 ] . matched ) . to . be . true ;
1653
+ } ) ;
1654
+ } ) ;
1655
+ } ) ;
1656
+ } ) ;
1657
+ } ) ;
1658
+
0 commit comments