route-name.ejs 692 B

123456789101112131415161718192021222324252627
  1. <%
  2. const { routeInfo, utils } = it;
  3. const {
  4. operationId,
  5. method,
  6. route,
  7. moduleName,
  8. responsesTypes,
  9. description,
  10. tags,
  11. summary,
  12. pathArgs,
  13. } = routeInfo;
  14. const { _, fmtToJSDocLine, require } = utils;
  15. const createCustomOperationId = (method, route, moduleName) => {
  16. const hasPathInserts = /\{(\w){1,}\}/g.test(route);
  17. const splitedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/"));
  18. const routeParts = (splitedRouteBySlash.length > 1
  19. ? [splitedRouteBySlash[splitedRouteBySlash.length-1]]
  20. : splitedRouteBySlash
  21. ).join("_");
  22. return _.camelCase(_.lowerCase(routeParts));
  23. };
  24. return createCustomOperationId(method, route, moduleName);
  25. %>