← Back to team overview

brewtarget-devs team mailing list archive

Re: Invalid beerXML handling


Hash: SHA512

On 11/01/2013 10:33 PM, mik firestone wrote:
> We have a problem with some invalid beerXML causing brewtarget to dump core. I'm working on the fix for that in three stages: fix the core dump, warn the user and figure out some kind of validation scheme[1].


> I'm seeing things like Yeast records not including the form (e.g., liquid or dry) and the laboratory (e.g. white labs). My current approach is to ignore the missing fields, import the record and warn the user that they need to double check these things.
> The problem is that this will make a mess out of our database. It also means we will be propagating bad information.
> Should I make some effort to correct the bad record? For example, search to see if we have a yeast named 'WLP001' and do the right thing? Still warn the user, but possibly reduce the work the user has to do.

I think it's enough to give the missing fields some default value, which should be set to whatever value is most common for homebrewers.

> Should I refuse to import an invalid recipe? That's going to be a lot harder, and I think I would prefer to be generous in what I accept and conservative with what I generate -- to paraphrase the EEs.

I think you're right to accept it anyway, and just warn the user that wherever they got the XML from is doing a bad job at following the spec.

> [1] I've already tried XSD, but the beerXML spec can't be validated by either DTD or XSD.

This sucks hard. However, do you think it's still valuable to have the XSD that you have already started?

> -- 
> In a world of ninja v. pirate, I pilot a Gundam

- -- 
Philip G. Lee
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/