From a470d6a2d94b4bf5fe8446501da9f0d4b039ae6b Mon Sep 17 00:00:00 2001 From: "Shah, Kevin" Date: Mon, 3 Jun 2024 12:44:37 -0400 Subject: [PATCH 1/8] chore: Added ability to send sdk version in install.sh --- languages/cpp/templates/sdk/scripts/install.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/languages/cpp/templates/sdk/scripts/install.sh b/languages/cpp/templates/sdk/scripts/install.sh index b31556a2..ce65895d 100755 --- a/languages/cpp/templates/sdk/scripts/install.sh +++ b/languages/cpp/templates/sdk/scripts/install.sh @@ -5,20 +5,23 @@ usage() echo " -i install path" echo " -s sdk path" echo " -m module name. i.e, core/manage" + echo " -v sdk version" echo echo "usage: " - echo " ./install.sh -i path -s sdk path -m core" + echo " ./install.sh -i path -s sdk path -m core -v 1.2.0-next.2" } SdkPath=".." InstallPath=".." ModuleName="core" -while getopts i:s:m:h flag +Version=0.0 +while getopts i:s:m:v:h flag do case "${flag}" in i) InstallPath="${OPTARG}";; s) SdkPath="${OPTARG}";; m) ModuleName="${OPTARG}";; + v) Version="${OPTARG}";; h) usage && exit 1;; esac done @@ -40,8 +43,8 @@ GetVersion() Version=${array[2]} } -Version=0.0 -GetVersion + +# GetVersion ReleaseName=firebolt-${ModuleName}-native-sdk-${Version} ReleasePath=${InstallPath}/${ReleaseName} From 741ae75a2d760d0da7d3e030935c84d75cff1e5f Mon Sep 17 00:00:00 2001 From: "Shah, Kevin" Date: Mon, 3 Jun 2024 13:59:54 -0400 Subject: [PATCH 2/8] chore: Added slash at the back of meta url --- src/validate/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validate/index.mjs b/src/validate/index.mjs index f9002554..0c6c1dfd 100644 --- a/src/validate/index.mjs +++ b/src/validate/index.mjs @@ -78,7 +78,7 @@ const run = async ({ removeIgnoredAdditionalItems(openRpcSpec) //AJV doesn't like not having a slash at the end of the URL - replaceUri('https://meta.json-schema.tools', 'https://meta.json-schema.tools/', openRpcSpec) + replaceUri('https://meta.json-schema.tools/', 'https://meta.json-schema.tools/', openRpcSpec) Object.values(sharedSchemas).forEach(schema => { From cabc683f000065864538e70f824fc3891dfe4022 Mon Sep 17 00:00:00 2001 From: "Shah, Kevin" Date: Mon, 3 Jun 2024 14:41:06 -0400 Subject: [PATCH 3/8] chore: Reverted slash at the back of meta url --- src/validate/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validate/index.mjs b/src/validate/index.mjs index 0c6c1dfd..f9002554 100644 --- a/src/validate/index.mjs +++ b/src/validate/index.mjs @@ -78,7 +78,7 @@ const run = async ({ removeIgnoredAdditionalItems(openRpcSpec) //AJV doesn't like not having a slash at the end of the URL - replaceUri('https://meta.json-schema.tools/', 'https://meta.json-schema.tools/', openRpcSpec) + replaceUri('https://meta.json-schema.tools', 'https://meta.json-schema.tools/', openRpcSpec) Object.values(sharedSchemas).forEach(schema => { From 41e50718a8d379b3ce5b3157690fe1bba85a55d4 Mon Sep 17 00:00:00 2001 From: "Shah, Kevin" Date: Sun, 23 Jun 2024 19:29:11 -0400 Subject: [PATCH 4/8] chore: test pr --- src/macrofier/types.mjs | 2 +- src/shared/json-schema.mjs | 19 +++++++++++++------ src/validate/index.mjs | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/macrofier/types.mjs b/src/macrofier/types.mjs index 55ef7b7e..aca481c7 100644 --- a/src/macrofier/types.mjs +++ b/src/macrofier/types.mjs @@ -227,7 +227,7 @@ const insertEnumMacros = (content, schema, module, name, suffix, templateDir = " if (!value) { value = getTemplate(path.join(templateDir, 'unset' + suffix)) } - value ? values.push(template[i].replace(/\$\{key\}/g, getSafeEnumKeyName(value)) + value ? values.push(template[i].replace(/\$\{key\}/g, getSafeEnumKeyName(value, schema.enumKeyPrefix)) .replace(/\$\{value\}/g, value)) : '' }) template[i] = values.map((value, id) => { diff --git a/src/shared/json-schema.mjs b/src/shared/json-schema.mjs index 5d1d3a27..b8c28fef 100644 --- a/src/shared/json-schema.mjs +++ b/src/shared/json-schema.mjs @@ -426,12 +426,19 @@ function mergeOneOf(schema) { return union(schema.oneOf) } -const getSafeEnumKeyName = (value) => value.split(':').pop() // use last portion of urn:style:values - .replace(/[\.\-]/g, '_') // replace dots and dashes - .replace(/\+/g, '_plus') // change + to _plus - .replace(/([a-z])([A-Z0-9])/g, '$1_$2') // camel -> snake case - .replace(/^([0-9]+(\.[0-9]+)?)/, 'v$1') // insert `v` in front of things that look like version numbers - .toUpperCase() +const getSafeEnumKeyName = function(value, keyPrefix = '') { + if (keyPrefix != '') { + value = keyPrefix + '_' + value + } + + let key = value.split(':').pop() // use last portion of urn:style:values + .replace(/\+/g, '_plus') // change + to _plus + .replace(/[\.\-\/\;]/g, '_') // replace special characters + .replace(/([a-z])([A-Z0-9])/g, '$1_$2') // camel -> snake case + .replace(/^([0-9]+\_([0-9]+)?)/, 'v$1') // insert `v` in front of things that look like version numbers + + return key.toUpperCase() +} export { getSchemaConstraints, diff --git a/src/validate/index.mjs b/src/validate/index.mjs index f9002554..94e127a2 100644 --- a/src/validate/index.mjs +++ b/src/validate/index.mjs @@ -108,7 +108,7 @@ const run = async ({ addFormats(ajv) // explicitly add our custom extensions so we can keep strict mode on (TODO: put these in a JSON config?) - ajv.addVocabulary(['x-method', 'x-this-param', 'x-additional-params', 'x-schemas', 'components', 'x-property']) + ajv.addVocabulary(['x-method', 'x-this-param', 'x-additional-params', 'x-schemas', 'components', 'x-property', 'enumKeyPrefix']) const firebolt = ajv.compile(fireboltOpenRpcSpec) const jsonschema = ajv.compile(jsonSchemaSpec) From 5d4205e58afbb9a221443a6b266a5bb39930627b Mon Sep 17 00:00:00 2001 From: "Shah, Kevin" Date: Sun, 23 Jun 2024 21:06:43 -0400 Subject: [PATCH 5/8] chore: test pr --- src/shared/json-schema.mjs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/shared/json-schema.mjs b/src/shared/json-schema.mjs index b8c28fef..34d92afb 100644 --- a/src/shared/json-schema.mjs +++ b/src/shared/json-schema.mjs @@ -426,19 +426,12 @@ function mergeOneOf(schema) { return union(schema.oneOf) } -const getSafeEnumKeyName = function(value, keyPrefix = '') { - if (keyPrefix != '') { - value = keyPrefix + '_' + value - } - - let key = value.split(':').pop() // use last portion of urn:style:values - .replace(/\+/g, '_plus') // change + to _plus - .replace(/[\.\-\/\;]/g, '_') // replace special characters - .replace(/([a-z])([A-Z0-9])/g, '$1_$2') // camel -> snake case - .replace(/^([0-9]+\_([0-9]+)?)/, 'v$1') // insert `v` in front of things that look like version numbers - - return key.toUpperCase() -} +const getSafeEnumKeyName = (value) => value.split(':').pop() // use last portion of urn:style:values + .replace(/[\.\-]/g, '_') // replace dots and dashes + .replace(/\+/g, '_plus') // change + to _plus + .replace(/([a-z])([A-Z0-9])/g, '$1_$2') // camel -> snake case + .replace(/^([0-9]+(\.[0-9]+)?)/, 'v$1') // insert `v` in front of things that look like version numbers + .toUpperCase() export { getSchemaConstraints, From 8b16ad59d86936e21a0a7ad64bd9cb6e674ffc8a Mon Sep 17 00:00:00 2001 From: "Shah, Kevin" Date: Mon, 24 Jun 2024 10:00:51 -0400 Subject: [PATCH 6/8] chore: test pr --- src/shared/json-schema.mjs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/shared/json-schema.mjs b/src/shared/json-schema.mjs index 34d92afb..b8c28fef 100644 --- a/src/shared/json-schema.mjs +++ b/src/shared/json-schema.mjs @@ -426,12 +426,19 @@ function mergeOneOf(schema) { return union(schema.oneOf) } -const getSafeEnumKeyName = (value) => value.split(':').pop() // use last portion of urn:style:values - .replace(/[\.\-]/g, '_') // replace dots and dashes - .replace(/\+/g, '_plus') // change + to _plus - .replace(/([a-z])([A-Z0-9])/g, '$1_$2') // camel -> snake case - .replace(/^([0-9]+(\.[0-9]+)?)/, 'v$1') // insert `v` in front of things that look like version numbers - .toUpperCase() +const getSafeEnumKeyName = function(value, keyPrefix = '') { + if (keyPrefix != '') { + value = keyPrefix + '_' + value + } + + let key = value.split(':').pop() // use last portion of urn:style:values + .replace(/\+/g, '_plus') // change + to _plus + .replace(/[\.\-\/\;]/g, '_') // replace special characters + .replace(/([a-z])([A-Z0-9])/g, '$1_$2') // camel -> snake case + .replace(/^([0-9]+\_([0-9]+)?)/, 'v$1') // insert `v` in front of things that look like version numbers + + return key.toUpperCase() +} export { getSchemaConstraints, From a63d9412c5de91552d2e41d95585eca7f13e24af Mon Sep 17 00:00:00 2001 From: "Shah, Kevin" Date: Thu, 27 Jun 2024 10:37:32 -0400 Subject: [PATCH 7/8] chore: CPP SDK issue fix --- .../callback-result-instantiation/sub-property/array.cpp | 2 +- languages/cpp/templates/sdk/scripts/install.sh | 2 +- src/macrofier/types.mjs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/languages/cpp/templates/callback-result-instantiation/sub-property/array.cpp b/languages/cpp/templates/callback-result-instantiation/sub-property/array.cpp index c9775b99..bb379cb8 100644 --- a/languages/cpp/templates/callback-result-instantiation/sub-property/array.cpp +++ b/languages/cpp/templates/callback-result-instantiation/sub-property/array.cpp @@ -6,5 +6,5 @@ } }${end.if.optional}${if.non.optional}auto index((*proxyResponse)${Property.dependency}.${Property}.Elements()); while (index.Next() == true) { -${if.object}${items.with.indent}${end.if.object}${if.non.object} ${base.title}${property.dependency}${if.impl.optional}.value()${end.if.impl.optional}.${property}.value().push_back(index.Current().Value());${end.if.non.object} +${if.object}${items.with.indent}${end.if.object}${if.non.object} ${base.title}${property.dependency}${if.impl.optional}.value()${end.if.impl.optional}.${property}.push_back(index.Current().Value());${end.if.non.object} }${end.if.non.optional} diff --git a/languages/cpp/templates/sdk/scripts/install.sh b/languages/cpp/templates/sdk/scripts/install.sh index ce65895d..0f944aa8 100755 --- a/languages/cpp/templates/sdk/scripts/install.sh +++ b/languages/cpp/templates/sdk/scripts/install.sh @@ -14,7 +14,7 @@ usage() SdkPath=".." InstallPath=".." ModuleName="core" -Version=0.0 +Version=1.3.0-next.1 while getopts i:s:m:v:h flag do case "${flag}" in diff --git a/src/macrofier/types.mjs b/src/macrofier/types.mjs index aca481c7..8c5e70ab 100644 --- a/src/macrofier/types.mjs +++ b/src/macrofier/types.mjs @@ -360,7 +360,7 @@ const insertObjectMacros = (content, schema, module, title, property, options) = .replace(/\$\{if\.base\.optional\}(.*?)\$\{end\.if\.base\.optional\}/gms, options.required ? '' : '$1') .replace(/\$\{if\.non\.object\}(.*?)\$\{end\.if\.non\.object\}/gms, isObject(localizedProp) ? '' : '$1') .replace(/\$\{if\.non\.array\}(.*?)\$\{end\.if\.non\.array\}/gms, (localizedProp.type === 'array') ? '' : '$1') - .replace(/\$\{if\.non\.anyOf\}(.*?)\$\{end\.if\.non\.anyOf\}/gms, (localizedProp.anyOf || localizedProp.anyOneOf) ? '' : '$1') + .replace(/\$\{if\.non\.anyOf\}(.*?)\$\{end\.if\.non\.anyOf\}/gms, (localizedProp.anyOf || localizedProp.anyOf) ? '' : '$1') .replace(/\$\{if\.non\.const\}(.*?)\$\{end\.if\.non\.const\}/gms, (typeof localizedProp.const === 'string') ? '' : '$1') let baseTitle = options.property From 126f2476b9429bccc9ce504b7fcb535aef151582 Mon Sep 17 00:00:00 2001 From: "Shah, Kevin" Date: Thu, 27 Jun 2024 12:09:31 -0400 Subject: [PATCH 8/8] chore: CPP SDK issue fix --- languages/cpp/templates/callback-initialization/tuple.cpp | 1 + src/macrofier/types.mjs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 languages/cpp/templates/callback-initialization/tuple.cpp diff --git a/languages/cpp/templates/callback-initialization/tuple.cpp b/languages/cpp/templates/callback-initialization/tuple.cpp new file mode 100644 index 00000000..5cc23aca --- /dev/null +++ b/languages/cpp/templates/callback-initialization/tuple.cpp @@ -0,0 +1 @@ +${if.namespace.notsame}${parent.Title}::${end.if.namespace.notsame}${title} ${property}; \ No newline at end of file diff --git a/src/macrofier/types.mjs b/src/macrofier/types.mjs index 8c5e70ab..79613862 100644 --- a/src/macrofier/types.mjs +++ b/src/macrofier/types.mjs @@ -360,7 +360,7 @@ const insertObjectMacros = (content, schema, module, title, property, options) = .replace(/\$\{if\.base\.optional\}(.*?)\$\{end\.if\.base\.optional\}/gms, options.required ? '' : '$1') .replace(/\$\{if\.non\.object\}(.*?)\$\{end\.if\.non\.object\}/gms, isObject(localizedProp) ? '' : '$1') .replace(/\$\{if\.non\.array\}(.*?)\$\{end\.if\.non\.array\}/gms, (localizedProp.type === 'array') ? '' : '$1') - .replace(/\$\{if\.non\.anyOf\}(.*?)\$\{end\.if\.non\.anyOf\}/gms, (localizedProp.anyOf || localizedProp.anyOf) ? '' : '$1') + .replace(/\$\{if\.non\.anyOf\}(.*?)\$\{end\.if\.non\.anyOf\}/gms, (localizedProp.anyOf || localizedProp.oneOf) ? '' : '$1') .replace(/\$\{if\.non\.const\}(.*?)\$\{end\.if\.non\.const\}/gms, (typeof localizedProp.const === 'string') ? '' : '$1') let baseTitle = options.property