You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@servicecomb.apache.org by "liubao (JIRA)" <ji...@apache.org> on 2017/12/21 04:59:00 UTC

[jira] [Created] (SCB-106) using @PostMapping and @RequestMapping(method=POST) given different interface definitions

liubao created SCB-106:
--------------------------

             Summary: using @PostMapping and @RequestMapping(method=POST) given different interface definitions
                 Key: SCB-106
                 URL: https://issues.apache.org/jira/browse/SCB-106
             Project: Apache ServiceComb
          Issue Type: Bug
            Reporter: liubao


@RestSchema(schemaId = "test")
public class ComplexService {
    @RequestMapping(path = "/", method = RequestMethod.POST)
    public ResponseEntity<String> custerInfo(@RequestBody CustomerInfoWrapper info, HttpServletRequest request) {
        ResponseEntity<String> result = ResponseEntity.ok(info.getData().getName());
        return result;
    }
}


given this schema:
basePath: "/ComplexService"
consumes:
- "application/json"
produces:
- "application/json"
paths:
  /:
    post:
      operationId: "custerInfo"
      parameters:
      - in: "body"
        name: "info"
        required: false
        schema:
          $ref: "#/definitions/CustomerInfoWrapper"
      responses:
        200:
          description: "response of 200"
          schema:
            type: "string"

but 
@RestSchema(schemaId = "test")
public class ComplexService {
    @PostMapping(path = "/")
    public ResponseEntity<String> custerInfo(@RequestBody CustomerInfoWrapper info, HttpServletRequest request) {
        ResponseEntity<String> result = ResponseEntity.ok(info.getData().getName());
        return result;
    }
}


given:
basePath: "/ComplexService"
consumes:
- "application/json"
produces:
- "application/json"
paths:
  /custerInfo:
    post:
      operationId: "custerInfo"
      parameters:
      - in: "body"
        name: "info"
        required: false
        schema:
          $ref: "#/definitions/CustomerInfoWrapper"
      responses:
        200:
          description: "response of 200"
          schema:
            $ref: "#/definitions/ResponseEntityString"
definitions:
  CustomerInfo:
    type: "object"
    properties:
      name:
        type: "string"
    x-java-class: "com.huawei.paas.cse.demo.springmvc.server.CustomerInfo"
  CustomerInfoWrapper:
    type: "object"
    properties:
      data:
        $ref: "#/definitions/CustomerInfo"
    x-java-class: "com.huawei.paas.cse.demo.springmvc.server.CustomerInfoWrapper"
  ResponseEntity:
    type: "object"
    properties:
      headers:
        type: "object"
        additionalProperties:
          type: "array"
          items:
            type: "string"
      body:
        type: "object"
      statusCode:
        type: "string"
        enum:
        - "CONTINUE"
        - "SWITCHING_PROTOCOLS"
        - "PROCESSING"
        - "CHECKPOINT"
        - "OK"
        - "CREATED"
        - "ACCEPTED"
        - "NON_AUTHORITATIVE_INFORMATION"
        - "NO_CONTENT"
        - "RESET_CONTENT"
        - "PARTIAL_CONTENT"
        - "MULTI_STATUS"
        - "ALREADY_REPORTED"
        - "IM_USED"
        - "MULTIPLE_CHOICES"
        - "MOVED_PERMANENTLY"
.... .... ignored



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)