Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 42x 12751x 12751x 12751x 12751x 12751x 12751x | module.exports = (path, isOAS3) => { const pathsForParameters = [ 'get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace', 'components' ]; const inParametersSection = path[path.length - 2] === 'parameters'; // the above check is a necessary but not sufficient check for a parameter object // use the following checks to verify the object is where a parameter is supposed to be. // without these, a schema property named "parameters" would get validated as a parameter const isParameterByPath = pathsForParameters.includes(path[path.length - 3]); const isPathItemParameter = path[path.length - 4] === 'paths' && path.length === 4; const isTopLevelParameter = !isOAS3 && path[0] === 'parameters' && path.length === 2; return ( inParametersSection && (isParameterByPath || isPathItemParameter || isTopLevelParameter) ); }; |