diff --git a/.all-contributorsrc b/.all-contributorsrc
index a5d1f24000..b3a3faae03 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -646,6 +646,44 @@
"infra",
"code"
]
+ },
+ {
+ "login": "aryanas159",
+ "name": "Aryan Singh",
+ "avatar_url": "https://avatars.githubusercontent.com/u/114330931?v=4",
+ "profile": "https://github.com/aryanas159",
+ "contributions": [
+ "code"
+ ]
+ },
+ {
+ "login": "markuspoerschke",
+ "name": "Markus Poerschke",
+ "avatar_url": "https://avatars.githubusercontent.com/u/1222377?v=4",
+ "profile": "http://markus.poerschke.nrw",
+ "contributions": [
+ "code",
+ "test"
+ ]
+ },
+ {
+ "login": "jamesmoey",
+ "name": "James Moey",
+ "avatar_url": "https://avatars.githubusercontent.com/u/457472?v=4",
+ "profile": "https://github.com/jamesmoey",
+ "contributions": [
+ "code",
+ "test"
+ ]
+ },
+ {
+ "login": "tomwolanski",
+ "name": "tomwolanski",
+ "avatar_url": "https://avatars.githubusercontent.com/u/68085653?v=4",
+ "profile": "https://github.com/tomwolanski",
+ "contributions": [
+ "bug"
+ ]
}
],
"contributorsPerLine": 7,
diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml
index f4955c2216..d4ba4a44c4 100644
--- a/.github/workflows/help-command.yml
+++ b/.github/workflows/help-command.yml
@@ -27,13 +27,13 @@ jobs:
repo: context.repo.repo,
body: `Hello, @${{ github.actor }}! ππΌ
- I'm Genie from the magic lamp. Looks like somebody needs a hand! π
+ I'm π§π§π§ Genie π§π§π§ from the magic lamp. Looks like somebody needs a hand!
At the moment the following comments are supported in pull requests:
- - `/ready-to-merge` or `/rtm` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
- - `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
- - `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.`
+ - \`/ready-to-merge\` or \`/rtm\` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
+ - \`/do-not-merge\` or \`/dnm\` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
+ - \`/autoupdate\` or \`/au\` - This comment will add \`autoupdate\` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.`
})
create_help_comment_issue:
@@ -51,10 +51,10 @@ jobs:
repo: context.repo.repo,
body: `Hello, @${{ github.actor }}! ππΌ
- I'm Genie from the magic lamp. Looks like somebody needs a hand! π
+ I'm π§π§π§ Genie π§π§π§ from the magic lamp. Looks like somebody needs a hand!
At the moment the following comments are supported in issues:
- - `/good-first-issue {js | ts | java | go | docs | design | ci-cd} ` or `/gfi {js | ts | java | go | docs | design | ci-cd} ` - label an issue as a `good first issue`.
- example: `/gfi js` or `/good-first-issue ci-cd`
- })
+ - \`/good-first-issue {js | ts | java | go | docs | design | ci-cd}\` or \`/gfi {js | ts | java | go | docs | design | ci-cd}\` - label an issue as a \`good first issue\`.
+ example: \`/gfi js\` or \`/good-first-issue ci-cd\``
+ })
\ No newline at end of file
diff --git a/.github/workflows/runtime-cplusplus-testing.yml b/.github/workflows/runtime-cplusplus-testing.yml
new file mode 100644
index 0000000000..a65225d7a9
--- /dev/null
+++ b/.github/workflows/runtime-cplusplus-testing.yml
@@ -0,0 +1,32 @@
+name: Runtime testing C++ models
+on:
+ push:
+ pull_request:
+ types: [opened, reopened, synchronize, ready_for_review]
+ paths:
+ - 'src/generators/cplusplus/**'
+ - 'test/runtime/runtime-cplusplus/**'
+ - 'test/runtime/**cplusplus**'
+
+jobs:
+ test:
+ name: Runtime testing C++ Models
+ if: "github.event.pull_request.draft == false &&!((github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'ci: update global workflows')) || (github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'chore(release):')) || (github.actor == 'allcontributors' && startsWith(github.event.pull_request.title, 'docs: add')))"
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+ - name: Setup Node.js
+ uses: actions/setup-node@v1
+ with:
+ node-version: 14
+ - name: Build library
+ run: npm install && npm run build:prod
+ - name: Setup Cpp (C++ / C)
+ uses: aminya/setup-cpp@v0.28.0
+ - name: Generate C++ models
+ run: npm run generate:runtime:cplusplus
+ - name: Clone git submodules
+ run: git submodule update --init --recursive
+ - name: Run runtime tests
+ run: npm run test:runtime:cplusplus
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000..745534ccf6
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "test/runtime/runtime-cplusplus/src/utils/doctest"]
+ path = test/runtime/runtime-cplusplus/src/utils/doctest
+ url = https://github.com/doctest/doctest
diff --git a/README.md b/README.md
index 692f68c8e9..bb7ad754f7 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
[![Discussions](https://img.shields.io/github/discussions/asyncapi/modelina)](https://github.com/asyncapi/modelina/discussions)
[![Website](https://img.shields.io/website?label=website&url=https%3A%2F%2Fwww.modelina.org)](https://www.modelina.org)
[![Playground](https://img.shields.io/website?label=playground&url=https%3A%2F%2Fwww.modelina.org%2Fplayground)](https://www.modelina.org/playground)
-[![All Contributors](https://img.shields.io/badge/all_contributors-58-orange.svg?style=flat-square)](#contributors-)
+[![All Contributors](https://img.shields.io/badge/all_contributors-62-orange.svg?style=flat-square)](#contributors-)
Your one-stop tool for generating accurate and well-tested models for representing the message payloads. Use it as a tool in your development workflow, or a library in a larger integrations, entirely in your control.
@@ -400,6 +400,10 @@ Thanks go out to these wonderful people ([emoji key](https://allcontributors.org
Jean-FranΓ§ois CΓ΄tΓ© π» β οΈ π‘ π
Sumant.xD β οΈ π π»
+ Aryan Singh π»
+ Markus Poerschke π» β οΈ
+ James Moey π» β οΈ
+ tomwolanski π
diff --git a/examples/csharp-generate-json-serializer/__snapshots__/index.spec.ts.snap b/examples/csharp-generate-json-serializer/__snapshots__/index.spec.ts.snap
index 58ebd8556e..769f960b4c 100644
--- a/examples/csharp-generate-json-serializer/__snapshots__/index.spec.ts.snap
+++ b/examples/csharp-generate-json-serializer/__snapshots__/index.spec.ts.snap
@@ -47,7 +47,7 @@ internal class RootConverter : JsonConverter
if (propertyName == \\"email\\")
{
var value = JsonSerializer.Deserialize(ref reader, options);
- instance.email = value;
+ instance.Email = value;
continue;
}
}
@@ -65,10 +65,10 @@ internal class RootConverter : JsonConverter
writer.WriteStartObject();
- if(value.email != null) {
+ if(value.Email != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"email\\");
- JsonSerializer.Serialize(writer, value.email, options);
+ JsonSerializer.Serialize(writer, value.Email, options);
}
diff --git a/examples/integrate-with-react/package-lock.json b/examples/integrate-with-react/package-lock.json
index d9681a5f12..d7a9e82511 100644
--- a/examples/integrate-with-react/package-lock.json
+++ b/examples/integrate-with-react/package-lock.json
@@ -97,9 +97,9 @@
}
},
"node_modules/@babel/core/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -150,9 +150,9 @@
}
},
"node_modules/@babel/eslint-parser/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -224,9 +224,9 @@
}
},
"node_modules/@babel/helper-compilation-targets/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -283,9 +283,9 @@
}
},
"node_modules/@babel/helper-define-polyfill-provider/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -1610,9 +1610,9 @@
}
},
"node_modules/@babel/plugin-transform-runtime/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -1822,9 +1822,9 @@
}
},
"node_modules/@babel/preset-env/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -4559,9 +4559,9 @@
}
},
"node_modules/babel-plugin-polyfill-corejs2/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -6677,9 +6677,9 @@
}
},
"node_modules/eslint-plugin-jsx-a11y/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -6750,9 +6750,9 @@
}
},
"node_modules/eslint-plugin-react/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -8760,9 +8760,9 @@
}
},
"node_modules/istanbul-lib-instrument/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -10640,9 +10640,9 @@
}
},
"node_modules/make-dir/node_modules/semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"bin": {
"semver": "bin/semver.js"
}
@@ -13762,9 +13762,9 @@
}
},
"node_modules/semver": {
- "version": "7.3.7",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
- "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
+ "version": "7.5.4",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
+ "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dependencies": {
"lru-cache": "^6.0.0"
},
@@ -15845,9 +15845,9 @@
},
"dependencies": {
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -15881,9 +15881,9 @@
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="
},
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -15938,9 +15938,9 @@
},
"dependencies": {
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -15981,9 +15981,9 @@
},
"dependencies": {
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -16841,9 +16841,9 @@
},
"dependencies": {
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -16998,9 +16998,9 @@
},
"dependencies": {
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -18965,9 +18965,9 @@
},
"dependencies": {
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -20605,9 +20605,9 @@
}
},
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -20651,9 +20651,9 @@
}
},
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -22014,9 +22014,9 @@
},
"dependencies": {
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -23433,9 +23433,9 @@
},
"dependencies": {
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="
}
}
},
@@ -25497,9 +25497,9 @@
}
},
"semver": {
- "version": "7.3.7",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
- "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
+ "version": "7.5.4",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
+ "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"requires": {
"lru-cache": "^6.0.0"
}
diff --git a/modelina-website/scripts/build-examples.js b/modelina-website/scripts/build-examples.js
index e3fc4cb289..aeed365859 100644
--- a/modelina-website/scripts/build-examples.js
+++ b/modelina-website/scripts/build-examples.js
@@ -1,6 +1,12 @@
const path = require('path');
const {readdir, readFile, writeFile, mkdir, } = require('fs/promises');
+const refactorExampleName = (name) => {
+ const [first, ...rest] = name.split('-');
+ return first.charAt(0).toUpperCase() + first.slice(1) + " " + rest.join(" ")
+
+}
+
const getDirectories = async source =>
(await readdir(source, { withFileTypes: true }))
.filter(dirent => dirent.isDirectory())
@@ -88,7 +94,7 @@ async function start() {
const language = getLanguage(example);
templateConfig[example] = {
description: description,
- displayName: example,
+ displayName: refactorExampleName(example),
code,
output,
language
diff --git a/modelina-website/src/components/layouts/MobileNavMenu.tsx b/modelina-website/src/components/layouts/MobileNavMenu.tsx
index 8a5fe4786f..de222d1a98 100644
--- a/modelina-website/src/components/layouts/MobileNavMenu.tsx
+++ b/modelina-website/src/components/layouts/MobileNavMenu.tsx
@@ -44,6 +44,11 @@ export default function MobileNavMenu({ onClickClose = () => { } }) {
Playground
+
+
+
diff --git a/package-lock.json b/package-lock.json
index dab77899dc..ad715ea310 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,9 +12,9 @@
"@apidevtools/json-schema-ref-parser": "^9.0.9",
"@apidevtools/swagger-parser": "^10.0.3",
"@asyncapi/avro-schema-parser": "^3.0.2",
- "@asyncapi/openapi-schema-parser": "^3.0.2",
- "@asyncapi/parser": "^2.0.3",
- "@asyncapi/raml-dt-schema-parser": "^4.0.2",
+ "@asyncapi/openapi-schema-parser": "^3.0.4",
+ "@asyncapi/parser": "^2.1.0",
+ "@asyncapi/raml-dt-schema-parser": "^4.0.4",
"@swc/core": "^1.3.5",
"@swc/jest": "^0.2.23",
"@types/node": "^20.3.3",
@@ -116,10 +116,11 @@
}
},
"node_modules/@asyncapi/openapi-schema-parser": {
- "version": "3.0.3",
- "license": "Apache-2.0",
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-3.0.4.tgz",
+ "integrity": "sha512-nfZbL3dTpIQ3K+/V05FBpgOPi7dDWZkqZG8e7pKwtNhwZ0YLBFWTw6RpocztlBlcieFggxZqLm4BT5I1cQbK+Q==",
"dependencies": {
- "@asyncapi/parser": "^2.0.3",
+ "@asyncapi/parser": "^2.1.0",
"@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0",
"ajv": "^8.11.0",
"ajv-errors": "^3.0.0",
@@ -127,9 +128,9 @@
}
},
"node_modules/@asyncapi/parser": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.0.3.tgz",
- "integrity": "sha512-2gtIQOaCz8sR70JFREpg6UwgUBboC/26JcAGySkXY/f1ayjcfDoNLi4LsDvmu6G21qLrGN2lI83i8iLG1AzTAw==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.1.0.tgz",
+ "integrity": "sha512-78jjN3eW4ZmgJEa6Ap15lofzADCeItO4wHcAY2Jod3qLB1xf1zFDZQdtm3VSHYLeLhwoC1A33bAtzEf7M5P2bg==",
"dependencies": {
"@asyncapi/specs": "^5.1.0",
"@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0",
@@ -211,10 +212,11 @@
}
},
"node_modules/@asyncapi/raml-dt-schema-parser": {
- "version": "4.0.3",
- "license": "Apache-2.0",
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/@asyncapi/raml-dt-schema-parser/-/raml-dt-schema-parser-4.0.4.tgz",
+ "integrity": "sha512-kKam4jwYYdwqoV5zkEb3YEb8VOrN0785fc4ByazxRd+BT/RnkQTLspjTY/akdDs9DLmU4ChP73Z0vqpek6wojA==",
"dependencies": {
- "@asyncapi/parser": "^2.0.3",
+ "@asyncapi/parser": "^2.1.0",
"js-yaml": "^4.1.0",
"ramldt2jsonschema": "^1.2.3",
"webapi-parser": "^0.5.0"
@@ -10133,9 +10135,11 @@
}
},
"@asyncapi/openapi-schema-parser": {
- "version": "3.0.3",
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-3.0.4.tgz",
+ "integrity": "sha512-nfZbL3dTpIQ3K+/V05FBpgOPi7dDWZkqZG8e7pKwtNhwZ0YLBFWTw6RpocztlBlcieFggxZqLm4BT5I1cQbK+Q==",
"requires": {
- "@asyncapi/parser": "^2.0.3",
+ "@asyncapi/parser": "^2.1.0",
"@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0",
"ajv": "^8.11.0",
"ajv-errors": "^3.0.0",
@@ -10143,9 +10147,9 @@
}
},
"@asyncapi/parser": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.0.3.tgz",
- "integrity": "sha512-2gtIQOaCz8sR70JFREpg6UwgUBboC/26JcAGySkXY/f1ayjcfDoNLi4LsDvmu6G21qLrGN2lI83i8iLG1AzTAw==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.1.0.tgz",
+ "integrity": "sha512-78jjN3eW4ZmgJEa6Ap15lofzADCeItO4wHcAY2Jod3qLB1xf1zFDZQdtm3VSHYLeLhwoC1A33bAtzEf7M5P2bg==",
"requires": {
"@asyncapi/specs": "^5.1.0",
"@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0",
@@ -10216,9 +10220,11 @@
}
},
"@asyncapi/raml-dt-schema-parser": {
- "version": "4.0.3",
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/@asyncapi/raml-dt-schema-parser/-/raml-dt-schema-parser-4.0.4.tgz",
+ "integrity": "sha512-kKam4jwYYdwqoV5zkEb3YEb8VOrN0785fc4ByazxRd+BT/RnkQTLspjTY/akdDs9DLmU4ChP73Z0vqpek6wojA==",
"requires": {
- "@asyncapi/parser": "^2.0.3",
+ "@asyncapi/parser": "^2.1.0",
"js-yaml": "^4.1.0",
"ramldt2jsonschema": "^1.2.3",
"webapi-parser": "^0.5.0"
diff --git a/package.json b/package.json
index 87baa675cd..2beacf2b4b 100644
--- a/package.json
+++ b/package.json
@@ -38,9 +38,9 @@
"@apidevtools/json-schema-ref-parser": "^9.0.9",
"@apidevtools/swagger-parser": "^10.0.3",
"@asyncapi/avro-schema-parser": "^3.0.2",
- "@asyncapi/openapi-schema-parser": "^3.0.2",
- "@asyncapi/parser": "^2.0.3",
- "@asyncapi/raml-dt-schema-parser": "^4.0.2",
+ "@asyncapi/openapi-schema-parser": "^3.0.4",
+ "@asyncapi/parser": "^2.1.0",
+ "@asyncapi/raml-dt-schema-parser": "^4.0.4",
"@swc/core": "^1.3.5",
"@swc/jest": "^0.2.23",
"@types/node": "^20.3.3",
@@ -100,6 +100,8 @@
"test:blackbox:java": "cross-env CI=true jest ./test/blackbox/blackbox-java.spec.ts",
"test:runtime:java": "cross-env CI=true jest ./test/runtime/runtime-java.spec.ts",
"generate:runtime:java": "cross-env CI=true ts-node ./test/runtime/runtime-java.ts",
+ "test:runtime:cplusplus": "cross-env CI=true jest ./test/runtime/runtime-cplusplus.spec.ts",
+ "generate:runtime:cplusplus": "cross-env CI=true ts-node ./test/runtime/runtime-cplusplus.ts",
"test:runtime:kotlin": "cross-env CI=true jest ./test/runtime/runtime-kotlin.spec.ts",
"generate:runtime:kotlin": "cross-env CI=true ts-node ./test/runtime/runtime-kotlin.ts",
"test:runtime:rust": "cross-env CI=true jest ./test/runtime/runtime-rust.spec.ts",
diff --git a/src/generators/csharp/presets/JsonSerializerPreset.ts b/src/generators/csharp/presets/JsonSerializerPreset.ts
index 7c06befe72..578f9b3503 100644
--- a/src/generators/csharp/presets/JsonSerializerPreset.ts
+++ b/src/generators/csharp/presets/JsonSerializerPreset.ts
@@ -8,6 +8,7 @@ import {
ConstrainedReferenceModel
} from '../../../models';
import { CSharpOptions } from '../CSharpGenerator';
+import { pascalCase } from 'change-case';
function renderSerializeProperty(
modelInstanceVariable: string,
@@ -30,7 +31,7 @@ function renderSerializeProperties(model: ConstrainedObjectModel) {
for (const [propertyName, propertyModel] of Object.entries(
model.properties
)) {
- const modelInstanceVariable = `value.${propertyName}`;
+ const modelInstanceVariable = `value.${pascalCase(propertyName)}`;
if (
propertyModel.property instanceof ConstrainedDictionaryModel &&
propertyModel.property.serializationType === 'unwrap'
@@ -72,7 +73,7 @@ function renderPropertiesList(
);
})
.map((value) => {
- return value.propertyName;
+ return `prop.Name != "${pascalCase(value.propertyName)}"`;
});
let propertiesList = 'var properties = value.GetType().GetProperties();';
@@ -130,22 +131,23 @@ function renderDeserializeProperty(model: ConstrainedObjectPropertyModel) {
function renderDeserializeProperties(model: ConstrainedObjectModel) {
const propertyEntries = Object.entries(model.properties || {});
const deserializeProperties = propertyEntries.map(([prop, propModel]) => {
+ const pascalProp = pascalCase(prop);
//Unwrapped dictionary properties, need to be unwrapped in JSON
if (
propModel.property instanceof ConstrainedDictionaryModel &&
propModel.property.serializationType === 'unwrap'
) {
- return `if(instance.${prop} == null) { instance.${prop} = new Dictionary<${
+ return `if(instance.${pascalProp} == null) { instance.${pascalProp} = new Dictionary<${
propModel.property.key.type
- }, ${propModel.property.key.type}>(); }
+ }, ${propModel.property.value.type}>(); }
var deserializedValue = ${renderDeserializeProperty(propModel)};
- instance.${prop}.Add(propertyName, deserializedValue);
+ instance.${pascalProp}.Add(propertyName, deserializedValue);
continue;`;
}
return `if (propertyName == "${propModel.unconstrainedPropertyName}")
{
var value = ${renderDeserializeProperty(propModel)};
- instance.${prop} = value;
+ instance.${pascalProp} = value;
continue;
}`;
});
diff --git a/src/generators/php/renderers/EnumRenderer.ts b/src/generators/php/renderers/EnumRenderer.ts
index 46ddf614c2..09a477095e 100644
--- a/src/generators/php/renderers/EnumRenderer.ts
+++ b/src/generators/php/renderers/EnumRenderer.ts
@@ -13,7 +13,10 @@ import { PhpOptions } from '../PhpGenerator';
*/
export class EnumRenderer extends PhpRenderer {
async defaultSelf(): Promise {
- const content = [await this.renderItems()];
+ const content = [
+ await this.renderItems(),
+ await this.runAdditionalContentPreset()
+ ];
return `enum ${this.model.name}
{
${this.indent(this.renderBlock(content, 2))}
diff --git a/test/generators/csharp/presets/__snapshots__/JsonSerializerPreset.spec.ts.snap b/test/generators/csharp/presets/__snapshots__/JsonSerializerPreset.spec.ts.snap
index 460b551694..793fc7fed8 100644
--- a/test/generators/csharp/presets/__snapshots__/JsonSerializerPreset.spec.ts.snap
+++ b/test/generators/csharp/presets/__snapshots__/JsonSerializerPreset.spec.ts.snap
@@ -74,30 +74,30 @@ internal class TestConverter : JsonConverter
if (propertyName == \\"string prop\\")
{
var value = JsonSerializer.Deserialize(ref reader, options);
- instance.stringProp = value;
+ instance.StringProp = value;
continue;
}
if (propertyName == \\"numberProp\\")
{
var value = JsonSerializer.Deserialize(ref reader, options);
- instance.numberProp = value;
+ instance.NumberProp = value;
continue;
}
if (propertyName == \\"enumProp\\")
{
var value = EnumTestExtension.ToEnumTest(JsonSerializer.Deserialize(ref reader, options));
- instance.enumProp = value;
+ instance.EnumProp = value;
continue;
}
if (propertyName == \\"objectProp\\")
{
var value = JsonSerializer.Deserialize(ref reader, options);
- instance.objectProp = value;
+ instance.ObjectProp = value;
continue;
}
- if(instance.additionalProperties == null) { instance.additionalProperties = new Dictionary(); }
+ if(instance.AdditionalProperties == null) { instance.AdditionalProperties = new Dictionary(); }
var deserializedValue = JsonSerializer.Deserialize?>(ref reader, options);
- instance.additionalProperties.Add(propertyName, deserializedValue);
+ instance.AdditionalProperties.Add(propertyName, deserializedValue);
continue;
}
@@ -110,33 +110,33 @@ internal class TestConverter : JsonConverter
JsonSerializer.Serialize(writer, null, options);
return;
}
- var properties = value.GetType().GetProperties().Where(prop => additionalProperties);
+ var properties = value.GetType().GetProperties().Where(prop => prop.Name != \\"AdditionalProperties\\");
writer.WriteStartObject();
- if(value.stringProp != null) {
+ if(value.StringProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"string prop\\");
- JsonSerializer.Serialize(writer, value.stringProp, options);
+ JsonSerializer.Serialize(writer, value.StringProp, options);
}
- if(value.numberProp != null) {
+ if(value.NumberProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"numberProp\\");
- JsonSerializer.Serialize(writer, value.numberProp, options);
+ JsonSerializer.Serialize(writer, value.NumberProp, options);
}
- if(value.enumProp != null) {
+ if(value.EnumProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"enumProp\\");
JsonSerializer.Serialize(writer, EnumTest?.GetValue(), options);
}
- if(value.objectProp != null) {
+ if(value.ObjectProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"objectProp\\");
- JsonSerializer.Serialize(writer, value.objectProp, options);
+ JsonSerializer.Serialize(writer, value.ObjectProp, options);
}
// Unwrap dictionary properties
- if (value.additionalProperties != null) {
- foreach (var unwrappedProperty in value.additionalProperties)
+ if (value.AdditionalProperties != null) {
+ foreach (var unwrappedProperty in value.AdditionalProperties)
{
// Ignore any unwrapped properties which might already be part of the core properties
if (properties.Any(prop => prop.Name == unwrappedProperty.Key))
@@ -147,10 +147,10 @@ internal class TestConverter : JsonConverter
writer.WritePropertyName(unwrappedProperty.Key);
JsonSerializer.Serialize(writer, unwrappedProperty.Value, options);
}
- }if(value.additionalProperties != null) {
+ }if(value.AdditionalProperties != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"additionalProperties\\");
- JsonSerializer.Serialize(writer, value.additionalProperties, options);
+ JsonSerializer.Serialize(writer, value.AdditionalProperties, options);
}
@@ -252,12 +252,12 @@ internal class NestedTestConverter : JsonConverter
if (propertyName == \\"stringProp\\")
{
var value = JsonSerializer.Deserialize(ref reader, options);
- instance.stringProp = value;
+ instance.StringProp = value;
continue;
}
- if(instance.additionalProperties == null) { instance.additionalProperties = new Dictionary(); }
+ if(instance.AdditionalProperties == null) { instance.AdditionalProperties = new Dictionary(); }
var deserializedValue = JsonSerializer.Deserialize?>(ref reader, options);
- instance.additionalProperties.Add(propertyName, deserializedValue);
+ instance.AdditionalProperties.Add(propertyName, deserializedValue);
continue;
}
@@ -270,18 +270,18 @@ internal class NestedTestConverter : JsonConverter
JsonSerializer.Serialize(writer, null, options);
return;
}
- var properties = value.GetType().GetProperties().Where(prop => additionalProperties);
+ var properties = value.GetType().GetProperties().Where(prop => prop.Name != \\"AdditionalProperties\\");
writer.WriteStartObject();
- if(value.stringProp != null) {
+ if(value.StringProp != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"stringProp\\");
- JsonSerializer.Serialize(writer, value.stringProp, options);
+ JsonSerializer.Serialize(writer, value.StringProp, options);
}
// Unwrap dictionary properties
- if (value.additionalProperties != null) {
- foreach (var unwrappedProperty in value.additionalProperties)
+ if (value.AdditionalProperties != null) {
+ foreach (var unwrappedProperty in value.AdditionalProperties)
{
// Ignore any unwrapped properties which might already be part of the core properties
if (properties.Any(prop => prop.Name == unwrappedProperty.Key))
@@ -292,10 +292,10 @@ internal class NestedTestConverter : JsonConverter
writer.WritePropertyName(unwrappedProperty.Key);
JsonSerializer.Serialize(writer, unwrappedProperty.Value, options);
}
- }if(value.additionalProperties != null) {
+ }if(value.AdditionalProperties != null) {
// write property name and let the serializer serialize the value itself
writer.WritePropertyName(\\"additionalProperties\\");
- JsonSerializer.Serialize(writer, value.additionalProperties, options);
+ JsonSerializer.Serialize(writer, value.AdditionalProperties, options);
}
diff --git a/test/generators/php/PhpGenerator.spec.ts b/test/generators/php/PhpGenerator.spec.ts
index abb9cbdecf..f56d257739 100644
--- a/test/generators/php/PhpGenerator.spec.ts
+++ b/test/generators/php/PhpGenerator.spec.ts
@@ -50,6 +50,32 @@ describe('PhpGenerator', () => {
expect(models).toHaveLength(1);
expect(models[0].result).toMatchSnapshot();
});
+
+ test('should render `enum` with presets applied', async () => {
+ const doc = {
+ $id: 'Things',
+ enum: ['A', 'B', 'C']
+ };
+
+ generator = new PhpGenerator({
+ presets: [
+ {
+ enum: {
+ self({ content }) {
+ return `${content}// self content`;
+ },
+ additionalContent({ content }) {
+ return `${content}// additional content`;
+ }
+ }
+ }
+ ]
+ });
+
+ const models = await generator.generate(doc);
+ expect(models).toHaveLength(1);
+ expect(models[0].result).toMatchSnapshot();
+ });
});
describe('Class', () => {
test('should not render reserved keyword', async () => {
diff --git a/test/generators/php/__snapshots__/PhpGenerator.spec.ts.snap b/test/generators/php/__snapshots__/PhpGenerator.spec.ts.snap
index e455dee399..f4b876fa85 100644
--- a/test/generators/php/__snapshots__/PhpGenerator.spec.ts.snap
+++ b/test/generators/php/__snapshots__/PhpGenerator.spec.ts.snap
@@ -132,6 +132,18 @@ exports[`PhpGenerator Enum should render \`enum\` with mixed types (union type)
"
`;
+exports[`PhpGenerator Enum should render \`enum\` with presets applied 1`] = `
+"enum Things
+{
+ case A;
+ case B;
+ case C;
+
+ // additional content
+}
+// self content"
+`;
+
exports[`PhpGenerator Enum should render enums with translated special characters 1`] = `
"enum States
{
diff --git a/test/runtime/runtime-cplusplus.spec.ts b/test/runtime/runtime-cplusplus.spec.ts
new file mode 100644
index 0000000000..94fc413993
--- /dev/null
+++ b/test/runtime/runtime-cplusplus.spec.ts
@@ -0,0 +1,12 @@
+import { execCommand } from '../blackbox/utils/Utils';
+import path from 'path';
+
+jest.setTimeout(50000);
+
+test('C++ runtime testing', async () => {
+ const compileCommand = `cd ${path.resolve(
+ __dirname,
+ './runtime-cplusplus/src'
+ )} && c++ -std=c++17 -o AddressTest.out AddressTest.cpp && ./AddressTest.out`;
+ await execCommand(compileCommand);
+});
diff --git a/test/runtime/runtime-cplusplus.ts b/test/runtime/runtime-cplusplus.ts
new file mode 100644
index 0000000000..657a9bb9a9
--- /dev/null
+++ b/test/runtime/runtime-cplusplus.ts
@@ -0,0 +1,15 @@
+import { CplusplusFileGenerator } from '../../src';
+import path from 'path';
+import input from './generic-input.json';
+
+const generator = new CplusplusFileGenerator();
+
+generator.generateToFiles(
+ input,
+ path.resolve(
+ // eslint-disable-next-line no-undef
+ __dirname,
+ './runtime-cplusplus/src/lib/generated'
+ ),
+ { namespace: 'TestNamespace' }
+);
diff --git a/test/runtime/runtime-cplusplus/.gitignore b/test/runtime/runtime-cplusplus/.gitignore
new file mode 100644
index 0000000000..d99efa91a0
--- /dev/null
+++ b/test/runtime/runtime-cplusplus/.gitignore
@@ -0,0 +1,32 @@
+# Prerequisites
+*.d
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Fortran module files
+*.mod
+*.smod
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
\ No newline at end of file
diff --git a/test/runtime/runtime-cplusplus/README.md b/test/runtime/runtime-cplusplus/README.md
new file mode 100644
index 0000000000..417aa9f915
--- /dev/null
+++ b/test/runtime/runtime-cplusplus/README.md
@@ -0,0 +1,9 @@
+# Modelina C++ Runtime project
+
+This is the Modelina C++ runtime project that is used to test the Java-generated code from Modelina at runtime to ensure that everything works as expected.
+
+Here is how it works:
+
+- The models are first generated during the build phase of the project, by running the root npm script `npm run generate:runtime:cplusplus`. These models are pre-defined with the [generic input](../generic-input.json).
+- The tests are manually added and changed.
+- When the project is tested, it tests the generated models at runtime for semantic errors.
diff --git a/test/runtime/runtime-cplusplus/src/AddressTest.cpp b/test/runtime/runtime-cplusplus/src/AddressTest.cpp
new file mode 100644
index 0000000000..56b5406adb
--- /dev/null
+++ b/test/runtime/runtime-cplusplus/src/AddressTest.cpp
@@ -0,0 +1,27 @@
+
+#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+#include "utils/doctest/doctest/doctest.h"
+// #include "utils/nlohmann/json.hpp"
+
+#include
+#include
+
+#include "lib/generated/address.hpp"
+
+// using json = nlohmann::json;
+
+TEST_CASE("Should make an object of the generated class")
+{
+ AsyncapiModels::address address;
+ address.street_name = "Test address 2";
+ address.house_number = 2.0;
+ address.marriage = true;
+ address.members = 2.0;
+ std::vector> array_type;
+ array_type.push_back(2.0);
+ array_type.push_back(std::string("test"));
+ address.array_type = array_type;
+ AsyncapiModels::nested_object obj;
+ obj.test = "test";
+ address.nested_object = obj;
+}
diff --git a/test/runtime/runtime-cplusplus/src/utils/doctest b/test/runtime/runtime-cplusplus/src/utils/doctest
new file mode 160000
index 0000000000..ae7a13539f
--- /dev/null
+++ b/test/runtime/runtime-cplusplus/src/utils/doctest
@@ -0,0 +1 @@
+Subproject commit ae7a13539fb71f270b87eb2e874fbac80bc8dda2
diff --git a/test/runtime/runtime-typescript/package-lock.json b/test/runtime/runtime-typescript/package-lock.json
index da9d45aef0..89cffaa1e9 100644
--- a/test/runtime/runtime-typescript/package-lock.json
+++ b/test/runtime/runtime-typescript/package-lock.json
@@ -4181,9 +4181,9 @@
}
},
"node_modules/word-wrap": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
- "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz",
+ "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==",
"engines": {
"node": ">=0.10.0"
}