1
0
Fork 0

Merge pull request 'add CreateHookOptionConfig required properties as fields' (#50) from hook-config-required-fields into main

Reviewed-on: https://codeberg.org/Cyborus/forgejo-api/pulls/50
This commit is contained in:
Cyborus 2024-04-26 18:32:27 +00:00
commit e58237e9ff
3 changed files with 14 additions and 7 deletions

View file

@ -500,6 +500,8 @@ pub enum CreateHookOptionType {
/// required are "content_type" and "url" Required /// required are "content_type" and "url" Required
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateHookOptionConfig { pub struct CreateHookOptionConfig {
pub content_type: String,
pub url: url::Url,
#[serde(flatten)] #[serde(flatten)]
pub additional: BTreeMap<String, String>, pub additional: BTreeMap<String, String>,
} }

View file

@ -16942,9 +16942,18 @@
"CreateHookOptionConfig": { "CreateHookOptionConfig": {
"description": "CreateHookOptionConfig has all config options in it\nrequired are \"content_type\" and \"url\" Required", "description": "CreateHookOptionConfig has all config options in it\nrequired are \"content_type\" and \"url\" Required",
"type": "object", "type": "object",
"required": ["content_type", "url"],
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "string"
}, },
"properties": {
"content_type": {
"type": "string"
},
"url": {
"type": "string"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs" "x-go-package": "code.gitea.io/gitea/modules/structs"
}, },
"CreateIssueCommentOption": { "CreateIssueCommentOption": {

View file

@ -403,13 +403,9 @@ async fn admin() {
authorization_header: None, authorization_header: None,
branch_filter: None, branch_filter: None,
config: CreateHookOptionConfig { config: CreateHookOptionConfig {
// content_type: "json".into(), content_type: "json".into(),
// url: url::Url::parse("http://test.local/").unwrap(), url: url::Url::parse("http://test.local/").unwrap(),
additional: [ additional: Default::default(),
("content_type".into(), "json".into()),
("url".into(), "http://test.local/".into()),
]
.into(),
}, },
events: Some(Vec::new()), events: Some(Vec::new()),
r#type: CreateHookOptionType::Gitea, r#type: CreateHookOptionType::Gitea,