fn validate(&self) -> result::Result<(), String> {
        match self.fields.as_object() {
            Some(fields_map) => {
                // Check that field `drive_id` exists and its type is String.
                PatchDrivePayload::check_field_is_string(fields_map, "drive_id")?;
                // Check that field `drive_id` exists and its type is String.
                PatchDrivePayload::check_field_is_string(fields_map, "path_on_host")?;

                // Check that there are no other fields in the object.
                if fields_map.len() > 2 {
                    return Err(
                        "Invalid PATCH payload. Only updates on path_on_host are allowed."
                            .to_string(),
                    );
                }
                Ok(())
            }
            _ => Err("Invalid json.".to_string()),
        }
    }
/// Validates that only path_on_host and drive_id are present in the payload.
Validates that only path_on_host and drive_id are present in the payload.
Validates that only path_on_host and drive_id are present in the payload .
fn validate(&self) -> result::Result<(), String> {
        match self.fields.as_object() {
            Some(fields_map) => {
                // Check that field `drive_id` exists and its type is String.
                PatchDrivePayload::check_field_is_string(fields_map, "drive_id")?;
                // Check that field `drive_id` exists and its type is String.
                PatchDrivePayload::check_field_is_string(fields_map, "path_on_host")?;
                // Check that there are no other fields in the object.
                if fields_map.len() > 2 {
                    return Err(
                        "Invalid PATCH payload. Only updates on path_on_host are allowed."
                            .to_string(),
                    );
                }
                Ok(())
            }
            _ => Err("Invalid json.".to_string()),
        }
    }
fn validate ( & self ) -> result :: Result < ( ) , String > { match self . fields . as_object ( ) { Some ( fields_map ) => { // Check that field `drive_id` exists and its type is String. PatchDrivePayload :: check_field_is_string ( fields_map , " " ) ? ; // Check that field `drive_id` exists and its type is String. PatchDrivePayload :: check_field_is_string ( fields_map , " " ) ? ; // Check that there are no other fields in the object. if fields_map . len ( ) > 2 { return Err ( " " . to_string ( ) , ) ; } Ok ( ( ) ) } _ => Err ( " " . to_string ( ) ) , } }
Validates that only path_on_host and drive_id are present in the payload.
Validates that only path_on_host and drive_id are present in the payload .
&self
&self