Skip to content

Instantly share code, notes, and snippets.

@llaine
Created June 9, 2016 12:07
Show Gist options
  • Select an option

  • Save llaine/cf5522758a07f98da05bf4e842bf1526 to your computer and use it in GitHub Desktop.

Select an option

Save llaine/cf5522758a07f98da05bf4e842bf1526 to your computer and use it in GitHub Desktop.
[
{
"required":true,
"input_name":"address",
"input_type":"text_input",
"validations":{
"max":100,
"min":2
}
},
{
"required":true,
"input_name":"city",
"input_type":"text_input",
"validations":{
"max":100,
"min":2
}
}
]
@yannick
Copy link
Copy Markdown

yannick commented Jun 9, 2016

@llaine
looks like schema.
a bit a weird design. but interesting problem.
is the list of input_name types known and can they be modeled as separate structs?

otherwise its ok to just parse it as stringAbove.deserialize!InputField[]
and

struct InputField
 bool required;
 string input_name;
 string input_type;
 Validation validation; // or ulong[string]
}

struct Validation
{ int min; int max;}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment