Skip to content

Commit

Permalink
CPPSDK: namespace settings changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HaseenaSainul committed Sep 29, 2023
1 parent fd66f37 commit f0c9dad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion languages/cpp/templates/types/namespace.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
${parent.Title}::
${if.namespace.notsame}${parent.Title}::${end.if.namespace.notsame}
10 changes: 5 additions & 5 deletions src/macrofier/types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function getMethodSignatureParams(method, module, { destination, callback }) {
const paramRequired = getTemplate('/parameters/default')
const paramOptional = getTemplate('/parameters/optional')
return method.params.map(param => {
let type = getSchemaType(param.schema, module, { destination })
let type = getSchemaType(param.schema, module, { destination, namespace : true })
if (callback && allocatedPrimitiveProxies[type]) {
type = allocatedPrimitiveProxies[type]
}
Expand Down Expand Up @@ -97,6 +97,7 @@ function insertSchemaMacros(content, schema, module, name, parent, property, rec
.replace(/\$\{TITLE\}/g, title.toUpperCase())
.replace(/\$\{property\}/g, property)
.replace(/\$\{Property\}/g, capitalize(property))
.replace(/\$\{if\.namespace\.notsame}(.*?)\$\{end\.if\.namespace\.notsame\}/g, (module.info.title !== parent) ? '$1' : '')
.replace(/\$\{parent\.title\}/g, parent)
.replace(/\$\{parent\.Title\}/g, capitalize(parent))
.replace(/\$\{description\}/g, schema.description ? schema.description : '')
Expand All @@ -106,10 +107,9 @@ function insertSchemaMacros(content, schema, module, name, parent, property, rec
.replace(/\$\{info.title\}/g, moduleTitle)
.replace(/\$\{info.Title\}/g, capitalize(moduleTitle))
.replace(/\$\{info.TITLE\}/g, moduleTitle.toUpperCase())
// .replace(/\$\{type.link\}/g, getLinkForSchema(schema, module, { name: title }))

if (recursive) {
content = content.replace(/\$\{type\}/g, getSchemaType(schema, module, { name: title, destination: state.destination, section: state.section, code: false }))
content = content.replace(/\$\{type\}/g, getSchemaType(schema, module, { name: title, destination: state.destination, section: state.section, code: false, namespace: true }))
}
return content
}
Expand Down Expand Up @@ -203,7 +203,7 @@ const insertObjectMacros = (content, schema, module, title, property, options) =
if (schema.additionalProperties && (typeof schema.additionalProperties === 'object')) {
type = schema.additionalProperties
}

if (schema.patternProperties) {
Object.entries(schema.patternProperties).forEach(([pattern, schema]) => {
let regex = new RegExp(pattern)
Expand Down Expand Up @@ -591,7 +591,7 @@ function getSchemaType(schema, module, { destination, templateDir = 'types', lin
if (schema.title) {
union.title = schema.title
}
return getSchemaType(union, module, { destination, link, title, code, asPath, baseUrl })
return getSchemaType(union, module, { destination, link, title, code, asPath, baseUrl, namespace })
}
else if (schema.oneOf || schema.anyOf) {
if (!schema.anyOf) {
Expand Down

0 comments on commit f0c9dad

Please sign in to comment.