Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/sourcegraph/jsonschemadoc

go 1.14
go 1.26.4

require (
github.com/pkg/errors v0.9.1 // indirect
Expand Down
16 changes: 8 additions & 8 deletions jsonschemadoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func Generate(schema *jsonschema.Schema) (string, error) {
return buf.String(), nil
}

func marshalIndentIfLong(v interface{}, prefix, indent string) ([]byte, error) {
func marshalIndentIfLong(v any, prefix, indent string) ([]byte, error) {
const longChars = 30
b, err := json.Marshal(v)
if len(b) > longChars {
Expand All @@ -138,7 +138,7 @@ func writeJSONComment(buf *bytes.Buffer, indent, space, text string) error {
return nil
}

func writeJSONValue(enc *json.Encoder, buf *bytes.Buffer, v interface{}) error {
func writeJSONValue(enc *json.Encoder, buf *bytes.Buffer, v any) error {
if err := enc.Encode(v); err != nil {
return err
}
Expand Down Expand Up @@ -205,7 +205,7 @@ func isType(schema *jsonschema.Schema, typ jsonschema.PrimitiveType) bool {
}

func extraField(schema *jsonschema.Schema, name string) string {
var m map[string]interface{}
var m map[string]any
if schema.Raw == nil {
return ""
}
Expand All @@ -229,9 +229,9 @@ type propertyGroup struct {

// property represents a jsonschema.Schema.Properties and its name in a single structure.
type property struct {
name string // property name
comment string // doc comment
value *interface{} // default value (or const value)
examples []interface{} // other example values
first bool // show this property at the top
name string // property name
comment string // doc comment
value *any // default value (or const value)
examples []any // other example values
first bool // show this property at the top
}
Loading