From 7336ee4386e7931de11eb709fad6fba7c0a01242 Mon Sep 17 00:00:00 2001 From: Jeremy LaCivita Date: Wed, 12 Jun 2024 13:34:13 -0400 Subject: [PATCH] fix: More validiation --- src/shared/modules.mjs | 1 + src/validate/index.mjs | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/shared/modules.mjs b/src/shared/modules.mjs index 1adf7316..aa22c404 100644 --- a/src/shared/modules.mjs +++ b/src/shared/modules.mjs @@ -502,6 +502,7 @@ const createNotifierFromProperty = (property, type='Changed') => { if (subscriberType === 'global') { notifier.examples = property.examples.map(example => ({ + name: example.name, params: [ { name: "info", diff --git a/src/validate/index.mjs b/src/validate/index.mjs index 542fe8c0..fd02fa9a 100644 --- a/src/validate/index.mjs +++ b/src/validate/index.mjs @@ -18,7 +18,7 @@ import { readJson, readFiles, readDir } from "../shared/filesystem.mjs" import { addExternalMarkdown, addExternalSchemas, fireboltize } from "../shared/modules.mjs" -import { removeIgnoredAdditionalItems, replaceUri } from "../shared/json-schema.mjs" +import { namespaceRefs, removeIgnoredAdditionalItems, replaceUri } from "../shared/json-schema.mjs" import { validate, displayError, validatePasshtroughs } from "./validator/index.mjs" import { logHeader, logSuccess, logError } from "../shared/io.mjs" @@ -188,6 +188,12 @@ const run = async ({ let json = JSON.parse(modules[key]) if (transformations) { + + // put module name in front of each method + json.methods.filter(method => method.name.indexOf('.') === -1).forEach(method => method.name = json.info.title + '.' + method.name) + json.components && json.components.schemas && (json.components.schemas = Object.fromEntries(Object.entries(json.components.schemas).map( ([key, schema]) => ([json.info.title + '.' + key, schema]) ))) + namespaceRefs('', json.info.title, json) + // Do the firebolt API magic json = fireboltize(json, bidirectional) @@ -276,11 +282,6 @@ const run = async ({ } }) - if (method.name === 'Device.distributor') { - console.dir(exampleSpec.oneOf, { depth: 100 }) - console.dir(method.examples) - } - const examples = ajv.compile(exampleSpec) try {