fix: remove $$ref key from example if it exists (#4333)

* fix: remove $$ref key from example if it exists

* guard $$ref property access
This commit is contained in:
kyle
2018-03-15 16:40:04 -07:00
committed by GitHub
parent 6c5a370ef7
commit b0be261ef8

View File

@@ -29,6 +29,10 @@ export const sampleFromSchema = (schema, config={}) => {
let { type, example, properties, additionalProperties, items } = objectify(schema)
let { includeReadOnly, includeWriteOnly } = config
if(example && example.$$ref) {
delete example.$$ref
}
if(example !== undefined)
return example