@@ -42,10 +42,6 @@ type EmbeddedChild struct {
4242 Value string `json:"value" doc:"old doc"`
4343}
4444
45- type embedWithExported struct {
46- Value string `json:"value" doc:"embed doc"`
47- }
48-
4945type Embedded struct {
5046 EmbeddedChild
5147 Value string `json:"value" doc:"new doc"`
@@ -698,28 +694,6 @@ func TestSchema(t *testing.T) {
698694 }
699695 }` ,
700696 },
701- {
702- name : "field-embed-unexported" ,
703- input : struct {
704- // the embed is an unexported type, but it can contribute exported properties that will be in the JSON
705- * embedWithExported
706- Value2 string `json:"value2"`
707- }{},
708- expected : `{
709- "type": "object",
710- "additionalProperties": false,
711- "required": ["value2", "value"],
712- "properties": {
713- "value": {
714- "type": "string",
715- "description": "embed doc"
716- },
717- "value2": {
718- "type": "string"
719- }
720- }
721- }` ,
722- },
723697 {
724698 name : "field-embed-override" ,
725699 input : struct {
@@ -1329,21 +1303,6 @@ func (o OmittableNullable[T]) Schema(r huma.Registry) *huma.Schema {
13291303 return s
13301304}
13311305
1332- func TestUnexportedEmbed (t * testing.T ) {
1333- // shows value is serialized in the JSON
1334- j , err := json .Marshal (struct {
1335- * embedWithExported
1336- Value2 string `json:"value2"`
1337- }{
1338- embedWithExported : & embedWithExported {
1339- Value : "foo" ,
1340- },
1341- Value2 : "bar" ,
1342- })
1343- require .NoError (t , err )
1344- assert .JSONEq (t , `{"value":"foo","value2":"bar"}` , string (j ))
1345- }
1346-
13471306func TestCustomUnmarshalType (t * testing.T ) {
13481307 type O struct {
13491308 Field OmittableNullable [int ] `json:"field" maximum:"10" example:"5"`
0 commit comments