Skip to content

Commit

Permalink
add tests for original struct name mapping field
Browse files Browse the repository at this point in the history
  • Loading branch information
karimkhaleel committed Mar 7, 2024
1 parent 3989550 commit 00bb22f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions reflect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,3 +675,15 @@ func TestJSONSchemaAlias(t *testing.T) {
compareSchemaOutput(t, "fixtures/schema_alias.json", r, &AliasObjectB{})
compareSchemaOutput(t, "fixtures/schema_alias_2.json", r, &AliasObjectC{})
}

func TestOriginalPropertiesMapping(t *testing.T) {
type TestStruct struct {
OriginalName string `json:"altered_name"`
}

r := &Reflector{}

s := r.Reflect(&TestStruct{})
subschema := s.Definitions["TestStruct"]
assert.EqualValues(t, "altered_name", subschema.OriginalPropertiesMapping["OriginalName"])
}

0 comments on commit 00bb22f

Please sign in to comment.