无法解析配置的swagger-router处理程序

问题描述 投票:1回答:1

当我从我的Vuejs应用程序向我的a127 / apigee-127 Rest服务提交POST请求时,http响应为500:

{"message":"Cannot resolve the configured swagger-router handler: IAGController_post"}

似乎正在发生的是a127 Rest WebService在我的IAGController的名称中添加了“_post”,我无法弄清楚为什么?

Vuejs代码:

let path = 'http://localhost:10010/iag';       
this.$http.post(path, {body: {grantType: 'bar', apiKey: 'abc', apiSecret: 'defg'}, headers: {'Content-Type': 'application/json'}})
          .then(response => {
          return response.json();
        }).then(data => {
            console.log(data);
        });

RESTFul Web服务代码:

昂首阔步:

swagger: "2.0"
info:
  version: "0.0.1"
  title: Hello World App
host: localhost:10010
basePath: /
schemes:
 - http
 - https
produces:
  - application/json
x-a127-config: {}
x-a127-services: {}
paths:
  /iag:
    x-swagger-router-controller: IAGController
    x-a127-apply: {}
    post:
      consumes: [application/json]
      parameters:  
        - name: body
          in: body
          description: Request a secure token
          required: true
          schema:
            $ref: "#/definitions/IAGSecurityRequest"
      responses:
        "200":
          description: Success
          schema:
            # a pointer to a definition
            $ref: "#/definitions/tokenResponse"
        # responses may fall through to errors
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
definitions:
  IAGSecurityRequest:
    type: object
    properties:
      grantType:
        type: string
      apiKey:
        type: string
      apiSecret:
        type: string
ErrorResponse:
    type: string
  tokenResponse:
    type: object
    properties:
      access_token:
        type: string
      token_type:
        type: string
      expires_in:
        type: integer
node.js swagger-2.0 apigee
1个回答
0
投票

尝试这样做:Swagger generator doesn't recognize controller

也许你也可以用get....开始你的函数名

© www.soinside.com 2019 - 2024. All rights reserved.