Skip to content

Commit

Permalink
fix: More validiation
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacivita committed Jun 12, 2024
1 parent e52ef87 commit 7336ee4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/shared/modules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ const createNotifierFromProperty = (property, type='Changed') => {

if (subscriberType === 'global') {
notifier.examples = property.examples.map(example => ({
name: example.name,
params: [
{
name: "info",
Expand Down
13 changes: 7 additions & 6 deletions src/validate/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 7336ee4

Please sign in to comment.