fix: stable enum entries

This commit is contained in:
Kasper Juul Hermansen 2023-03-14 22:01:01 +01:00
parent 6ef4bdf587
commit ec576264fc
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
2 changed files with 889 additions and 526 deletions

View File

@ -1,6 +1,7 @@
use dagger_core::introspection::FullType; use dagger_core::introspection::FullType;
use genco::prelude::rust; use genco::prelude::rust;
use genco::quote; use genco::quote;
use itertools::Itertools;
fn render_enum_values(values: &FullType) -> Option<rust::Tokens> { fn render_enum_values(values: &FullType) -> Option<rust::Tokens> {
let values = values let values = values
@ -10,6 +11,7 @@ fn render_enum_values(values: &FullType) -> Option<rust::Tokens> {
.map(|values| { .map(|values| {
values values
.into_iter() .into_iter()
.sorted_by_key(|a| &a.name)
.map(|val| quote! { $(val.name.as_ref()), }) .map(|val| quote! { $(val.name.as_ref()), })
}) })
.flatten() .flatten()

File diff suppressed because it is too large Load Diff