question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add context to coerce and validation funcs?

See original GitHub issue

I’m producing some types for data that’s gonna get stored in dynamodb. It basically means having a handful of generated hash and sort keys, that are constructed from numerous concatenated properties on the object. (E.G. series|[seriesId]|book|[bookId]). So my coercion and validation funcs would benefit from having access to the complete object to compare the key to the properties it leverages.

Do you see an easy way to do this as is? Or is this a good feature request?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ianstormtaylorcommented, Dec 12, 2020

Added in 0.13.0!

1reaction
ianstormtaylorcommented, Nov 27, 2020

Absolutely!

I figured the mock idea was just experimentation, it’s an interesting concept too. I thought about it but the part I always get stuck on is that (a) the built-in mocks for data types like string/number will never be very accurate which leads to wanting to define built-ins for emails, urls, domains, uuids, etc., and (b) that it becomes harder to get the mock to stay accurate as extensions are made to structs. But if you end up figuring out a good way to do this I’d love to hear it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gin binding in Go: A tutorial with examples - LogRocket Blog
This tutorial covers Gin binding in Go, various built-in validators, custom binding using interfaces provided by the Gin library, and more.
Read more >
7. Validation Functions - CouchDB: The Definitive Guide [Book]
CouchDB sends functions and documents to a JavaScript interpreter. This mechanism is what allows us to write our document validation functions in JavaScript....
Read more >
Cool Things You Can Do With Pydantic | by Gideon Caller
Pydantic is a useful library for data parsing and validation. It coerces input types to the declared type (using type hints), ...
Read more >
Azure Functions HTTP trigger | Microsoft Learn
The HTTP trigger lets you invoke a function with an HTTP request. You can use an HTTP trigger to build serverless APIs and...
Read more >
The Data Validation Cookbook
We first load the package, and create a list of data quality demands with the validator() function. library(validate) rules ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found