Map<String, dynamic> toJson() { return { 'type': type, 'properties': properties.map((k, v) => MapEntry(k, v.toJson())), 'required': required, }; }