swagger-parser
swagger-parser copied to clipboard
Question regarding example field for date format property
Hi, I've this Swagger file. Please take a look to the dateOfBirth example fields, both are '1978-06-21'. But after executing swagger-parser, output is an object and I don't know how obtain original value. Could you please help me with this? Thanks.
Swagger file:
info:
version: 0.0.1
title: Simple API
paths:
/persons:
get:
responses:
'200':
description: A list of Person
schema:
$ref: '#/definitions/Persons'
definitions:
Person:
title: Human
properties:
dateOfBirth:
type: string
format: date
example: 1978-06-21
lastTimeOnline:
type: string
format: date-time
readOnly: true
example: 2016-06-10T12:36:58.014Z
Persons:
properties:
items:
type: array
items:
$ref: '#/definitions/Person'
example:
- dateOfBirth: 1970-01-28
lastTimeOnline: 2016-04-10T14:36:58.014Z
Parser output:
"definitions": {
"Person": {
"properties": {
"dateOfBirth": {
"example": "1978-06-21T00:00:00.000Z",
"format": "date",
"type": "string"
},
"lastTimeOnline": {
"example": "2016-06-10T12:36:58.014Z",
"format": "date-time",
"readOnly": true,
"type": "string"
}
},
"title": "Human"
},
"Persons": {
"properties": {
"items": {
"example": [
{
"dateOfBirth": "1970-01-28T00:00:00.000Z",
"lastTimeOnline": "2016-04-10T14:36:58.014Z"
}
],
"items": {
"$ref": "#/definitions/Person"
},
"type": "array"
}
}
}
},
"info": {
"title": "Simple API",
"version": "0.0.1"
},
"paths": {
"/persons": {
"get": {
"responses": {
"200": {
"description": "A list of Person",
"schema": {
"$ref": "#/definitions/Persons"
}
}
}
}
}
},
"swagger": "2.0"
}