pub(crate) fn de_answer<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::Answer>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
#[allow(unused_mut)]
let mut builder = crate::types::builders::AnswerBuilder::default();
loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
"QuestionId" => {
builder = builder.set_question_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"PillarId" => {
builder = builder.set_pillar_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"QuestionTitle" => {
builder = builder.set_question_title(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"QuestionDescription" => {
builder = builder.set_question_description(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"ImprovementPlanUrl" => {
builder = builder.set_improvement_plan_url(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"HelpfulResourceUrl" => {
builder = builder.set_helpful_resource_url(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"HelpfulResourceDisplayText" => {
builder = builder.set_helpful_resource_display_text(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Choices" => {
builder = builder.set_choices(crate::protocol_serde::shape_choices::de_choices(tokens)?);
}
"SelectedChoices" => {
builder = builder.set_selected_choices(crate::protocol_serde::shape_selected_choices::de_selected_choices(tokens)?);
}
"ChoiceAnswers" => {
builder = builder.set_choice_answers(crate::protocol_serde::shape_choice_answers::de_choice_answers(tokens)?);
}
"IsApplicable" => {
builder = builder.set_is_applicable(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"Risk" => {
builder = builder.set_risk(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::Risk::from(u.as_ref())))
.transpose()?,
);
}
"Notes" => {
builder = builder.set_notes(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Reason" => {
builder = builder.set_reason(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::AnswerReason::from(u.as_ref())))
.transpose()?,
);
}
"JiraConfiguration" => {
builder = builder.set_jira_configuration(crate::protocol_serde::shape_jira_configuration::de_jira_configuration(tokens)?);
}
_ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
},
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {:?}",
other
)))
}
}
}
Ok(Some(builder.build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}