[Rust-Axum] Fix Regex (#22277)

This commit is contained in:
Linh Tran Tuan
2025-11-04 14:35:51 +09:00
committed by GitHub
parent 0ae50f5a10
commit 7ce0096e73
44 changed files with 56 additions and 56 deletions

View File

@@ -42,7 +42,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -182,12 +182,12 @@ pub fn check_xss_map<T>(v: &std::collections::HashMap<String, T>) -> std::result
{{#pattern}}
{{^isByteArray}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}HeaderParams_{{{paramName}}}{{/lambda.uppercase}}: regex::Regex = regex::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}HeaderParams_{{{paramName}}}{{/lambda.uppercase}}: regex::Regex = regex::Regex::new("{{ pattern }}").unwrap();
}
{{/isByteArray}}
{{#isByteArray}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}HeaderParams_{{{paramName}}}{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}HeaderParams_{{{paramName}}}{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new("{{ pattern }}").unwrap();
}
fn validate_byte_{{#lambda.lowercase}}{{{operationIdCamelCase}}}HeaderParams_{{{paramName}}}{{/lambda.lowercase}}(
b: &ByteArray
@@ -332,12 +332,12 @@ pub fn check_xss_map<T>(v: &std::collections::HashMap<String, T>) -> std::result
{{#pattern}}
{{^isByteArray}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}PathParams_{{{paramName}}}{{/lambda.uppercase}}: regex::Regex = regex::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}PathParams_{{{paramName}}}{{/lambda.uppercase}}: regex::Regex = regex::Regex::new("{{ pattern }}").unwrap();
}
{{/isByteArray}}
{{#isByteArray}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}PathParams_{{{paramName}}}{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}PathParams_{{{paramName}}}{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new("{{ pattern }}").unwrap();
}
fn validate_byte_{{#lambda.lowercase}}{{{operationIdCamelCase}}}PathParams_{{{paramName}}}{{/lambda.lowercase}}(
b: &ByteArray
@@ -494,12 +494,12 @@ pub fn check_xss_map<T>(v: &std::collections::HashMap<String, T>) -> std::result
{{#pattern}}
{{^isByteArray}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}QueryParams_{{{paramName}}}{{/lambda.uppercase}}: regex::Regex = regex::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}QueryParams_{{{paramName}}}{{/lambda.uppercase}}: regex::Regex = regex::Regex::new("{{ pattern }}").unwrap();
}
{{/isByteArray}}
{{#isByteArray}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}QueryParams_{{{paramName}}}{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}QueryParams_{{{paramName}}}{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new("{{ pattern }}").unwrap();
}
fn validate_byte_{{#lambda.lowercase}}{{{operationIdCamelCase}}}QueryParams_{{{paramName}}}{{/lambda.lowercase}}(
b: &ByteArray
@@ -1096,12 +1096,12 @@ impl {{{classname}}} {
{{#pattern}}
{{^isByteArray}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{classname}}}_{{{name}}}{{/lambda.uppercase}}: regex::Regex = regex::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{classname}}}_{{{name}}}{{/lambda.uppercase}}: regex::Regex = regex::Regex::new("{{ pattern }}").unwrap();
}
{{/isByteArray}}
{{#isByteArray}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{classname}}}_{{{name}}}{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{classname}}}_{{{name}}}{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new("{{ pattern }}").unwrap();
}
fn validate_byte_{{#lambda.lowercase}}{{{classname}}}_{{{name}}}{{/lambda.lowercase}}(
b: &ByteArray

View File

@@ -119,12 +119,12 @@
{{#pattern}}
{{#isString}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}BodyValidator{{/lambda.uppercase}}: regex::Regex = regex::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}BodyValidator{{/lambda.uppercase}}: regex::Regex = regex::Regex::new("{{ pattern }}").unwrap();
}
{{/isString}}
{{^isString}}
lazy_static::lazy_static! {
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}BodyValidator{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new(r"{{ pattern }}").unwrap();
static ref RE_{{#lambda.uppercase}}{{{operationIdCamelCase}}}BodyValidator{{/lambda.uppercase}}: regex::bytes::Regex = regex::bytes::Regex::new("{{ pattern }}").unwrap();
}
fn validate_byte_{{#lambda.lowercase}}{{{operationIdCamelCase}}}BodyValidator{{/lambda.lowercase}}(
b: &[u8]

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 1.0.0
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 1.0.0
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 1.0.7
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 1.0.7
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 0.0.1
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -23,7 +23,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 1.0.0
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -2867,10 +2867,10 @@ pub struct FormatTest {
}
lazy_static::lazy_static! {
static ref RE_FORMATTEST_STRING: regex::Regex = regex::Regex::new(r"/[a-z]/i").unwrap();
static ref RE_FORMATTEST_STRING: regex::Regex = regex::Regex::new("/[a-z]/i").unwrap();
}
lazy_static::lazy_static! {
static ref RE_FORMATTEST_BYTE: regex::bytes::Regex = regex::bytes::Regex::new(r"^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}&#x3D;&#x3D;|[A-Za-z0-9+/]{3}&#x3D;)?$").unwrap();
static ref RE_FORMATTEST_BYTE: regex::bytes::Regex = regex::bytes::Regex::new("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}&#x3D;&#x3D;|[A-Za-z0-9+/]{3}&#x3D;)?$").unwrap();
}
fn validate_byte_formattest_byte(
b: &ByteArray,
@@ -5665,10 +5665,10 @@ pub struct TestEndpointParametersRequest {
}
lazy_static::lazy_static! {
static ref RE_TESTENDPOINTPARAMETERSREQUEST_STRING: regex::Regex = regex::Regex::new(r"/[a-z]/i").unwrap();
static ref RE_TESTENDPOINTPARAMETERSREQUEST_STRING: regex::Regex = regex::Regex::new("/[a-z]/i").unwrap();
}
lazy_static::lazy_static! {
static ref RE_TESTENDPOINTPARAMETERSREQUEST_PATTERN_WITHOUT_DELIMITER: regex::Regex = regex::Regex::new(r"^[A-Z].*").unwrap();
static ref RE_TESTENDPOINTPARAMETERSREQUEST_PATTERN_WITHOUT_DELIMITER: regex::Regex = regex::Regex::new("^[A-Z].*").unwrap();
}
impl TestEndpointParametersRequest {

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.0-SNAPSHOT

View File

@@ -22,7 +22,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 1.0.0
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -163,7 +163,7 @@ pub struct LoginUserQueryParams {
}
lazy_static::lazy_static! {
static ref RE_LOGINUSERQUERYPARAMS_USERNAME: regex::Regex = regex::Regex::new(r"^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$").unwrap();
static ref RE_LOGINUSERQUERYPARAMS_USERNAME: regex::Regex = regex::Regex::new("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$").unwrap();
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
@@ -356,7 +356,7 @@ pub struct Category {
}
lazy_static::lazy_static! {
static ref RE_CATEGORY_NAME: regex::Regex = regex::Regex::new(r"^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$").unwrap();
static ref RE_CATEGORY_NAME: regex::Regex = regex::Regex::new("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$").unwrap();
}
impl Category {

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 1.0
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 0.0.1
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 0.1.9
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 0.0.1
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -1 +1 @@
7.17.0-SNAPSHOT
7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 2.3.4
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT

View File

@@ -21,7 +21,7 @@ conversion = [
ammonia = "4"
async-trait = "0.1"
axum = { version = "0.8", features = ["multipart"] }
axum-extra = { version = "0.10", features = ["cookie", "query"] }
axum-extra = { version = "0.12", features = ["cookie", "query"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }

View File

@@ -12,7 +12,7 @@ server, you can easily generate a server stub.
To see how to make this your own, look here: [README]((https://openapi-generator.tech))
- API version: 0.0.1
- Generator version: 7.17.0-SNAPSHOT
- Generator version: 7.18.0-SNAPSHOT