-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(validation): validate concerto objects from dotnet using node #29
Conversation
It would be wonderful if you could describe the processes/architecture for a .NET application that is using this. For example, how does the data get serialised between .NET and Node? |
Added a brief description |
AccordProject.Concerto.Validate/concerto-validate/dist/validate.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, with one minor comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge once the build and DCO are fixed.
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Signed-off-by: Jamie Shorten <[email protected]>
Closes #5
Validate Concerto objects against a provided concerto models from .Net code using Javascript.NodeJS to run the core Concerto engine in NodeJS.
Changes
This works by wrapping the core Concerto engine with a TypeScript function that is then webpacked to Module that Node can execute. Javascript.NodeJS takes care of orchestrating the communication between the host .Net application and NodeJS.
How Javascript.NodeJS works
This package works by serialising any parameters using the built in dotnet JSON serialiser. It then calls a function in a NodeJS module with the supplied parameters. The module needs to contain functions that conform to a signature defined here.
The module can either be passed as a string or a file path. In the case of a file path the module is cached for as long as the NodeJS process is running. If the module is passed as a string then the client needs to specify a cache key manually if it needs the module to be cached.
The NodeJS processes spawned by Javascript.NodeJS are terminated when the
INodeJSService
is disposed.Returned objects are deserialised to a client provided type.
All communication with the NodeJS process happens over HTTP.
Finally this project does not handle creation of the
INodeJSService
instance. The client application should do this and use whatever DI system it uses to inject it into theAccordProject.Concerto.Validate.Validator
instance at construction time. This is to allow the client to configure any specific NodeJS settings it needs such as multiprocess concurrency.Flags
NodeJS needs to be present on the host system. There are two major alternatives to this approach:
Neither approach is suitable because Concerto requires enough functionality that is only present in either the browser or NodeJS that shimming or polyfilling the required types and functions is impractical.
Screenshots or Video
Author Checklist
--signoff
option of git commit.master
fromfork:branchname