Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
72a066a9
Commit
72a066a9
authored
Feb 05, 2015
by
Marek Grabowski
Committed by
Marek Grabowski
Feb 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more information to Validator error messages.
parent
91b43a4b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
validation.go
pkg/api/validation/validation.go
+0
-0
validation_test.go
pkg/api/validation/validation_test.go
+0
-0
validation.go
pkg/util/validation.go
+14
-14
No files found.
pkg/api/validation/validation.go
View file @
72a066a9
This diff is collapsed.
Click to expand it.
pkg/api/validation/validation_test.go
View file @
72a066a9
This diff is collapsed.
Click to expand it.
pkg/util/validation.go
View file @
72a066a9
...
@@ -33,45 +33,45 @@ func IsDNSSubdomain(value string) bool {
...
@@ -33,45 +33,45 @@ func IsDNSSubdomain(value string) bool {
return
IsDNS1123Subdomain
(
value
)
return
IsDNS1123Subdomain
(
value
)
}
}
const
dns
1123LabelFmt
string
=
"[a-z0-9]([-a-z0-9]*[a-z0-9])?"
const
DNS
1123LabelFmt
string
=
"[a-z0-9]([-a-z0-9]*[a-z0-9])?"
var
dns1123LabelRegexp
=
regexp
.
MustCompile
(
"^"
+
dns
1123LabelFmt
+
"$"
)
var
dns1123LabelRegexp
=
regexp
.
MustCompile
(
"^"
+
DNS
1123LabelFmt
+
"$"
)
const
dns
1123LabelMaxLength
int
=
63
const
DNS
1123LabelMaxLength
int
=
63
// IsDNS1123Label tests for a string that conforms to the definition of a label in
// IsDNS1123Label tests for a string that conforms to the definition of a label in
// DNS (RFC 1123).
// DNS (RFC 1123).
func
IsDNS1123Label
(
value
string
)
bool
{
func
IsDNS1123Label
(
value
string
)
bool
{
return
len
(
value
)
<=
dns
1123LabelMaxLength
&&
dns1123LabelRegexp
.
MatchString
(
value
)
return
len
(
value
)
<=
DNS
1123LabelMaxLength
&&
dns1123LabelRegexp
.
MatchString
(
value
)
}
}
const
dns1123SubdomainFmt
string
=
dns1123LabelFmt
+
"(
\\
."
+
dns
1123LabelFmt
+
")*"
const
DNS1123SubdomainFmt
string
=
DNS1123LabelFmt
+
"(
\\
."
+
DNS
1123LabelFmt
+
")*"
var
dns1123SubdomainRegexp
=
regexp
.
MustCompile
(
"^"
+
dns
1123SubdomainFmt
+
"$"
)
var
dns1123SubdomainRegexp
=
regexp
.
MustCompile
(
"^"
+
DNS
1123SubdomainFmt
+
"$"
)
const
dns
1123SubdomainMaxLength
int
=
253
const
DNS
1123SubdomainMaxLength
int
=
253
// IsDNS1123Subdomain tests for a string that conforms to the definition of a
// IsDNS1123Subdomain tests for a string that conforms to the definition of a
// subdomain in DNS (RFC 1123).
// subdomain in DNS (RFC 1123).
func
IsDNS1123Subdomain
(
value
string
)
bool
{
func
IsDNS1123Subdomain
(
value
string
)
bool
{
return
len
(
value
)
<=
dns
1123SubdomainMaxLength
&&
dns1123SubdomainRegexp
.
MatchString
(
value
)
return
len
(
value
)
<=
DNS
1123SubdomainMaxLength
&&
dns1123SubdomainRegexp
.
MatchString
(
value
)
}
}
const
dns
952LabelFmt
string
=
"[a-z]([-a-z0-9]*[a-z0-9])?"
const
DNS
952LabelFmt
string
=
"[a-z]([-a-z0-9]*[a-z0-9])?"
var
dns952LabelRegexp
=
regexp
.
MustCompile
(
"^"
+
dns
952LabelFmt
+
"$"
)
var
dns952LabelRegexp
=
regexp
.
MustCompile
(
"^"
+
DNS
952LabelFmt
+
"$"
)
const
dns
952LabelMaxLength
int
=
24
const
DNS
952LabelMaxLength
int
=
24
// IsDNS952Label tests for a string that conforms to the definition of a label in
// IsDNS952Label tests for a string that conforms to the definition of a label in
// DNS (RFC 952).
// DNS (RFC 952).
func
IsDNS952Label
(
value
string
)
bool
{
func
IsDNS952Label
(
value
string
)
bool
{
return
len
(
value
)
<=
dns
952LabelMaxLength
&&
dns952LabelRegexp
.
MatchString
(
value
)
return
len
(
value
)
<=
DNS
952LabelMaxLength
&&
dns952LabelRegexp
.
MatchString
(
value
)
}
}
const
c
IdentifierFmt
string
=
"[A-Za-z_][A-Za-z0-9_]*"
const
C
IdentifierFmt
string
=
"[A-Za-z_][A-Za-z0-9_]*"
var
cIdentifierRegexp
=
regexp
.
MustCompile
(
"^"
+
c
IdentifierFmt
+
"$"
)
var
cIdentifierRegexp
=
regexp
.
MustCompile
(
"^"
+
C
IdentifierFmt
+
"$"
)
// IsCIdentifier tests for a string that conforms the definition of an identifier
// IsCIdentifier tests for a string that conforms the definition of an identifier
// in C. This checks the format, but not the length.
// in C. This checks the format, but not the length.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment