         let name = key.path.joined(separator: "")
         let value: Value
         let type: String
-        (type, value) = self.typeAndValue(withName: name)
+        (type, value) = self.typeAndValue(withName: name, isOptional: true)
         specDict[name] = type
         return value
     }

}

private extension SpecDecoder {
    func typeAndValue<Value: DecodableType>(withName name: String) -> (String,Value) {
        if Value.self == String.self {
            return ("string", "" as! Value)
        }
        else if Value.self == Bool.self {
            return ("bool", true as! Value)
        }
        else if Value.self == Int.self {
            return ("int", Int(0) as! Value)
        }
        else if Value.self == Double.self {
            return ("double", Double(0) as! Value)
        }
        else if Value.self == Float.self {
            return ("float", Float(0) as! Value)

        }
        else if Value.self == Data.self {
            return ("data", Data() as! Value)
        }
        else if Value.self == Date.self {
            return ("date", Date() as! Value)
        }
        else {
            fatalError("Unknown raw value type")
        }
    }
}

        let name = key.path.joined(separator: "")
        let value: Value
        let type: String
        (type, value) = self.typeAndValue(withName: name, isOptional: false)
        specDict[name] = type
        return value
    }
