You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2019/07/02 02:17:06 UTC

[servicecomb-java-chassis] 02/03: [SCB-1337][WIP][WEAK] rollback org.apache.servicecomb.swagger.SwaggerUtils#validateSwagger, to avoid can not throw exception for wrong swagger

This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch weak-contract-type
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 8418b61d544f1527f9639e183ac2e349ee61f051
Author: wujimin <wu...@huawei.com>
AuthorDate: Mon Jul 1 23:58:07 2019 +0800

    [SCB-1337][WIP][WEAK] rollback org.apache.servicecomb.swagger.SwaggerUtils#validateSwagger, to avoid can not throw exception for wrong swagger
---
 .../src/main/resources/microservices/jaxrs/compute.yaml       | 11 ++++++-----
 .../src/test/resources/microservices/jaxrs/schemaFirst.yaml   |  3 ++-
 .../java/org/apache/servicecomb/swagger/SwaggerUtils.java     |  1 -
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/demo/demo-schema/src/main/resources/microservices/jaxrs/compute.yaml b/demo/demo-schema/src/main/resources/microservices/jaxrs/compute.yaml
index 66eb476..c7a1fa1 100644
--- a/demo/demo-schema/src/main/resources/microservices/jaxrs/compute.yaml
+++ b/demo/demo-schema/src/main/resources/microservices/jaxrs/compute.yaml
@@ -22,7 +22,7 @@ info:
   title: rest test
   version: 1.0.0
   x-java-interface: org.apache.servicecomb.demo.compute.Compute
-  
+
 # the domain of the service
 #host: api.uber.com
 
@@ -34,7 +34,7 @@ info:
 basePath: /compute
 produces:
   - application/json
-  
+
 paths:
   /add:
     post:
@@ -50,10 +50,10 @@ paths:
           required: true
           type: integer
           format: int32
-      responses: 
+      responses:
         200:
           description: add numer
-          schema: 
+          schema:
             type: integer
             format: int32
   /reduce:
@@ -98,7 +98,8 @@ paths:
           in: body
           required: true
           x-raw-json: true
-          type: string
+          schema:
+            type: string
       responses:
         200:
           description: test RawJson String
diff --git a/integration-tests/jaxrs-tests/src/test/resources/microservices/jaxrs/schemaFirst.yaml b/integration-tests/jaxrs-tests/src/test/resources/microservices/jaxrs/schemaFirst.yaml
index c9ccda1..2dafe26 100644
--- a/integration-tests/jaxrs-tests/src/test/resources/microservices/jaxrs/schemaFirst.yaml
+++ b/integration-tests/jaxrs-tests/src/test/resources/microservices/jaxrs/schemaFirst.yaml
@@ -87,7 +87,8 @@ paths:
           in: body
           required: true
           x-raw-json: true
-          type: string
+          schema:
+            type: string
       responses:
         200:
           description: test RawJson String
diff --git a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/SwaggerUtils.java b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/SwaggerUtils.java
index 4b64283..83b608b 100644
--- a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/SwaggerUtils.java
+++ b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/SwaggerUtils.java
@@ -127,7 +127,6 @@ public final class SwaggerUtils {
 
       for (Parameter parameter : operation.getParameters()) {
         if (BodyParameter.class.isInstance(parameter) &&
-            !isRawJsonType(parameter) &&
             ((BodyParameter) parameter).getSchema() == null) {
           throw new ServiceCombException("swagger validator: body parameter schema is empty.");
         }