diff --git a/fixtures/test_config.json b/fixtures/test_config.json new file mode 100644 index 0000000..97149b8 --- /dev/null +++ b/fixtures/test_config.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/invopop/jsonschema/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "name": { + "type": "string" + }, + "count": { + "type": "integer" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "count" + ] + } + } +} diff --git a/reflect_test.go b/reflect_test.go index c0d2c9f..566a965 100644 --- a/reflect_test.go +++ b/reflect_test.go @@ -545,3 +545,15 @@ func TestArrayFormat(t *testing.T) { pt := p.Items.Format require.Equal(t, pt, "uri") } + +func TestFieldNameTag(t *testing.T) { + type Config struct { + Name string `yaml:"name"` + Count int `yaml:"count"` + } + + r := Reflector{ + FieldNameTag: "yaml", + } + compareSchemaOutput(t, "fixtures/test_config.json", &r, &Config{}) +}