削除の設計
メモを消す操作(Delete)を書き足します。
| メソッド | パス | 中身 |
|---|---|---|
DELETE |
/notes/{id} |
消す。本文の無い 204 を返す |
api/openapi.yaml を変更する
Section titled “api/openapi.yaml を変更する”162162 description: 入力が決まりに合わない163163 '404':164164 description: メモが無い165delete:166 summary: メモを消す167 parameters:168 - name: id169 in: path170 required: true171 schema:172 type: string173 format: uuid174 responses:175 '204':176 description: 消した177 '400':178 description: ID が UUID の形でない179 '404':180 description: メモが無い204 No Contentは本文の無い応答なので、contentを書きません
プレビューで確かめる
Section titled “プレビューで確かめる”VS Code で api/openapi.yaml を開き、エディタの右上のプレビューのボタンを押します。横に API のドキュメントの画面が出ます。 5 つの操作(GET /notes・POST /notes・GET・PUT・DELETE /notes/{id})がそろっていれば大丈夫です。
参考にした公式ドキュメント
Section titled “参考にした公式ドキュメント”この節は、次の公式ドキュメントをもとに書いています。
- OpenAPI Specification v3.0.3 … Responses Object