Skip to content

Commit

Permalink
add some more todos:
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-goenka committed Aug 20, 2024
1 parent 75f252e commit 43325fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion bundle/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
Expand Down
11 changes: 6 additions & 5 deletions libs/jsonschema/from_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 43325fd

Please sign in to comment.