xeipuuv / gojsonschema

An implementation of JSON Schema, draft v4 v6 & v7 - Go language
2.56k stars 358 forks source link

anonymous struct from additionalproperties is inconvenient #343

Open aep opened 2 years ago

aep commented 2 years ago

this schema

properties:
  foo:
    type: object
       additionalproperties:
         type: object
         properties:
           ID:
             type: string

generates an anonymous struct

type VmhYamlFoo map[string]struct {
   ID string
}

for large objects this is very inconvenient since you need to redefine the struct each time you want to set that property. i think it would be better if the struct was a named type