GenSON icon indicating copy to clipboard operation
GenSON copied to clipboard

how to add pattern for each field

Open kadisyy opened this issue 6 years ago • 3 comments

for some fields, i need add pattern in schema conf, and how to add pattern for each field?

thanks

kadisyy avatar Dec 05 '19 02:12 kadisyy

Are you talking about patternProperties where you specify a RegExp for the key, or do you want to add a pattern to match the value of a property?

wolverdude avatar Dec 06 '19 17:12 wolverdude

Oh this is an interesting one. What about a --infer-patterns optional argument that takes a list of json paths? It could construct a minimal DFA for those keys and convert it to a regexp or something like that.

DylanYoung avatar Feb 12 '20 19:02 DylanYoung

This sounds a bit over-complicated. If you implement it, I'll take a look, but beware of complicating the API. Favor seed schemas over configuration options.

wolverdude avatar Apr 11 '20 20:04 wolverdude