From 00bb22f255e20ade21fe84a674d663bbb14c8b83 Mon Sep 17 00:00:00 2001 From: Karim Khaleel Date: Thu, 7 Mar 2024 22:36:22 +0300 Subject: [PATCH] add tests for original struct name mapping field --- reflect_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reflect_test.go b/reflect_test.go index 37ea18a..e780197 100644 --- a/reflect_test.go +++ b/reflect_test.go @@ -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"]) +}