Use raw identifiers for fields named "type" to avoid conflicts with the Rust keyword. Fix field number indexing in tests.