(schema *jsonschema.Schema, basePath string)
| 41 | } |
| 42 | |
| 43 | func GenerateReference(schema *jsonschema.Schema, basePath string) { |
| 44 | versionField, ok := schema.Properties.Get(versionFieldName) |
| 45 | if ok { |
| 46 | if fieldSchema, ok := versionField.(*jsonschema.Schema); ok { |
| 47 | versionEnum := []string{} |
| 48 | for version := range versions.VersionLoader { |
| 49 | versionEnum = append(versionEnum, version) |
| 50 | } |
| 51 | |
| 52 | sort.SliceStable(versionEnum, func(a, b int) bool { |
| 53 | majorA, _ := strconv.Atoi(string(versionEnum[a][1])) |
| 54 | majorB, _ := strconv.Atoi(string(versionEnum[b][1])) |
| 55 | minorA, _ := strconv.Atoi(string(versionEnum[a][6:])) |
| 56 | minorB, _ := strconv.Atoi(string(versionEnum[b][6:])) |
| 57 | |
| 58 | if majorA == majorB { |
| 59 | return minorA > minorB |
| 60 | } else { |
| 61 | return majorA > majorB |
| 62 | } |
| 63 | }) |
| 64 | |
| 65 | fieldSchema.Enum = []interface{}{} |
| 66 | for _, version := range versionEnum { |
| 67 | fieldSchema.Enum = append(fieldSchema.Enum, version) |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | createSections(basePath, "", schema, schema.Definitions, 1, false) |
| 73 | } |
| 74 | |
| 75 | func createSections(basePath, prefix string, schema *jsonschema.Schema, definitions jsonschema.Definitions, depth int, parentIsNameObjectMap bool) string { |
| 76 | partialImports := &[]string{} |
no test coverage detected