ckan / ckanext-scheming

Easy, shareable custom CKAN schemas
Other
86 stars 163 forks source link

Allow literal parameters in validator string #372

Closed smotornyuk closed 1 year ago

smotornyuk commented 1 year ago

Try parsing validator parameters using ast.literal_eval before naive splitting by commas.

  # old behavior, not changed if cannot parse valid literals
  validators: xxx(hello,world)       # xxx("hello", "world")

  # if any argument cannot be parsed, the old strategy is used
  validators: xxx(hello,1)           # xxx("hello", "1")

  # when all arguments are valid, pass them as python objects into the validator
  validators: xxx("hello",1,None)    # xxx("hello", 1, None)