[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-12 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r345528206
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/parser/api/OpenApiAnnotationParser.java
 ##
 @@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator.parser.api;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.servicecomb.toolkit.generator.OasContext;
+import org.apache.servicecomb.toolkit.generator.OperationContext;
+import org.apache.servicecomb.toolkit.generator.ParameterContext;
+import 
org.apache.servicecomb.toolkit.generator.annotation.ClassAnnotationProcessor;
+import 
org.apache.servicecomb.toolkit.generator.annotation.MethodAnnotationProcessor;
+import 
org.apache.servicecomb.toolkit.generator.annotation.ParamAnnotationProcessor;
+
+public interface OpenApiAnnotationParser {
+
+  /**
+   *
+   * @param cls
+   * @param context
+   */
+  void parser(Class cls, OasContext context);
+
+  /**
+   * 用于排序, 对于同一个类,同时只能为springmvc或者jaxrs其中一种
 
 Review comment:
   Still not translated


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-12 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r345527907
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/context/OasContext.java
 ##
 @@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator.context;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import 
org.apache.servicecomb.toolkit.generator.parser.api.OpenApiAnnotationParser;
+
+import io.swagger.v3.oas.models.Components;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.PathItem;
+import io.swagger.v3.oas.models.PathItem.HttpMethod;
+import io.swagger.v3.oas.models.Paths;
+import io.swagger.v3.oas.models.info.Info;
+import io.swagger.v3.oas.models.servers.Server;
+
+public class OasContext implements IExtensionsContext {
+
+  private OpenAPI openAPI;
+
+  private String basePath;
+
+  private Class cls;
+
+  private List operationList = new ArrayList<>();
+
+  private OpenApiAnnotationParser parser;
+
+  private List schemaCtxList = new ArrayList<>();
+
+  public OasContext(OpenApiAnnotationParser parser) {
+this(new OpenAPI(), parser);
+  }
+
+  public OasContext(OpenAPI openAPI, OpenApiAnnotationParser parser) {
+this.openAPI = openAPI;
+this.parser = parser;
+  }
+
+  public OpenAPI toOpenAPI() {
+ensurePaths();
+for (OperationContext operationCtx : operationList) {
+  if (!operationCtx.hasOperation()) {
+continue;
+  }
+
+  if (openAPI.getPaths() == null) {
+openAPI.setPaths(new Paths());
+  }
+
+  PathItem pathItem = openAPI.getPaths().get(operationCtx.getPath());
+  if (pathItem == null) {
+pathItem = new PathItem();
+openAPI.path(operationCtx.getPath(), pathItem);
+  }
+  pathItem.operation(HttpMethod.valueOf(operationCtx.getHttpMethod()), 
operationCtx.toOperation());
+}
+
+// 如果没有restful资源则返回null
 
 Review comment:
   Still not translated


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-12 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r345527574
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/HttpStatuses.java
 ##
 @@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator;
+
+public class HttpStatuses {
+
+  public static String OK = "200";
 
 Review comment:
   Ooops, should be `final`


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-12 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r345527200
 
 

 ##
 File path: oas-generator/pom.xml
 ##
 @@ -0,0 +1,132 @@
+
+
+http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  
+toolkit
+org.apache.servicecomb.toolkit
+0.2.0-SNAPSHOT
+  
+  4.0.0
+  pom
+  
+oas-generator-core
+oas-generator-jaxrs
+oas-generator-spring
+oas-generator-servicecomb
+  
+
+  oas-generator
+
+  
+2.0.10
+4.12
+7.2
+1.6.2
+1.2.0
+5.1.6.RELEASE
+  
+  
+
+  
+io.swagger.core.v3
+swagger-models
+${swagger.version}
+  
+
+  
+io.swagger.core.v3
+swagger-annotations
+${swagger.version}
+  
+
+  
+io.swagger.core.v3
+swagger-core
+${swagger.version}
+  
+
+  
+junit
+junit
+${junit.version}
+  
+
+  
+org.ow2.asm
+asm
+${asm.version}
+  
+
+  
+javax.ws.rs
+javax.ws.rs-api
+2.1
+  
+
+  
+org.apache.servicecomb
+provider-rest-common
+${javachassis.version}
+  
+
+  
+org.apache.servicecomb
+provider-pojo
+${javachassis.version}
+  
+
+  
+org.springframework
+spring-web
+${spring.version}
+  
+
+  
+org.powermock
+powermock-module-junit4
+${powermock.version}
+test
+  
+
+  
+org.powermock
+powermock-api-mockito
+${powermock.version}
+test
+  
+
+  
+
+  
+
+  
+
+  org.apache.maven.plugins
+  maven-compiler-plugin
 
 Review comment:
   About maven-compiler-plugin configuration in pom.xml problem. 
   Sorry I didn't say it clearly. What I mean is we should put this plugin 
configuration in project root pom.xml, as long as you search 
maven-compiler-plugin in pom.xml files in the whole project, you will see that 
there are duplicates.
   But it's not your problem so I think is OK in this PR, and we can fix this 
problem in another PR


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-09 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344435974
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/HttpStatus.java
 ##
 @@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator;
+
+public class HttpStatus {
 
 Review comment:
   There many class named HttpStatus in the 3rd party deps, so I just think a 
different name will be less likely misused


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-09 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344434463
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/MediaTypeConst.java
 ##
 @@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator;
+
+/**
+ * Common media type constants
+ *
+ * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7";>HTTP/1.1 
section 3.7
+ */
+public class MediaTypeConst {
 
 Review comment:
   Same as HttpStatus, besides named as MediaTypes will be better


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-09 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344434378
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/util/LocalVariableVisitor.java
 ##
 @@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator.util;
+
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Type;
+
+public class LocalVariableVisitor extends MethodVisitor {
+
+  private boolean isStatic;
 
 Review comment:
   Not used field


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-09 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344434488
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/parser/api/OpenApiAnnotationParser.java
 ##
 @@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator.parser.api;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.servicecomb.toolkit.generator.OasContext;
+import org.apache.servicecomb.toolkit.generator.OperationContext;
+import org.apache.servicecomb.toolkit.generator.ParameterContext;
+import 
org.apache.servicecomb.toolkit.generator.annotation.ClassAnnotationProcessor;
+import 
org.apache.servicecomb.toolkit.generator.annotation.MethodAnnotationProcessor;
+import 
org.apache.servicecomb.toolkit.generator.annotation.ParamAnnotationProcessor;
+
+public interface OpenApiAnnotationParser {
+
+  /**
+   *
+   * @param cls
+   * @param context
+   */
+  void parser(Class cls, OasContext context);
+
+  /**
+   * 用于排序, 对于同一个类,同时只能为springmvc或者jaxrs其中一种
 
 Review comment:
   Chinese comment, translate to english will be better


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-09 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344434485
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/OasContext.java
 ##
 @@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import 
org.apache.servicecomb.toolkit.generator.parser.api.OpenApiAnnotationParser;
+
+import io.swagger.v3.oas.models.Components;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.PathItem;
+import io.swagger.v3.oas.models.PathItem.HttpMethod;
+import io.swagger.v3.oas.models.Paths;
+import io.swagger.v3.oas.models.info.Info;
+import io.swagger.v3.oas.models.servers.Server;
+
+public class OasContext {
+
+  private OpenAPI openAPI;
+
+  private String basePath;
+
+  private Class cls;
+
+  private List operationList = new ArrayList<>();
+
+  private OpenApiAnnotationParser parser;
+
+  public OasContext(OpenApiAnnotationParser parser) {
+this(new OpenAPI(), parser);
+  }
+
+  public OasContext(OpenAPI openAPI, OpenApiAnnotationParser parser) {
+this.openAPI = openAPI;
+this.parser = parser;
+  }
+
+  public OpenAPI toOpenAPI() {
+ensurePaths();
+for (OperationContext operationCtx : operationList) {
+  if (!operationCtx.hasOperation()) {
+continue;
+  }
+
+  if (openAPI.getPaths() == null) {
+openAPI.setPaths(new Paths());
+  }
+
+  PathItem pathItem = openAPI.getPaths().get(operationCtx.getPath());
+  if (pathItem == null) {
+pathItem = new PathItem();
+openAPI.path(operationCtx.getPath(), pathItem);
+  }
+  pathItem.operation(HttpMethod.valueOf(operationCtx.getHttpMethod()), 
operationCtx.toOperation());
+}
+
+// 如果没有restful资源则返回null
 
 Review comment:
   Chinese comment, translate to english will be better


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-09 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344434324
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/util/ParamUtils.java
 ##
 @@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Parameter;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+
+public class ParamUtils {
+
+  private static final String STATIC_CLASS_INIT = "";
+
+  public static final Map paramterCache = new HashMap();
+
+  public static String getParamterName(Method method, Parameter parameter) {
+
+String[] parameterNames = paramterCache.get(method);
+
+if (parameterNames == null) {
+  parameterNames = initParamterNames(method);
+  if (parameterNames == null) {
+return null;
+  }
+}
+
+int paramIndex = getParamIndex(method, parameter);
+if (paramIndex >= 0) {
+  return parameterNames[paramIndex];
+}
+
+return null;
+  }
+
+  private static int getParamIndex(Method method, Parameter parameter) {
+Parameter[] parameters = method.getParameters();
+for (int i = 0; i < parameters.length; i++) {
+  if (parameters[i].equals(parameter)) {
+return i;
+  }
+}
+return -1;
+  }
+
+  private static String[] initParamterNames(Method m) {
 
 Review comment:
   Typo, should be initParameterNames


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-09 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344434434
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/HttpStatus.java
 ##
 @@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator;
+
+public class HttpStatus {
 
 Review comment:
   Since it serves as constant values, should be abstract with a private 
constructor or just with a private constructor to make it "constant"
   Besides named as HttpStatuses will be better


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-09 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344434307
 
 

 ##
 File path: 
oas-generator/oas-generator-core/src/main/java/org/apache/servicecomb/toolkit/generator/util/ParamUtils.java
 ##
 @@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.toolkit.generator.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Parameter;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+
+public class ParamUtils {
+
+  private static final String STATIC_CLASS_INIT = "";
+
+  public static final Map paramterCache = new HashMap();
+
+  public static String getParamterName(Method method, Parameter parameter) {
 
 Review comment:
   Typo, should be getParameterName


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-08 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344432493
 
 

 ##
 File path: oas-generator/oas-generator-spring/pom.xml
 ##
 @@ -0,0 +1,42 @@
+
+
+http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  
+oas-generator
+org.apache.servicecomb.toolkit
+0.2.0-SNAPSHOT
+  
+  4.0.0
+
+  oas-generator-spring
+
+  
+
+  org.apache.servicecomb.toolkit
+  oas-generator-core
+
+
+  org.springframework
+  spring-web
+  5.2.0.RELEASE
 
 Review comment:
   It'll be better if we keep track of the 3rd party deps in the parent pom.


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-08 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344432409
 
 

 ##
 File path: oas-generator/oas-generator-core/pom.xml
 ##
 @@ -0,0 +1,68 @@
+
+
+http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  
+oas-generator
+org.apache.servicecomb.toolkit
+0.2.0-SNAPSHOT
+  
+  4.0.0
+
+  oas-generator-core
+
+  
+2.0.9
 
 Review comment:
   Since oas-validator-core use io.swagger.parser.v3:swagger-parser:2.0.15 
which depends on swagger-models:2.0.10 so I think it will be better to keep 
them same


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


With regards,
Apache Git Services


[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #38: SCB-1547 add oas-generator to generate openapi v3

2019-11-08 Thread GitBox
chanjarster commented on a change in pull request #38: SCB-1547 add 
oas-generator to generate openapi v3
URL: https://github.com/apache/servicecomb-toolkit/pull/38#discussion_r344432534
 
 

 ##
 File path: oas-generator/pom.xml
 ##
 @@ -0,0 +1,67 @@
+
+
+http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  
+toolkit
+org.apache.servicecomb.toolkit
+0.2.0-SNAPSHOT
+  
+  4.0.0
+  pom
+  
+oas-generator-core
+oas-generator-jaxrs
+oas-generator-spring
+oas-generator-servicecomb
+  
+
+  oas-generator
+
+  
+
+  org.powermock
+  powermock-module-junit4
+  1.6.2
+  test
+
+
+
+  org.powermock
+  powermock-api-mockito
+  1.6.2
+  test
+
+  
+
+  
+
+  
+org.apache.maven.plugins
+maven-compiler-plugin
 
 Review comment:
   It'll be better if we manage plugin version and configuration in the parent 
pom's pluginManagement part


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


With regards,
Apache Git Services