Moved v3 code from NginxProxyManager/nginx-proxy-manager-3 to NginxProxyManager/nginx-proxy-manager
This commit is contained in:
70
backend/internal/api/schema/common.go
Normal file
70
backend/internal/api/schema/common.go
Normal file
@ -0,0 +1,70 @@
|
||||
package schema
|
||||
|
||||
import "fmt"
|
||||
|
||||
func strictString(value string) string {
|
||||
return fmt.Sprintf(`{
|
||||
"type": "string",
|
||||
"pattern": "^%s$"
|
||||
}`, value)
|
||||
}
|
||||
|
||||
const intMinOne = `
|
||||
{
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
}
|
||||
`
|
||||
|
||||
const boolean = `
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
`
|
||||
|
||||
func stringMinMax(minLength, maxLength int) string {
|
||||
return fmt.Sprintf(`{
|
||||
"type": "string",
|
||||
"minLength": %d,
|
||||
"maxLength": %d
|
||||
}`, minLength, maxLength)
|
||||
}
|
||||
|
||||
func capabilties() string {
|
||||
return `{
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
}`
|
||||
}
|
||||
|
||||
func domainNames() string {
|
||||
return fmt.Sprintf(`
|
||||
{
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": %s
|
||||
}`, stringMinMax(4, 255))
|
||||
}
|
||||
|
||||
const anyType = `
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"type": "integer"
|
||||
}
|
||||
]
|
||||
}
|
||||
`
|
Reference in New Issue
Block a user