Is there any simple to use Javascript library that is capable of loading OpenAPI specification and providing information about operation based on path and HTTP method?
Example
const theTool = magicLibrary.loadOpenAPISpec(spec);
const operationInfo = theTool.findOperation({method: 'GET', path: '/resource/1234'});
const operationId = operationInfo.operationId;
Please note that path can contain path parameter and query parameters so the tool has to really check against OpenAPI specification and provide correct operation.
Simplest thing was to read YAML and reduces /paths as entries and build simple trie from entries.
This was around 40LoC and serves purpose and it's performant, predictable and under control.