* Print an OpenAPI spec object as JavaScript object literal. The original value * is used if `$ref` is resolved. * @param {*} specObject - An OpenAPI spec object such as `Parameter` or `Operation`.
(specObject)
| 222 | * @param {*} specObject - An OpenAPI spec object such as `Parameter` or `Operation`. |
| 223 | */ |
| 224 | function printSpecObject(specObject) { |
| 225 | return json5.stringify( |
| 226 | specObject, |
| 227 | (key, value) => { |
| 228 | // Restore the original value from `x-$original-value` |
| 229 | if (value != null && value['x-$ref']) { |
| 230 | return json5.parse(value['x-$original-value']); |
| 231 | } |
| 232 | return value; |
| 233 | }, |
| 234 | 2, |
| 235 | ); |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * Restore the OpenAPI spec object to its original value |
no test coverage detected