scjson Rust Crate
This directory contains the Rust implementation of scjson. It offers a command line tool and supporting library to convert between .scxml and .scjson files and to validate documents.
For details on how SCXML elements are inferred during conversion see INFERENCE.md.
Installation
You can also build from this repository:
&&
Source Code - Multi-Language Support
[https://github.com/SoftOboros/scjson/]
- csharp
- go
- java
- javascript / typescript
- lua
- python
- ruby
- rust
- swift
Command Line Usage
Known Issues
None at this time.
Operational conformance testing is performed via uber_test.py
|
Note: uber_test.py applies all scxml files in Zhornyak's ScxmlEditor-Tutorial which provides a robest set of scxml test vectors useful for standard compliance verification. This is the only file in the test suite which fails to verify round-trip.
Enums
Each enumeration represents a restricted string set used by SCXML. The values shown below mirror those defined in the SCJSON schema.
AssignTypeDatatypeProps– how the<assign>element manipulates the datamodel. Values:replacechildren,firstchild,lastchild,previoussibling,nextsibling,replace,delete,addattribute.BindingDatatypeProps– determines if datamodel variables are boundearlyorlateduring execution.BooleanDatatypeProps– boolean attribute valuestrueorfalse.ExmodeDatatypeProps– processor execution mode, eitherlaxorstrict.HistoryTypeDatatypeProps– type of<history>state:shallowordeep.TransitionTypeDatatypeProps– whether a<transition>isinternalorexternal.
Common Types
Several generated classes share generic helper fields:
other_attributes:Record<str, str>capturing additional XML attributes from foreign namespaces.other_element:list[object]allowing untyped child nodes from other namespaces to be preserved.content:list[object]used when elements permit mixed or wildcard content.
Document / Object Types
AssignPropsAssignArray– update a datamodel location with an expression or value.CancelPropsCancelArray– cancel a pending<send>operation.ContentPropsContentArray– inline payload used by<send>and<invoke>.DataPropsDataArray– represents a single datamodel variable.DatamodelPropsDatamodelArray– container for one or more<data>elements.DonedataPropsDonedataArray– payload returned when a<final>state is reached.ElseProps– fallback branch for<if>conditions.ElseifProps– conditional branch following an<if>.FinalPropsFinalArray– marks a terminal state in the machine.FinalizePropsFinalizeArray– executed after an<invoke>completes.ForeachPropsForeachArray– iterate over items within executable content.HistoryPropsHistoryArray– pseudostate remembering previous active children.IfPropsIfArray– conditional execution block.InitialPropsInitialArray– starting state within a compound state.InvokePropsInvokeArray– run an external process or machine.LogPropsLogArray– diagnostic output statement.OnentryPropsOnentryArray– actions performed when entering a state.OnexitPropsOnexitArray– actions performed when leaving a state.ParallelPropsParallelArray– coordinates concurrent regions.ParamPropsParamArray– parameter passed to<invoke>or<send>.RaisePropsRaiseArray– raise an internal event.ScriptPropsScriptArray– inline executable script.ScxmlProps– root element of an SCJSON document.SendPropsSendArray– dispatch an external event.StatePropsStateArray– basic state node.TransitionPropsTransitionArray– edge between states triggered by events.
Other Resources
github: [https://github.com/SoftOboros/scjson]
npm: [https://www.npmjs.com/package/scjson]
pypi: [https://pypi.org/project/scjson/]
dockerhub: [https://hub.docker.com/r/iraa/scjson] (Full development environment for all supported languages)
All source code in this directory is released under the BSD\u00A01-Clause license. See LICENSE and LEGAL.md for details.