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

event-protocol: Extract lib, executable npm package #151

Merged
merged 7 commits into from Mar 16, 2017

Conversation

aslakhellesoy
Copy link
Contributor

Summary

  • Extract a library so the validator can be used from other JavaScript programs.
  • Create a CLI so it can be used standalone after installing the npm package

Details

The lib is just a single function:

function validateEvent(event) {
  // throws an error if the event is invalid
}

Motivation and Context

Library: Some programs (such as cucumber-gui) may want to validate incoming events before they are processed.

CLI: Being able to use the validator as a CLI is easier when it can just be npm installed. This makes it easier for developers of event producers to test that they are producing valid events.

The CLI reads events from STDIN and writes them to STDOUT, which makes it possible to use it just like cat in between two programs (a producer and a consumer).

If the CLI fails to parse or validate an event, a detailed error message is written to STDERR in red and stops processing further events.

How Has This Been Tested?

As before - just run make. Change an event (or a schema) and run make again to see it fail.

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@aslakhellesoy aslakhellesoy merged commit 40a47f0 into master Mar 16, 2017
@aslakhellesoy aslakhellesoy deleted the event-protocol-lib branch July 12, 2018 21:13
@lock
Copy link

lock bot commented Jul 12, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant