Version 3 starter

This commit is contained in:
Jamie Curnow
2021-06-14 19:29:35 +10:00
parent 60fc57431a
commit 6205434140
642 changed files with 25817 additions and 32319 deletions

View File

@@ -0,0 +1,61 @@
package schema
import "fmt"
func strictString(value string) string {
return fmt.Sprintf(`{
"type": "string",
"pattern": "^%s$"
}`, value)
}
const intMinOne = `
{
"type": "integer",
"minimum": 1
}
`
func stringMinMax(minLength, maxLength int) string {
return fmt.Sprintf(`{
"type": "string",
"minLength": %d,
"maxLength": %d
}`, minLength, maxLength)
}
func userRoles() string {
return fmt.Sprintf(`
{
"type": "array",
"items": %s
}`, stringMinMax(2, 50))
}
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"
}
]
}
`