Created by: gferon
For a field described like:
matrixAttributes:
type: array
uniqueItems: true
items:
type: string
enum: ["travelTimes", "distances"]
default: ["travelTimes"]
the generated field in Rust would not be correct and was:
#[serde(rename = "matrixAttributes", skip_serializing_if = "Option::is_none")]
pub matrix_attributes: Option<MatrixAttributes>,
with this patch, it is now correctly wrapped in a collection, depending on whether uniqueItems
is set or not:
For a list:
#[serde(rename = "matrixAttributes", skip_serializing_if = "Option::is_none")]
pub matrix_attributes: Option<Vec<MatrixAttributes>>,
For a set:
#[serde(rename = "matrixAttributes", skip_serializing_if = "Option::is_none")]
pub matrix_attributes: Option<std::collections::HashSet<MatrixAttributes>>,
cc @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) for review