diff --git a/bundle/schema/schema.go b/bundle/schema/schema.go index d5c6c1f6..8290139c 100644 --- a/bundle/schema/schema.go +++ b/bundle/schema/schema.go @@ -50,7 +50,8 @@ func New(golangType reflect.Type, docs *Docs) (*jsonschema.Schema, error) { s, { Type: jsonschema.StringType, - // TODO: + // TODO: Narrow down the scope of the regex match. + // Also likely need to rename this variable. Pattern: dynvar.VariableRegex, }, }, diff --git a/libs/jsonschema/from_type.go b/libs/jsonschema/from_type.go index 43ce9a85..fa9c1efa 100644 --- a/libs/jsonschema/from_type.go +++ b/libs/jsonschema/from_type.go @@ -62,11 +62,10 @@ func FromType(typ reflect.Type, opts FromTypeOptions) (Schema, error) { res = Schema{Type: StringType} case reflect.Bool: res = Schema{Type: BooleanType} - // case reflect.Int, reflect.Int32, reflect.Int64: - // res = Schema{Type: IntegerType} - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, - reflect.Float32, reflect.Float64: + // TODO: Add comment about reduced coverage of primitive Go types in the code paths here. + case reflect.Int: + res = Schema{Type: IntegerType} + case reflect.Float32, reflect.Float64: res = Schema{Type: NumberType} default: return InvalidSchema, fmt.Errorf("unsupported type: %s", typ.Kind()) @@ -164,6 +163,8 @@ func fromTypeStruct(typ reflect.Type, opts FromTypeOptions) (Schema, error) { return res, nil } +// TODO: Add comments explaining the translation between struct, map, slice and +// the JSON schema representation. func fromTypeSlice(typ reflect.Type, opts FromTypeOptions) (Schema, error) { if typ.Kind() != reflect.Slice { return InvalidSchema, fmt.Errorf("expected slice, got %s", typ.Kind())