Created
August 26, 2015 11:38
-
-
Save johanhammar/c5f41542cbcb8ad727e4 to your computer and use it in GitHub Desktop.
Swagger nested arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: '2.0' | |
info: | |
version: "0.0.1" | |
title: Nested arrays | |
description: Demo of nested arrays | |
contact: | |
name: Johan Hammar | |
host: localhost | |
schemes: | |
- https | |
basePath: /v1 | |
produces: | |
- application/json | |
consumes: | |
- application/json | |
paths: | |
/demo: | |
get: | |
tags: | |
- Demo | |
summary: Nested arrays demo | |
description: | | |
responses: | |
200: | |
description: Nested array object | |
schema: | |
type: object | |
$ref: '#/definitions/nested' | |
definitions: | |
nested: | |
properties: | |
nested_array: | |
type: array | |
items: | |
properties: | |
first_value: | |
type: string | |
second_value: | |
type: string |
See example in OAI/OpenAPI-Specification#40
Let me check if it works is I split out the inner model.
This seems to work
swagger: '2.0'
info:
version: "0.0.1"
title: Nested arrays
description: Demo of nested arrays
contact:
name: Johan Hammar
host: localhost
schemes:
- https
basePath: /v1
produces:
- application/json
consumes:
- application/json
paths:
/demo:
get:
tags:
- Demo
summary: Nested arrays demo
description: |
responses:
200:
description: Nested array object
schema:
type: object
$ref: '#/definitions/nested'
definitions:
nested:
properties:
nested_array:
type: array
items:
$ref: '#/definitions/inner'
inner:
properties:
first_value:
type: string
second_value:
type: string
Do you still wan't me to open a bug regarding the first example?
Opened an issue Swagger2Markup/swagger2markup#33
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happens if you split the inner model into its own model definition and reference it from the outer array?