Skip to content

Conversation

marcj
Copy link
Contributor

@marcj marcj commented Mar 31, 2020

…anged the benchmark to the validation method only for Marshal.

Benchmarking in Marshal validation + marshalling next to libraries that are only benchmarked with validation is not a correct benchmark.
The new ts-json-validator is able to do both as well, but only validation is benchmarked. Thus using only the validation method in Marshal is the only way to make a fair comparison.

marcj and others added 3 commits March 31, 2020 19:37
…anged the benchmark to the validation method only for Marshal.

Benchmarking in Marshal validation + marshalling next to libraries that are only benchmarked with validation is not a correct benchmark.
The new ts-json-validator is able to do both as well, but only validation is benchmarked. Thus using only the validation method in Marshal is the only way to make a fair comparison.
@moltar
Copy link
Owner

moltar commented Apr 1, 2020

@marcj I have released a change that breaks this PR.

Also please remove the changes in results/ dir. I know they were automatically generated. I now have changed the GitHub Action to only commit results if the action runs on this repo.

Sorry about that extra work. If you don't feel like doing it, please let me know and I'll just make these changes myself. Might be faster, but I also didn't want to throw away your work without your approval.

Thanks.

@marcj
Copy link
Contributor Author

marcj commented Apr 1, 2020

The actual change is very trivial so I'd appreciate if you could apply the same directly. We can then close this PR of course.

@moltar
Copy link
Owner

moltar commented Apr 2, 2020

@marcj Not sure if I am doing something wrong, but this doesn't seem to be doing any type guarding at all:

  validate() { // <-- return is still "any"
    const { data } = this;

    const errors = validator(data);

    if (errors.length === 0) {
      return data; // <-- this is still of "any" type
    }

    throw new Error('Invalid');
  }

@marcj
Copy link
Contributor Author

marcj commented May 21, 2020

Yes, because validation and type guarding are two different topics. I've added type guards in Marshal now and create a new PR.

@moltar
Copy link
Owner

moltar commented May 22, 2020

Yes, because validation and type guarding are two different topics.

That is true. But I only care about cases where both of those are working together. 😄

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