packages/insomnia-importers/src/importers/openapi3.js
function parseEndpoints(document) {
  const defaultParent = WORKSPACE_ID;

  const paths = Object.keys(document.paths);
  const endpointsSchemas = paths
    .map(path => {
      const schemasPerMethod = document.paths[path];
      const methods = Object.keys(schemasPerMethod);

      return methods
        .filter(method => method !== 'parameters')
        .map(method => Object.assign({}, schemasPerMethod[method], { path, method }));
    })
    .reduce((flat, arr) => flat.concat(arr), []); //flat single array

  const tags = document.tags || [];
  const folders = tags.map(tag => {
    return importFolderItem(tag, defaultParent);
  });
  const folderLookup = {};
  folders.forEach(folder => (folderLookup[folder.name] = folder._id));

  const requests = [];
  endpointsSchemas.map(endpointSchema => {
    let { tags } = endpointSchema;
    if (!tags || tags.length == 0) tags = [''];
    tags.forEach((tag, index) => {
      let id = endpointSchema.operationId
        ? `${endpointSchema.operationId}${index > 0 ? index : ''}`
        : `__REQUEST_${requestCount++}__`;
      let parentId = folderLookup[tag] || defaultParent;
      requests.push(importRequest(endpointSchema, id, parentId));
    });
  });

  return [...folders, ...requests];
}
function parseEndpoints(document) {
  const defaultParent = WORKSPACE_ID;

  const paths = Object.keys(document.paths);
  const endpointsSchemas = paths
    .map(path => {
      const schemasPerMethod = document.paths[path];
      const methods = Object.keys(schemasPerMethod);

      return methods
        .filter(method => method !== 'parameters')
        .map(method => Object.assign({}, schemasPerMethod[method], { path, method }));
    })
    .reduce((flat, arr) => flat.concat(arr), []); //flat single array

  const tags = document.tags || [];
  const folders = tags.map(tag => {
    return importFolderItem(tag, defaultParent);
  });
  const folderLookup = {};
  folders.forEach(folder => (folderLookup[folder.name] = folder._id));

  const requests = [];
  endpointsSchemas.map(endpointSchema => {
    let { tags } = endpointSchema;
    if (!tags || tags.length == 0) tags = [''];
    tags.forEach((tag, index) => {
      let id = endpointSchema.operationId
        ? `${endpointSchema.operationId}${index > 0 ? index : ''}`
        : `__REQUEST_${requestCount++}__`;
      let parentId = folderLookup[tag] || defaultParent;
      requests.push(importRequest(endpointSchema, id, parentId));
    });
  });

  return [...folders, ...requests];
}
function parseEndpoints ( document ) { const defaultParent = WORKSPACE_ID ; const paths = Object . keys ( document . paths ) ; const endpointsSchemas = paths . map ( path => { const schemasPerMethod = document . paths [ path ] ; const methods = Object . keys ( schemasPerMethod ) ; return methods . filter ( method => method !== 'parameters' ) . map ( method => Object . assign ( { } , schemasPerMethod [ method ] , { path , method } ) ) ; } ) . reduce ( ( flat , arr ) => flat . concat ( arr ) , [ ] ) ; //flat single array const tags = document . tags || [ ] ; const folders = tags . map ( tag => { return importFolderItem ( tag , defaultParent ) ; } ) ; const folderLookup = { } ; folders . forEach ( folder => ( folderLookup [ folder . name ] = folder . _id ) ) ; const requests = [ ] ; endpointsSchemas . map ( endpointSchema => { let { tags } = endpointSchema ; if ( ! tags || tags . length == 0 ) tags = [ '' ] ; tags . forEach ( ( tag , index ) => { let id = endpointSchema . operationId ? ` ${ endpointSchema . operationId } ${ index > 0 ? index : '' } ` : ` ${ requestCount ++ } ` ; let parentId = folderLookup [ tag ] || defaultParent ; requests . push ( importRequest ( endpointSchema , id , parentId ) ) ; } ) ; } ) ; return [ ... folders , ... requests ] ; }
Create request definitions based on openapi document.

@param {Object} document - OpenAPI 3 valid object (https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#oasObject)

@returns {Object[]} array of insomnia endpoints definitions
Create request definitions based on openapi document .