I'm experimenting with swagger in mock mode. Here is my definitions:
Book:
required:
- name
properties:
name:
type: string
author:
type: array
items:
$ref: "#/definitions/Person"
publisher:
$ref: "#/definitions/Person"
keywords:
type: array
items:
type: string
Person:
required:
- name
properties:
name:
type: string
Organization:
required:
- name
properties:
name:
type: string
My post request is like this:
/book:
x-swagger-router-controller: book
post:
description: Add book to book collection. Book model is based on
https://schema.org/Book
operationId: save
parameters:
- name: book
description: book properties
in: body
required: true
schema:
$ref: "#/definitions/Book"
responses:
"200":
description: Success
schema:
# a pointer to a definition
$ref: "#/definitions/RandomResponse"
# responses may fall through to errors
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
Now I face 2 problems that I can't solve. First publisher is Person or
Organization. I can't figure how to define this. Second although publisher
is not required, in mock It wants to enter his name (probably because
Person name is flagged as required)
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.