200 OK에 응답하고 HTML을 반환하는 API 호출이 있습니다. 나는 내 API 문서 에 이것을 추가하고 싶습니다 (특히 dredd를 사용하여 유효성을 검사하고 테스트 응답이 예상되는 본문을 제공하지 않는 한). 어떻게 나는 Swagger에서 이것을 할 것입니까?콘텐츠 유형의 응답 본문에 예제 값을 제공하는 방법 : Swagger에서 text/html (dredd를 사용하여 테스트)
은 --- API 호출에 대한 나의 응답은 200 OK과 한 줄 응답 바디와 함께 자세한 내용입니다 --- :
<html><body>You are being <a href="https://my.domain.com/users/sign_in">redirected</a>.</body></html>
내가 쉽게에서 청사진에 응답 바디를 정의 할 수 있습니다 다음 형식 :
+ Response 302 (text/html; charset=utf-8)
+ Body
`<html><body>You are being <a href="https://my.domain.com/users/sign_in">redirected</a>.</body></html>`
하지만 Swagger에서이 작업을 수행하는 방법을 잘 모르겠습니다. 거의 모든 예제는 내가 찾을 수있는 응용 프로그램/json 응답 (이해할 수있는) 및 나는 문제가 있습니다. 응답이 이런 종류의 올바른 구문을 추측하고 있습니다.
내 문서의 관련 자신감 텍스트이있다 (응답 본체 <html><body>You are being <a href="https://my.domain.com/users/sign_in">redirected</a>.</body></html>
을해야하기 때문에 빈 몸 을 저지 드레드와, 그래서 응답 본문을 지정하지 않고 지금까지 실패) :
# this is my API spec in YAML
swagger: '2.0'
info:
title: My API (Swagger)
description: blablabla
version: "1.0.0"
# the domain of the service
host: my.domain.com
# array of all schemes that your API supports
schemes:
- https
# will be prefixed to all paths
basePath:/
produces:
- application/json; charset=utf-8
paths:
/users/password:
post:
summary: Password Reset
description: |
Handles Reset password for existing user.
consumes:
- application/x-www-form-urlencoded
produces:
- text/html; charset=utf-8
parameters:
- name: "user[email]"
description: email
in: formData
required: true
type: string
default: "[email protected]"
tags:
- Reset Password
responses:
200:
description: Success
당신이 경우 의견을주십시오 이것에 대한 제안 사항이있다. 감사!