Open christoph-buente opened 8 years ago
Interesting idea! @chuwy, @fblundun, thoughts?
Yes, that makes sense and I like this idea. Property names often introduce more information than actual values. Do you think we need to provide any mappings by default, like with enum sets?
@christoph-buente I assume that by min
and max
you meant minimum
and maximum
properties. To make it simple I think we should just try to put content of mapping straight into Schema, so it also would be better to put a full enum
property rather than invented here enum-type
. We don't want users to learn one more domain-specific language.
Also, I assume that values still have a priority over mappings. If SG encounter an instance with name latitude
and value -100
I think mapping should be discarded. Do you agree?
Yes, i mean minimum and maximum. Changed it in the example. I also think it should be as simple as it can possibly be. I'm not sure how it would look like with a full enum. Like with currency with the full set available currencies? Or could it also be a regular expression?
And of course there should be at least a warning or an error, if the mapping doesn't match with the observed values. Or maybe even discarded.
@christoph-buente could you also elaborate on your example with EUR? Do you use --enum-sets all
option and it still not recognizes currency enum set or you omitted this option?
I just found out about the --enum-sets all
setting. And yes, it works.
Cool! Feel free to add your suggestions: https://github.com/snowplow/schema-guru/issues/120
In the process of generating the schema for shopify webhooks i came across a bunch of fields, that i know the format of, but the schema-guru fails to find out correctly. For example lat,lon coordinates, or currencies. My shop is in one currency only, so the guru will read it as string "EUR" instead of enum-set ISO 4217.
Is it feasable to ask for an option to provide a mapping JSON file like this:
And whenever a field is found with this name, it will directly jump to the given mapping. Does that make sense?