small optimizations and fixes
handles cases where docs have 'context-path' but 'path-items'