summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generator/src/main.rs4
-rw-r--r--generator/src/methods.rs1
-rw-r--r--generator/src/structs.rs3
-rw-r--r--src/generated/methods.rs3
-rw-r--r--src/generated/structs.rs19
5 files changed, 17 insertions, 13 deletions
diff --git a/generator/src/main.rs b/generator/src/main.rs
index 9a5abee..64173bf 100644
--- a/generator/src/main.rs
+++ b/generator/src/main.rs
@@ -105,7 +105,7 @@ fn schema_type_name(
// Checking for a space filters that out
(Some(title), _) if !title.contains(' ') => title.to_string(),
(_, Some(definition_name)) => definition_name.to_string(),
- (_, None) => "serde_json::Map<String, serde_json::Value>".to_string(),
+ (_, None) => "BTreeMap<String, serde_json::Value>".to_string(),
}
}
};
@@ -223,7 +223,7 @@ fn schema_subtype_name(
let additional = additional.deref(spec)?;
let mut additional_ty = crate::schema_type_name(spec, None, additional)?;
schema_subtype_name(spec, parent_name, name, additional, &mut additional_ty)?;
- *ty = format!("std::collections::BTreeMap<String, {additional_ty}>");
+ *ty = format!("BTreeMap<String, {additional_ty}>");
true
}
Schema {
diff --git a/generator/src/methods.rs b/generator/src/methods.rs
index c0f614c..6877437 100644
--- a/generator/src/methods.rs
+++ b/generator/src/methods.rs
@@ -6,6 +6,7 @@ use std::fmt::Write;
pub fn create_methods(spec: &OpenApiV2) -> eyre::Result<String> {
let mut s = String::new();
s.push_str("use crate::ForgejoError;\n");
+ s.push_str("use std::collections::BTreeMap;");
s.push_str("use super::structs::*;\n");
s.push_str("\n");
s.push_str("impl crate::Forgejo {\n");
diff --git a/generator/src/structs.rs b/generator/src/structs.rs
index 6f2e917..0b4de08 100644
--- a/generator/src/structs.rs
+++ b/generator/src/structs.rs
@@ -6,6 +6,7 @@ use std::fmt::Write;
pub fn create_structs(spec: &OpenApiV2) -> eyre::Result<String> {
let mut s = String::new();
s.push_str("use crate::StructureError;");
+ s.push_str("use std::collections::BTreeMap;");
if let Some(definitions) = &spec.definitions {
for (name, schema) in definitions {
let strukt = create_struct_for_definition(&spec, name, schema)?;
@@ -108,7 +109,7 @@ pub fn create_struct_for_definition(
if let Some(additonal_schema) = &schema.additional_properties {
let prop_ty = crate::schema_ref_type_name(spec, additonal_schema)?;
fields.push_str("#[serde(flatten)]\n");
- fields.push_str("pub additional: std::collections::BTreeMap<String, ");
+ fields.push_str("pub additional: BTreeMap<String, ");
fields.push_str(&prop_ty);
fields.push_str(">,\n");
}
diff --git a/src/generated/methods.rs b/src/generated/methods.rs
index 9afc13e..0f6a97b 100644
--- a/src/generated/methods.rs
+++ b/src/generated/methods.rs
@@ -1,5 +1,6 @@
use super::structs::*;
use crate::ForgejoError;
+use std::collections::BTreeMap;
impl crate::Forgejo {
/// Returns the Person actor for a user
@@ -4119,7 +4120,7 @@ impl crate::Forgejo {
&self,
owner: &str,
repo: &str,
- ) -> Result<std::collections::BTreeMap<String, u64>, ForgejoError> {
+ ) -> Result<BTreeMap<String, u64>, ForgejoError> {
let request = self
.get(&format!("repos/{owner}/{repo}/languages"))
.build()?;
diff --git a/src/generated/structs.rs b/src/generated/structs.rs
index 34764b6..7b8b25f 100644
--- a/src/generated/structs.rs
+++ b/src/generated/structs.rs
@@ -1,4 +1,5 @@
use crate::StructureError;
+use std::collections::BTreeMap;
/// APIError is an api error with a message
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct APIError {
@@ -496,7 +497,7 @@ pub enum CreateHookOptionType {
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateHookOptionConfig {
#[serde(flatten)]
- pub additional: std::collections::BTreeMap<String, String>,
+ pub additional: BTreeMap<String, String>,
}
/// CreateIssueCommentOption options for creating a comment on an issue
@@ -727,7 +728,7 @@ pub struct CreateTeamOption {
pub name: String,
pub permission: Option<CreateTeamOptionPermission>,
pub units: Option<Vec<String>>,
- pub units_map: Option<std::collections::BTreeMap<String, String>>,
+ pub units_map: Option<BTreeMap<String, String>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
@@ -892,7 +893,7 @@ pub struct EditHookOption {
pub active: Option<bool>,
pub authorization_header: Option<String>,
pub branch_filter: Option<String>,
- pub config: Option<std::collections::BTreeMap<String, String>>,
+ pub config: Option<BTreeMap<String, String>>,
pub events: Option<Vec<String>>,
}
@@ -1076,7 +1077,7 @@ pub struct EditTeamOption {
pub name: String,
pub permission: Option<EditTeamOptionPermission>,
pub units: Option<Vec<String>>,
- pub units_map: Option<std::collections::BTreeMap<String, String>>,
+ pub units_map: Option<BTreeMap<String, String>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
@@ -1351,7 +1352,7 @@ pub struct Hook {
pub active: Option<bool>,
pub authorization_header: Option<String>,
pub branch_filter: Option<String>,
- pub config: Option<std::collections::BTreeMap<String, String>>,
+ pub config: Option<BTreeMap<String, String>>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub events: Option<Vec<String>>,
@@ -1447,11 +1448,11 @@ pub struct IssueDeadline {
/// IssueFormField represents a form field
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct IssueFormField {
- pub attributes: Option<std::collections::BTreeMap<String, serde_json::Value>>,
+ pub attributes: Option<BTreeMap<String, serde_json::Value>>,
pub id: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
- pub validations: Option<std::collections::BTreeMap<String, serde_json::Value>>,
+ pub validations: Option<BTreeMap<String, serde_json::Value>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
@@ -1710,7 +1711,7 @@ pub struct NewIssuePinsAllowed {
/// NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NodeInfo {
- pub metadata: Option<serde_json::Map<String, serde_json::Value>>,
+ pub metadata: Option<BTreeMap<String, serde_json::Value>>,
#[serde(rename = "openRegistrations")]
pub open_registrations: Option<bool>,
pub protocols: Option<Vec<String>>,
@@ -2308,7 +2309,7 @@ pub struct Team {
pub organization: Option<Organization>,
pub permission: Option<TeamPermission>,
pub units: Option<Vec<String>>,
- pub units_map: Option<std::collections::BTreeMap<String, String>>,
+ pub units_map: Option<BTreeMap<String, String>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]