process()

in src/processors/NodeEndpointHackProcessor.js [23:56]


  process(specs, metadata) {
    const APISpecs = specs.api_specs;
    for (const clsName in APISpecs) {
      const APIClsSpec = APISpecs[clsName];
      for (const index in APIClsSpec.apis) {
        const APISpec = APIClsSpec.apis[index];
        const name = APISpec.name;
        if (name === '#get') {
          APISpec.endpoint = '';
          APISpec.method = 'GET';
          APISpec.name = 'get';
          APISpec.return = clsName;
          APIClsSpec.has_get = true;
        } else if (name === '#update') {
          APISpec.endpoint = '';
          APISpec.method = 'POST';
          APISpec.name = 'update';
        } else if (name === '#delete') {
          APISpec.endpoint = '';
          APISpec.method = 'DELETE';
          APISpec.name = 'delete';
        }
      }
    }

    // handling read_endpoints
    const readEndpoints = metadata.mergedOverriding.read_endpoints;
    for (const clsName in readEndpoints) {
      if (APISpecs[clsName]) {
        APISpecs[clsName]['read_endpoint'] = readEndpoints[clsName];
      }
    }
    return specs;
  },