【发布时间】:2021-01-21 12:44:28
【问题描述】:
我正在尝试实现以下调用:
POST https://host/sessions
删除 https://host/sessions/{session_id}
POST 调用是建立会话,DELETE 调用是注销已建立的会话。
那么,在 YAML 文件中,如何有一个空的基本路径?它目前是 YAML 文件中的斜线,因为它是必需的文件,但斜线是多余的。任何想法?谢谢。
swagger: '2.0'
info:
version: '0.0.1'
title: authenticate
#description: To be provided
# #termsOfService:To be provided
contact:
name: test
basePath: /sessions
paths:
/:
post:
summary: eatablish a session
description: sessions is a collection.This POST creates a new session in the sessions collection and the name of the session returned by this command is the session token.
consumes:
- "application/json"
parameters:
- in: header
name: user_name
type: string
required: true
- in: header
name: password
type: string
required: true
responses:
200:
description: establish a session successfully
400:
$ref: "#/responses/BadRequest"
500:
description: unexpected error
schema:
$ref: '#/definitions/errorModel'
/{session_id}:
delete:
summary: log out
description: use sessionid to log out an established session.
produces:
- application/json
parameters:
- in: path
name: session_id
type: string
required: true
responses:
200:
description: log out a session successfully
400:
$ref: "#/responses/BadRequest"
500:
description: unexpected error
schema:
$ref: '#/definitions/errorModel'
【问题讨论】: