Skip to content

Commit

Permalink
pagination for rippling
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Sep 20, 2024
1 parent 7fbf4d4 commit bc2733d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions openapitor/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2342,20 +2342,21 @@ impl PaginationProperties {
return Ok(k.to_string());
}

anyhow::bail!("No next page property found")
anyhow::bail!("No page param property found")
}
}

fn is_pagination_property_next_page(s: &str) -> bool {
["next_page", "next"].contains(&s)
["next_page", "next", "next_link"].contains(&s)
}

fn is_pagination_property_param_page(s: &str) -> bool {
["page_token", "page"].contains(&s)
["page_token", "page", "cursor"].contains(&s)
}

fn is_pagination_property_items(s: &str, t: &proc_macro2::TokenStream) -> Result<bool> {
Ok(["items", "data"].contains(&s) && get_text(t)?.starts_with("Vec<"))
Ok(["items", "data", "results"].contains(&s)
&& (get_text(t)?.starts_with("Vec<") || get_text(t)?.starts_with("Option<Vec<")))
}

pub(crate) fn get_schema_from_any(data: &SchemaData, any: &AnySchema) -> Option<Schema> {
Expand Down

0 comments on commit bc2733d

Please sign in to comment.