Getting the data
The SWAPI has a lot of great data. We need to collect it, and clean up some data-modeling issues (e.g., numbers described as strings, etc.) and validate that we have it all in the expected format.
tools/get_data.js collects all the data and fixes it to have a neater shape. It’s a collector & data-massager, thrown together to ensure everything is in a decent initial format. It was built through iterative trial-and-error, inspecting the generated data until it looked clean and well-organized. Cross-referenced string IDs were chosen instead of original int
fields, to make them more unique, across all of the types.
tools/gen_proto.js generates an initial proto for the data, so we don’t have to do it by hand. After this, the JSON data was validated against it’s proto definition in tools/validate.js. This script shouldn’t be used again, because after this point our team was using hand-tuned data & proto in the rest of the book. This highlights...