Example (#4730)
* add tests for example feature * refactor ParameterRow value setter logic * aside: fix property access in sampleFromSchema * prioritize media type examples for OAS3 responses * use `example` in schema level example * refactor: move stringify to utils * prioritize media type examples in OAS3 request bodies * modify nightwatch config * fix parameter/response regressions * reorder and broaden default value sources * update lockfile
This commit is contained in:
@@ -760,3 +760,24 @@ export function deeplyStripKey(input, keyToStrip, predicate = () => true) {
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
export function stringify(thing) {
|
||||
if (typeof thing === "string") {
|
||||
return thing
|
||||
}
|
||||
|
||||
if (thing.toJS) {
|
||||
thing = thing.toJS()
|
||||
}
|
||||
|
||||
if (typeof thing === "object" && thing !== null) {
|
||||
try {
|
||||
return JSON.stringify(thing, null, 2)
|
||||
}
|
||||
catch (e) {
|
||||
return String(thing)
|
||||
}
|
||||
}
|
||||
|
||||
return thing.toString()
|
||||
}
|
||||
Reference in New Issue
Block a user