11import { hasException } from './utils/exceptions.js' ;
22import {
3- collectAdoption ,
4- collectException ,
3+ collectAdoption , collectAndReturnViolation ,
4+ collectException , handleInternalError ,
55} from './utils/collectionUtils.js' ;
66import { resolveObject } from './utils/componentUtils.js' ;
7+ import { getSchemaNameFromRef } from './utils/methodUtils.js' ;
78
89const RULE_NAME = 'xgen-IPA-114-error-responses-refer-to-api-error' ;
910
@@ -25,14 +26,14 @@ export default (input, _, { path, documentInventory }) => {
2526 return ;
2627 }
2728
28- /* const errors = checkViolationsAndReturnErrors(apiResponseObject, oas, path, errorCode);
29+ const errors = checkViolationsAndReturnErrors ( apiResponseObject , oas , path , errorCode ) ;
2930 if ( errors . length !== 0 ) {
3031 return collectAndReturnViolation ( path , RULE_NAME , errors ) ;
3132 }
32- */
33+
3334 collectAdoption ( path , RULE_NAME ) ;
3435} ;
35- /*
36+
3637function checkViolationsAndReturnErrors ( apiResponseObject , oas , path , errorCode ) {
3738 try {
3839 const errors = [ ] ;
@@ -48,6 +49,7 @@ function checkViolationsAndReturnErrors(apiResponseObject, oas, path, errorCode)
4849 return [ { path, message : `${ errorCode } response must define content with ApiError schema reference.` } ] ;
4950 }
5051
52+ /*
5153 for (const [mediaType, mediaTypeObj] of Object.entries(content)) {
5254 if (!mediaType.endsWith('json')) {
5355 continue;
@@ -72,10 +74,9 @@ function checkViolationsAndReturnErrors(apiResponseObject, oas, path, errorCode)
7274 message: `${errorCode} response must reference ApiError schema.`,
7375 });
7476 }
75- }
77+ }*/
7678 return errors ;
7779 } catch ( e ) {
7880 handleInternalError ( RULE_NAME , path , e ) ;
7981 }
8082}
81- */
0 commit comments