remove structs that only exist for their additional
field
This commit is contained in:
parent
d1aa5af564
commit
cad6890128
|
@ -203,17 +203,27 @@ fn schema_subtype_name(
|
||||||
let b = match schema {
|
let b = match schema {
|
||||||
Schema {
|
Schema {
|
||||||
_type: Some(SchemaType::One(Primitive::Object)),
|
_type: Some(SchemaType::One(Primitive::Object)),
|
||||||
|
properties: Some(_),
|
||||||
|
..
|
||||||
|
}
|
||||||
|
| Schema {
|
||||||
|
_type: Some(SchemaType::One(Primitive::String)),
|
||||||
|
_enum: Some(_),
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
*ty = format!("{parent_name}{}", name.to_pascal_case());
|
*ty = format!("{parent_name}{}", name.to_pascal_case());
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Schema {
|
Schema {
|
||||||
_type: Some(SchemaType::One(Primitive::String)),
|
_type: Some(SchemaType::One(Primitive::Object)),
|
||||||
_enum: Some(_enum),
|
properties: None,
|
||||||
|
additional_properties: Some(additional),
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
*ty = format!("{parent_name}{}", name.to_pascal_case());
|
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}>");
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Schema {
|
Schema {
|
||||||
|
@ -246,6 +256,7 @@ fn schema_subtypes(
|
||||||
match schema {
|
match schema {
|
||||||
Schema {
|
Schema {
|
||||||
_type: Some(SchemaType::One(Primitive::Object)),
|
_type: Some(SchemaType::One(Primitive::Object)),
|
||||||
|
properties: Some(_),
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
let name = format!("{parent_name}{}", name.to_pascal_case());
|
let name = format!("{parent_name}{}", name.to_pascal_case());
|
||||||
|
|
|
@ -4119,7 +4119,7 @@ impl crate::Forgejo {
|
||||||
&self,
|
&self,
|
||||||
owner: &str,
|
owner: &str,
|
||||||
repo: &str,
|
repo: &str,
|
||||||
) -> Result<RepoGetLanguagesResponse, ForgejoError> {
|
) -> Result<std::collections::BTreeMap<String, u64>, ForgejoError> {
|
||||||
let request = self
|
let request = self
|
||||||
.get(&format!("repos/{owner}/{repo}/languages"))
|
.get(&format!("repos/{owner}/{repo}/languages"))
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
|
@ -727,7 +727,7 @@ pub struct CreateTeamOption {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub permission: Option<CreateTeamOptionPermission>,
|
pub permission: Option<CreateTeamOptionPermission>,
|
||||||
pub units: Option<Vec<String>>,
|
pub units: Option<Vec<String>>,
|
||||||
pub units_map: Option<CreateTeamOptionUnitsMap>,
|
pub units_map: Option<std::collections::BTreeMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
|
@ -739,12 +739,6 @@ pub enum CreateTeamOptionPermission {
|
||||||
#[serde(rename = "admin")]
|
#[serde(rename = "admin")]
|
||||||
Admin,
|
Admin,
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct CreateTeamOptionUnitsMap {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub additional: std::collections::BTreeMap<String, String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// CreateUserOption create user options
|
/// CreateUserOption create user options
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct CreateUserOption {
|
pub struct CreateUserOption {
|
||||||
|
@ -898,16 +892,10 @@ pub struct EditHookOption {
|
||||||
pub active: Option<bool>,
|
pub active: Option<bool>,
|
||||||
pub authorization_header: Option<String>,
|
pub authorization_header: Option<String>,
|
||||||
pub branch_filter: Option<String>,
|
pub branch_filter: Option<String>,
|
||||||
pub config: Option<EditHookOptionConfig>,
|
pub config: Option<std::collections::BTreeMap<String, String>>,
|
||||||
pub events: Option<Vec<String>>,
|
pub events: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct EditHookOptionConfig {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub additional: std::collections::BTreeMap<String, String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// EditIssueCommentOption options for editing a comment
|
/// EditIssueCommentOption options for editing a comment
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct EditIssueCommentOption {
|
pub struct EditIssueCommentOption {
|
||||||
|
@ -1088,7 +1076,7 @@ pub struct EditTeamOption {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub permission: Option<EditTeamOptionPermission>,
|
pub permission: Option<EditTeamOptionPermission>,
|
||||||
pub units: Option<Vec<String>>,
|
pub units: Option<Vec<String>>,
|
||||||
pub units_map: Option<EditTeamOptionUnitsMap>,
|
pub units_map: Option<std::collections::BTreeMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
|
@ -1100,12 +1088,6 @@ pub enum EditTeamOptionPermission {
|
||||||
#[serde(rename = "admin")]
|
#[serde(rename = "admin")]
|
||||||
Admin,
|
Admin,
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct EditTeamOptionUnitsMap {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub additional: std::collections::BTreeMap<String, String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// EditUserOption edit user options
|
/// EditUserOption edit user options
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct EditUserOption {
|
pub struct EditUserOption {
|
||||||
|
@ -1369,7 +1351,7 @@ pub struct Hook {
|
||||||
pub active: Option<bool>,
|
pub active: Option<bool>,
|
||||||
pub authorization_header: Option<String>,
|
pub authorization_header: Option<String>,
|
||||||
pub branch_filter: Option<String>,
|
pub branch_filter: Option<String>,
|
||||||
pub config: Option<HookConfig>,
|
pub config: Option<std::collections::BTreeMap<String, String>>,
|
||||||
#[serde(with = "time::serde::rfc3339::option")]
|
#[serde(with = "time::serde::rfc3339::option")]
|
||||||
pub created_at: Option<time::OffsetDateTime>,
|
pub created_at: Option<time::OffsetDateTime>,
|
||||||
pub events: Option<Vec<String>>,
|
pub events: Option<Vec<String>>,
|
||||||
|
@ -1380,12 +1362,6 @@ pub struct Hook {
|
||||||
pub updated_at: Option<time::OffsetDateTime>,
|
pub updated_at: Option<time::OffsetDateTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct HookConfig {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub additional: std::collections::BTreeMap<String, String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Identity for a person's identity like an author or committer
|
/// Identity for a person's identity like an author or committer
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct Identity {
|
pub struct Identity {
|
||||||
|
@ -1471,23 +1447,11 @@ pub struct IssueDeadline {
|
||||||
/// IssueFormField represents a form field
|
/// IssueFormField represents a form field
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct IssueFormField {
|
pub struct IssueFormField {
|
||||||
pub attributes: Option<IssueFormFieldAttributes>,
|
pub attributes: Option<std::collections::BTreeMap<String, serde_json::Value>>,
|
||||||
pub id: Option<String>,
|
pub id: Option<String>,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub r#type: Option<String>,
|
pub r#type: Option<String>,
|
||||||
pub validations: Option<IssueFormFieldValidations>,
|
pub validations: Option<std::collections::BTreeMap<String, serde_json::Value>>,
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct IssueFormFieldAttributes {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub additional: std::collections::BTreeMap<String, serde_json::Value>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct IssueFormFieldValidations {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub additional: std::collections::BTreeMap<String, serde_json::Value>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
@ -1746,7 +1710,7 @@ pub struct NewIssuePinsAllowed {
|
||||||
/// NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks
|
/// 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)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct NodeInfo {
|
pub struct NodeInfo {
|
||||||
pub metadata: Option<NodeInfoMetadata>,
|
pub metadata: Option<serde_json::Map<String, serde_json::Value>>,
|
||||||
#[serde(rename = "openRegistrations")]
|
#[serde(rename = "openRegistrations")]
|
||||||
pub open_registrations: Option<bool>,
|
pub open_registrations: Option<bool>,
|
||||||
pub protocols: Option<Vec<String>>,
|
pub protocols: Option<Vec<String>>,
|
||||||
|
@ -1756,9 +1720,6 @@ pub struct NodeInfo {
|
||||||
pub version: Option<String>,
|
pub version: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct NodeInfoMetadata {}
|
|
||||||
|
|
||||||
/// NodeInfoServices contains the third party sites this server can connect to via their application API
|
/// NodeInfoServices contains the third party sites this server can connect to via their application API
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct NodeInfoServices {
|
pub struct NodeInfoServices {
|
||||||
|
@ -2347,7 +2308,7 @@ pub struct Team {
|
||||||
pub organization: Option<Organization>,
|
pub organization: Option<Organization>,
|
||||||
pub permission: Option<TeamPermission>,
|
pub permission: Option<TeamPermission>,
|
||||||
pub units: Option<Vec<String>>,
|
pub units: Option<Vec<String>>,
|
||||||
pub units_map: Option<TeamUnitsMap>,
|
pub units_map: Option<std::collections::BTreeMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
|
@ -2363,12 +2324,6 @@ pub enum TeamPermission {
|
||||||
#[serde(rename = "owner")]
|
#[serde(rename = "owner")]
|
||||||
Owner,
|
Owner,
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct TeamUnitsMap {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub additional: std::collections::BTreeMap<String, String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// TimeStamp defines a timestamp
|
/// TimeStamp defines a timestamp
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct TimeStamp {}
|
pub struct TimeStamp {}
|
||||||
|
@ -2755,11 +2710,6 @@ impl TryFrom<&reqwest::header::HeaderMap> for CommitListHeaders {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct LanguageStatisticsResponse {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub additional: std::collections::BTreeMap<String, u64>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ErrorHeaders {
|
pub struct ErrorHeaders {
|
||||||
pub message: Option<String>,
|
pub message: Option<String>,
|
||||||
|
@ -4600,11 +4550,6 @@ impl std::fmt::Display for IssueListLabelsQuery {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct RepoGetLanguagesResponse {
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub additional: std::collections::BTreeMap<String, u64>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct RepoGetRawFileOrLfsQuery {
|
pub struct RepoGetRawFileOrLfsQuery {
|
||||||
/// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
|
/// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
|
||||||
|
|
Loading…
Reference in a new issue