Ответ 1
Хорошо, благодаря входу от @ron я разработал решение. Да, мне нужно использовать body
вместо formData
, но даже тогда он не подтвердил, жалуясь на type: object
. Но если я сначала определю объект, а затем $ref
, тогда все это сработает. Следующий код выполняет проверку.
swagger: '2.0'
info:
version: '1'
title: Thingy Service
description: Everyone loves their thingy
schemes:
- http
consumes:
- application/json
produces:
- application/json
definitions:
localisation:
type: object
required:
- name
- locale
properties:
name:
type: string
locale:
type: string
paths:
'/thingies/{thingy_id}.json':
put:
summary: Update an existing thingy
description: Updates an existing thingy
parameters:
- name: thingy_id
description: ID of the thingy to update
in: path
required: true
type: integer
- name: translation
description: Name and Locale for new translation
in: body
schema:
$ref: '#/definitions/localisation'
responses:
204:
description: No data
404:
description: Thingy not found