juzhiyuan commented on a change in pull request #485:
URL: https://github.com/apache/apisix-dashboard/pull/485#discussion_r490655427



##########
File path: src/pages/Route/transform.ts
##########
@@ -252,3 +252,131 @@ export const transformRouteData = (data: 
RouteModule.Body) => {
     step3Data,
   };
 };
+
+export const transformRouteDebugData = (data: RouteModule.Body) => {
+  const {
+    name,
+    desc,
+    methods,
+    uris,
+    protocols,
+    // hosts,
+    vars,
+    // redirect,
+    url,
+  } = data;
+
+  const paths = {};
+  const tags: RouteModule.TagSchema[] = [
+    {
+      name: `Route-${name}`,
+      description: desc,
+    },
+  ];
+  const servers: RouteModule.Server[] = [];
+  const responses: RouteModule.ResponseSchema = {
+    // default response code
+    '200': {
+      description: 'successful operation',
+      content: {},
+    },
+    '400': {
+      description: 'Invalid parameter',
+      content: {},
+    },
+    '500': {
+      description: 'Internal Server Error',
+      content: {},
+    },
+  };
+  const params = transformVarsToRules(vars);
+  const formatParams = params.map((param) => {
+    const { position, operator } = param;
+    let paramPostion;
+
+    switch (position) {
+      case 'cookie':
+        paramPostion = 'cookie';
+        break;
+      case 'http':
+        paramPostion = 'header';
+        break;
+      case 'arg':
+        paramPostion = 'query';
+        break;
+      default:
+        break;
+    }
+    return {
+      name: param.name,
+      in: paramPostion,
+      description: `default value should ${operator} ${param.value}`,
+      required: true,
+      type: 'string',
+    };
+  });
+  const pathParams = {
+    name: 'pathParam',
+    in: 'path',
+    description: `enter your path param`,
+    required: true,
+    type: 'string',
+  };
+  const requestBodyMethod = ['POST', 'PUT', 'PATCH'];
+
+  protocols.forEach((protocol) => {
+    if (protocol !== 'websocket') {
+      servers.push({
+        url: `${protocol}://${url}`,
+      });
+      // FIXME

Review comment:
       I'm not family with Docker, this issue could be discussed with @nic-chen 
@gxthrj @bzp2010 , if this trick way works, I think it's ok to use here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to