MCPcopy Create free account
hub / github.com/loopbackio/loopback-next / printSpecObject

Function printSpecObject

packages/cli/generators/openapi/utils.js:224–236  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

222 * @param {*} specObject - An OpenAPI spec object such as `Parameter` or `Operation`.
223 */
224function 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

Callers 7

getDefaultFunction · 0.85
mapPrimitiveTypeFunction · 0.85
buildMethodSpecFunction · 0.85
buildControllerSpecsFunction · 0.85
escapePropertyNameFunction · 0.85
printJsonSchemaFunction · 0.85

Calls 1

parseMethod · 0.65

Tested by

no test coverage detected