首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Swagger生成器无法识别控制器

Swagger生成器无法识别控制器
EN

Stack Overflow用户
提问于 2016-07-11 03:55:21
回答 0查看 2.4K关注 0票数 2

我有这个yaml文件:

代码语言:javascript
复制
---
swagger: "2.0"
info:
  version: 0.1.0
  title: "My API"
host: localhost:3000
basePath: /api
schemes:
  - http
paths:
    /weather:
      get:
        x-swagger-router-controller: "weatherController"
        description: "Returns current weather in the specified city to the caller"
        operationId: getWeather
        parameters:
          - name: city
            in: query
            description: "The city you want weather for in the form city,state,country"
            required: true
            type: "string"

当我运行swagger-codegen-cli时,会生成/api/Default.js和/api/DefaultService.js,但没有生成/api/weatherController.js。

我也尝试过这个:

代码语言:javascript
复制
---
swagger: "2.0"
info:
  version: 0.1.0
  title: "My API"
host: localhost:3000
basePath: /api
schemes:
  - http
paths:
    /weather:
      x-swagger-router-controller: "weatherController"
      get:
        description: "Returns current weather in the specified city to the caller"
        operationId: getWeather
        parameters:
          - name: city
            in: query
            description: "The city you want weather for in the form city,state,country"
            required: true
            type: "string"

我使用以下命令运行生成器:

代码语言:javascript
复制
java -jar swagger-codegen-cli.jar generate -l nodejs-server -o output -i api.yaml

我该怎么做呢?

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38295951

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档