Add basic swagger documentation

accessible by running with -swagger. Accessible at /swagger/index.html.
Currently doesn't have authentication setup, so no requests will work.
This commit is contained in:
Harvey Tindall
2020-09-24 17:51:13 +01:00
parent 544f5674e8
commit b6537cef65
12 changed files with 3254 additions and 144 deletions
+10 -1
View File
@@ -19,9 +19,18 @@ func (vd *Validator) init(criteria ValidatorConf) {
vd.criteria = criteria
}
// This isn't used, its for swagger
type PasswordValidation struct {
Characters bool `json:"characters,omitempty"` // Number of characters
Lowercase bool `json:"lowercase characters,omitempty"` // Number of lowercase characters
Uppercase bool `json:"uppercase characters,omitempty"` // Number of uppercase characters
Numbers bool `json:"numbers,omitempty"` // Number of numbers
Specials bool `json:"special characters,omitempty"` // Number of special characters
}
func (vd *Validator) validate(password string) map[string]bool {
count := map[string]int{}
for key, _ := range vd.criteria {
for key := range vd.criteria {
count[key] = 0
}
for _, c := range password {