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 better string validation

See original GitHub issue

Cases with JsonDecoder.string make the key required to be a string, but sometimes the string can be an empty one e.g. "". Another case, would be when the value can be any string other than certain values e.g. would fail on "STOP".

In my case I need to ensure empty strings for required keys fail. Is there a way to do that?

In my eyes I see 2 ways to solve this 1) an opt-in feature to fail on an empty string value in case of a required key, 2) add an optional exclude value array for strings e.g. { exclude: ["value1", "value2"] }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

0reactions
Rolandisimocommented, Sep 14, 2019

My bad. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Making string validation faster by not using a regular ...
Our common sense told us this would not be better, but the only way to find out is by trying. Candidate 2: using...
Read more >
Adding Number Validation to a String - java - Stack Overflow
It is a java implementation. This idea is very similar to android. For jave, instead of using ((EditText)findViewbyId(R.id.
Read more >
Versatile string validation - Code Review Stack Exchange
A string is valid if it satisfies the rules below: The string must be at least 6 characters long and not exceed 16...
Read more >
Active Record Validations - Ruby on Rails Guides
Active Record offers many pre-defined validation helpers that you can use directly inside your class definitions. These helpers provide common validation rules.
Read more >
validatorjs/validator.js: String validation - GitHub
If you're not sure if your input is a string, coerce it using input + '' . Passing anything other than a string...
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