{swagger-express} 라이브러리를 사용하고 있으며 코드는 모두 CoffeeScript입니다. 나의 정의는, 내가 가진 :Express로 Swagger를 설정하는 방법은 무엇입니까?
###
* @swagger
* path: /login
* operations:
* - httpMethod: POST
* summary: Login with username and password
* notes: Returns a user based on username
* responseClass: User
* nickname: login
* consumes:
* - text/html
* parameters:
* - name: username
* description: Your username
* paramType: query
* required: true
* dataType: string
* - name: password
* description: Your password
* paramType: query
* required: true
* dataType: string
###
을하고 잘 작동 : routes
에서
app.use swagger.init app,
apis: ['./src/routes.coffee', './src/models.yml']
apiVersion: '0.1.0'
basePath: "http://localhost:#{port}"
info:
title: 'My API'
description: 'A complete listing of all API functions'
swaggerUI: path.join __dirname, 'public'
swaggerURL: '/swagger'
require('./src/routes') app
, 나는있다.
definitions:
User:
properties:
user_id:
type: string
description: Unique ID to represent the user
first_name:
type: string
description: First name of the Uber user.
last_name:
type: string
description: Last name of the Uber user.
email:
type: string
description: Email address of the Uber user
picture:
type: string
description: Image URL of the Uber user.
promo_code:
type: string
description: Promo code of the Uber user.
그러나 그것은 api-docs.json
에 표시되지 않습니다 내 model.yml
파일입니다. 한 파일에 models
을 정의하고 다른 파일에 paths
을 정의하려고합니다. 그게 끝날 수 있습니까?