stable order for property names in generated structs
This commit is contained in:
parent
c8027ac760
commit
f1d477390c
|
@ -345,7 +345,11 @@ enum TypeDetails {
|
||||||
Basic,
|
Basic,
|
||||||
Array(TypeId),
|
Array(TypeId),
|
||||||
Optional(TypeId),
|
Optional(TypeId),
|
||||||
Object(HashMap<String, TypeId>),
|
/*
|
||||||
|
* Object property names are sorted lexicographically to ensure a stable
|
||||||
|
* order in the generated code.
|
||||||
|
*/
|
||||||
|
Object(BTreeMap<String, TypeId>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -603,7 +607,7 @@ impl TypeSpace {
|
||||||
(None, None) => bail!("types need a name? {:?}", s),
|
(None, None) => bail!("types need a name? {:?}", s),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut omap = HashMap::new();
|
let mut omap = BTreeMap::new();
|
||||||
for (n, rb) in o.properties.iter() {
|
for (n, rb) in o.properties.iter() {
|
||||||
let itid = self.select_box(None, &rb)?;
|
let itid = self.select_box(None, &rb)?;
|
||||||
if o.required.contains(n) {
|
if o.required.contains(n) {
|
||||||
|
|
Loading…
Reference in New Issue