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:
@@ -29,6 +29,10 @@ export const sampleFromSchema = (schema, config={}) => {
|
|||||||
let { type, example, properties, additionalProperties, items } = objectify(schema)
|
let { type, example, properties, additionalProperties, items } = objectify(schema)
|
||||||
let { includeReadOnly, includeWriteOnly } = config
|
let { includeReadOnly, includeWriteOnly } = config
|
||||||
|
|
||||||
|
if(example && example.$$ref) {
|
||||||
|
delete example.$$ref
|
||||||
|
}
|
||||||
|
|
||||||
if(example !== undefined)
|
if(example !== undefined)
|
||||||
return example
|
return example
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user