More reasonable length restrictions (#458)
This commit is contained in:
parent
75b7583832
commit
3e52f804a7
@ -130,7 +130,7 @@ fn default_project_type() -> String {
|
||||
|
||||
#[derive(Serialize, Deserialize, Validate, Clone)]
|
||||
struct ProjectCreateData {
|
||||
#[validate(length(min = 3, max = 256))]
|
||||
#[validate(length(min = 3, max = 64))]
|
||||
#[serde(alias = "mod_name")]
|
||||
/// The title or name of the project.
|
||||
pub title: String,
|
||||
@ -145,7 +145,7 @@ struct ProjectCreateData {
|
||||
#[serde(alias = "mod_slug")]
|
||||
/// The slug of a project, used for vanity URLs
|
||||
pub slug: String,
|
||||
#[validate(length(min = 3, max = 2048))]
|
||||
#[validate(length(min = 3, max = 255))]
|
||||
#[serde(alias = "mod_description")]
|
||||
/// A short description of the project.
|
||||
pub description: String,
|
||||
|
||||
@ -251,9 +251,9 @@ pub async fn dependency_list(
|
||||
/// A project returned from the API
|
||||
#[derive(Serialize, Deserialize, Validate)]
|
||||
pub struct EditProject {
|
||||
#[validate(length(min = 3, max = 256))]
|
||||
#[validate(length(min = 3, max = 64))]
|
||||
pub title: Option<String>,
|
||||
#[validate(length(min = 3, max = 2048))]
|
||||
#[validate(length(min = 3, max = 256))]
|
||||
pub description: Option<String>,
|
||||
#[validate(length(max = 65536))]
|
||||
pub body: Option<String>,
|
||||
|
||||
@ -130,21 +130,21 @@ lazy_static! {
|
||||
|
||||
#[derive(Serialize, Deserialize, Validate)]
|
||||
pub struct EditUser {
|
||||
#[validate(length(min = 1, max = 255), regex = "RE_URL_SAFE")]
|
||||
#[validate(length(min = 1, max = 39), regex = "RE_URL_SAFE")]
|
||||
pub username: Option<String>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
with = "::serde_with::rust::double_option"
|
||||
)]
|
||||
#[validate(length(min = 1, max = 255), regex = "RE_URL_SAFE")]
|
||||
#[validate(length(min = 1, max = 64), regex = "RE_URL_SAFE")]
|
||||
pub name: Option<Option<String>>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
with = "::serde_with::rust::double_option"
|
||||
)]
|
||||
#[validate(email)]
|
||||
#[validate(email, length(max = 2048))]
|
||||
pub email: Option<Option<String>>,
|
||||
#[serde(
|
||||
default,
|
||||
|
||||
@ -32,11 +32,11 @@ pub struct InitialVersionData {
|
||||
#[validate(length(min = 1, max = 256))]
|
||||
pub file_parts: Vec<String>,
|
||||
#[validate(
|
||||
length(min = 1, max = 64),
|
||||
length(min = 1, max = 32),
|
||||
regex = "crate::util::validate::RE_URL_SAFE"
|
||||
)]
|
||||
pub version_number: String,
|
||||
#[validate(length(min = 1, max = 256))]
|
||||
#[validate(length(min = 1, max = 64))]
|
||||
#[serde(alias = "name")]
|
||||
pub version_title: String,
|
||||
#[validate(length(max = 65536))]
|
||||
|
||||
@ -167,10 +167,10 @@ pub async fn version_get(
|
||||
|
||||
#[derive(Serialize, Deserialize, Validate)]
|
||||
pub struct EditVersion {
|
||||
#[validate(length(min = 1, max = 256))]
|
||||
#[validate(length(min = 1, max = 64))]
|
||||
pub name: Option<String>,
|
||||
#[validate(
|
||||
length(min = 1, max = 64),
|
||||
length(min = 1, max = 32),
|
||||
regex = "crate::util::validate::RE_URL_SAFE"
|
||||
)]
|
||||
pub version_number: Option<String>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user