Skip to content
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

Add SCXML and YAML Codecs #26

Merged
merged 6 commits into from
Aug 4, 2020
Merged

Add SCXML and YAML Codecs #26

merged 6 commits into from
Aug 4, 2020

Conversation

skbolton
Copy link
Contributor

@skbolton skbolton commented Aug 2, 2020

Sorry there is a lot here but I figured I would just get everything cleaned up and off my machine.

This adds the yaml and scxml parsers. I did decide to change the name to Codec because it grew on me. The Statifier.Schema API is not perfect as of right now but I think it is good enough to move on. Really only people writing Codecs will care about how to work with the Schema so its basically an internal detail that we can clean up over time. I also plan in the future to add more tests to all of this when I start doing more of the machine api.


defp process_event({:start_element, "statechart", statechart}, nil) do
extract_attributes(statechart, %{"name" => :name})
|> Map.merge(extract_attributes(Map.get(statechart, "root"), %{"initial" => :initial}))
Copy link
Contributor Author

@skbolton skbolton Aug 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should put better docs here. The top level of yaml is weird because we need keys from both statechart and root

@skbolton skbolton changed the title Add SCXML and YAML Codecs WIP - Add SCXML and YAML Codecs Aug 2, 2020
@skbolton
Copy link
Contributor Author

skbolton commented Aug 2, 2020

There are a few issues here that I want to fix. Don't merge this just yet.

@skbolton skbolton force-pushed the schema branch 4 times, most recently from 54544d8 to 04930ed Compare August 4, 2020 17:07
* create `Schema.Root`
* create `Schema.State`
* create `Schema.Transition`
This is the inital pass at the codec. Most state parsing is handled but
a few things will happen in later work:

* Datamodel handling
* History handling
This has feature parity with the SCXML parser as of this commit.

* Add YamlElixir library
* Create walker module to mimic behaviour of xml parser
We can use this function to test out our parsing of schemas and
transitions of the machines. This is not a long term function to have in
the api.
@skbolton skbolton changed the title WIP - Add SCXML and YAML Codecs Add SCXML and YAML Codecs Aug 4, 2020
impl/ex/lib/codec/codec.ex Outdated Show resolved Hide resolved
@johnnyt johnnyt merged commit 3d607a2 into master Aug 4, 2020
@johnnyt johnnyt deleted the schema branch August 4, 2020 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants