Skip to content

Commit

Permalink
Review comment updates
Browse files Browse the repository at this point in the history
  • Loading branch information
HaseenaSainul committed May 31, 2023
1 parent 72a6e81 commit f8eaa49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/macrofier/engine.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ function generateResult(result, json, templates, { name = '' } = {}) {

for (var i=0; i<content.length; i++) {
if (content[i].indexOf("${property}") >= 0) {
content[i] = Object.entries(result.properties).map(([title, property]) => insertSchemaMacros(content[i], title || name, property, json)).join('\n')
content[i] = Object.entries(result.properties).map(([title, property]) => insertSchemaMacros(content[i], title, property, json)).join('\n')
}
}

Expand All @@ -1241,9 +1241,9 @@ function generateResult(result, json, templates, { name = '' } = {}) {
}
// otherwise this was a schema with no title, and we'll just copy it here
else {
const sch = localizeDependencies(result, json)
const schema = localizeDependencies(result, json)
return getTemplate('/types/default', templates)
.replace(/\$\{type\}/, types.getSchemaShape(sch, json, { name: result.$ref.split("/").pop() }))
.replace(/\$\{type\}/, types.getSchemaShape(schema, json, { name: result.$ref.split("/").pop() }))
}
}
else {
Expand All @@ -1253,8 +1253,8 @@ function generateResult(result, json, templates, { name = '' } = {}) {

function insertSchemaMacros(template, title, schema, module) {
return template.replace(/\$\{property\}/g, title)
.replace(/\$\{type\}/g, types.getSchemaType(schema.schema ? schema.schema : schema, module, { name: title, destination: state.destination, section: state.section, code: false }))
.replace(/\$\{type.link\}/g, getLinkForSchema(schema.schema ? schema.schema : schema, module, { name: title }))
.replace(/\$\{type\}/g, types.getSchemaType(schema, module, { name: title, destination: state.destination, section: state.section, code: false }))
.replace(/\$\{type.link\}/g, getLinkForSchema(schema, module, { name: title }))
.replace(/\$\{description\}/g, schema.description || '')
.replace(/\$\{name\}/g, title || '')
}
Expand Down
1 change: 0 additions & 1 deletion src/macrofier/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ const macrofy = async (
delete outputFiles[file]
}
})

}

// Grab all schema groups w/ a URI string. These came from some external json-schema that was bundled into the OpenRPC
Expand Down

0 comments on commit f8eaa49

Please sign in to comment.