From 9891f8798ea46aa79353b4793c3356ab6303aa7b Mon Sep 17 00:00:00 2001 From: Marcos Schroh <2828842+marcosschroh@users.noreply.github.com> Date: Thu, 15 Jun 2023 14:04:32 +0200 Subject: [PATCH] fix: stringcase replaced by casefy. Closes #341 (#347) Co-authored-by: Marcos Schroh --- dataclasses_avroschema/case.py | 52 ++++++++++--------- .../model_generator/generator.py | 12 ++--- docs/case.md | 3 +- poetry.lock | 25 ++++----- pyproject.toml | 2 +- tests/case/test_case_records.py | 51 +++++++++++------- 6 files changed, 81 insertions(+), 64 deletions(-) diff --git a/dataclasses_avroschema/case.py b/dataclasses_avroschema/case.py index 59c1524f..ac6b09eb 100644 --- a/dataclasses_avroschema/case.py +++ b/dataclasses_avroschema/case.py @@ -1,21 +1,21 @@ import typing -import stringcase +import casefy from .field_utils import ENUM -# Summary from https://github.com/okunishinishi/python-stringcase -# stringcase.camelcase('foo_bar_baz') # => "fooBarBaz" -# stringcase.capitalcase('foo_bar_baz') # => "Foo_bar_baz" -# stringcase.constcase('FooBarBaz') # => "_FOO_BAR_BAZ" -# stringcase.lowercase('FooBarBaz') # => "foobarbaz" -# stringcase.pascalcase('FooBarBaz') # => "FooBarBaz" -# stringcase.pathcase('foo_bar_baz') # => "foo/bar/baz" -# stringcase.snakecase('FooBarBaz') # => "foo_bar_baz" -# stringcase.spinalcase('FooBarBaz') # => "-foo-bar-baz" -# stringcase.trimcase('FooBarBaz') # => "FooBarBaz" -# stringcase.uppercase('FooBarBaz') # => "FOOBARBAZ" -# stringcase.alphanumcase('Foo_123 Bar!') # =>'Foo123Bar' +# casefy.camelcase('foo_bar_baz') # => "fooBarBaz" +# casefy.capitalcase('foo_bar_baz') # => "Foo_bar_baz" +# casefy.constcase('FooBarBaz') # => "_FOO_BAR_BAZ" +# casefy.lowercase('FooBarBaz') # => "foobarbaz" +# casefy.pascalcase('FooBarBaz') # => "FooBarBaz" +# casefy.pathcase('foo_bar_baz') # => "foo/bar/baz" +# casefy.snakecase('FooBarBaz') # => "foo_bar_baz" +# casefy.kebabcase('FooBarBaz') # => "-foo-bar-baz" +# casefy.upperkebabcase('FooBarBaz') # => "FOO-BAR" +# casefy.trimcase('FooBarBaz') # => "FooBarBaz" +# casefy.uppercase('FooBarBaz') # => "FOOBARBAZ" +# casefy.alphanumcase('Foo_123 Bar!') # =>'Foo123Bar' CAMELCASE = "camelcase" CAPITALCASE = "capitalcase" @@ -25,23 +25,25 @@ PATHCASE = "PATHCASE" SNAKECASE = "snakecase" SPINALCASE = "spinalcase" +UPPERSPINALCASE = "upperkebabcase" TRIMCASE = "trimcase" UPPERCASE = "uppercase" ALPHANUMCASE = "alphanumcase" CASE_TO_FUNC = { - CAMELCASE: stringcase.camelcase, - CAPITALCASE: stringcase.capitalcase, - CONSTCASE: stringcase.constcase, - LOWERCASE: stringcase.lowercase, - PASCALCASE: stringcase.pascalcase, - PATHCASE: stringcase.pathcase, - SNAKECASE: stringcase.snakecase, - SPINALCASE: stringcase.spinalcase, - TRIMCASE: stringcase.trimcase, - UPPERCASE: stringcase.uppercase, - ALPHANUMCASE: stringcase.alphanumcase, + CAMELCASE: casefy.camelcase, + CAPITALCASE: casefy.capitalcase, + CONSTCASE: casefy.constcase, + LOWERCASE: casefy.lowercase, + PASCALCASE: casefy.pascalcase, + PATHCASE: lambda value: casefy.separatorcase(value, separator="/"), + SNAKECASE: casefy.snakecase, + SPINALCASE: casefy.kebabcase, + UPPERSPINALCASE: casefy.upperkebabcase, + TRIMCASE: str.strip, + UPPERCASE: casefy.uppercase, + ALPHANUMCASE: casefy.alphanumcase, } @@ -50,7 +52,7 @@ def case_item(item: typing.Dict, case_type: str) -> typing.Dict: new_field = {} for key, value in item.items(): if key == "name": - case_name = case_func(value) + case_name = case_func(value) # type: ignore new_field[key] = case_name elif isinstance(value, dict) and value.get("name"): # means that it is a complex type with a record diff --git a/dataclasses_avroschema/model_generator/generator.py b/dataclasses_avroschema/model_generator/generator.py index ba10b9f3..9640d20e 100644 --- a/dataclasses_avroschema/model_generator/generator.py +++ b/dataclasses_avroschema/model_generator/generator.py @@ -3,8 +3,8 @@ from dataclasses import dataclass, field from string import Template +import casefy import fastavro -import stringcase from dataclasses_avroschema import field_utils, serialization from dataclasses_avroschema.types import JsonDict @@ -121,7 +121,7 @@ def render_class(self, *, schema: JsonDict) -> str: """ Render the class generated from the schema """ - name: str = stringcase.pascalcase(schema["name"]) + name: str = casefy.pascalcase(schema["name"]) record_fields: typing.List[JsonDict] = schema["fields"] # Sort the fields according whether it has a default value @@ -222,7 +222,7 @@ def render_field(self, field: JsonDict, model_name: str) -> str: record = f"\n{self.render_class(schema=field)}" is_complex_type = True self.extras.append(record) - language_type = stringcase.pascalcase(field["name"]) + language_type = casefy.pascalcase(field["name"]) else: # Native field or Logical type using a native language_type = self.get_language_type(type=type, model_name=model_name) @@ -378,10 +378,10 @@ def parse_enum(self, field: JsonDict) -> str: self.imports.add("import enum") field_name: str = field["name"] - enum_name = stringcase.pascalcase(field_name) + enum_name = casefy.pascalcase(field_name) symbols = self.field_identation.join( [ - templates.enum_symbol_template.safe_substitute(key=stringcase.uppercase(symbol), value=f'"{symbol}"') + templates.enum_symbol_template.safe_substitute(key=casefy.uppercase(symbol), value=f'"{symbol}"') for symbol in field["symbols"] ] ) @@ -436,7 +436,7 @@ def get_field_default(self, *, field_type: str, default: typing.Any, name: str) elif field_type == field_utils.BYTES: return f'b"{default}"' elif isinstance(field_type, dict) and field_type.get("type") == field_utils.ENUM: - return f"{stringcase.pascalcase(field_type['name'])}.{stringcase.uppercase(default)}" + return f"{casefy.pascalcase(field_type['name'])}.{casefy.uppercase(default)}" elif isinstance( default, ( diff --git a/docs/case.md b/docs/case.md index 284e1d55..d3639088 100644 --- a/docs/case.md +++ b/docs/case.md @@ -82,7 +82,8 @@ resulting in |pascalcase|'FooBarBaz' # => "FooBarBaz"| |pathcase|'foo_bar_baz' # => "foo/bar/baz"| |snakecase|'FooBarBaz' # => "foo_bar_baz"| -|spinalcase|'FooBarBaz' # => "-foo-bar-baz"| +|upperspinalcase|'FooBarBaz' # => "-foo-bar-baz"| +|spinalcase|'FooBarBaz' # => "FOO-BAR"| |trimcase|'FooBarBaz' # => "FooBarBaz"| |uppercase|'FooBarBaz' # => "FOOBARBAZ| |alphanumcase|'Foo_123 Bar!' # =>'Foo123Bar'| diff --git a/poetry.lock b/poetry.lock index 5952969b..b6d4db98 100644 --- a/poetry.lock +++ b/poetry.lock @@ -163,6 +163,14 @@ d = ["aiohttp (>=3.7.4)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] +[[package]] +name = "casefy" +version = "0.1.7" +description = "Utilities for string case conversion." +category = "main" +optional = false +python-versions = ">=3.6" + [[package]] name = "certifi" version = "2023.5.7" @@ -983,14 +991,6 @@ category = "main" optional = true python-versions = "*" -[[package]] -name = "stringcase" -version = "1.2.0" -description = "String case converter." -category = "main" -optional = false -python-versions = "*" - [[package]] name = "termcolor" version = "2.3.0" @@ -1147,7 +1147,7 @@ pydantic = ["pydantic"] [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "713b4d9ab2d1ea3f953b51ed4abfad9910f46f654af4d39987c7156693d28b7f" +content-hash = "ac591ea7adfdc55d98dca9c6348397b27b10780e3c7d62e6086b2f2e4eb42a00" [metadata.files] aiofiles = [ @@ -1331,6 +1331,10 @@ black = [ {file = "black-23.3.0-py3-none-any.whl", hash = "sha256:ec751418022185b0c1bb7d7736e6933d40bbb14c14a0abcf9123d1b159f98dd4"}, {file = "black-23.3.0.tar.gz", hash = "sha256:1c7b8d606e728a41ea1ccbd7264677e494e87cf630e399262ced92d4a8dac940"}, ] +casefy = [ + {file = "casefy-0.1.7-py3-none-any.whl", hash = "sha256:ab05ff1c67f2a8e62d9f8986fa9a849416d61ac5413ec57d1f827b4f36589cf6"}, + {file = "casefy-0.1.7.tar.gz", hash = "sha256:6accce985a64b9edb2a610a29ac489d78fac80e52ff8f2d137e294f2f92b8027"}, +] certifi = [ {file = "certifi-2023.5.7-py3-none-any.whl", hash = "sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716"}, {file = "certifi-2023.5.7.tar.gz", hash = "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7"}, @@ -2065,9 +2069,6 @@ sortedcontainers = [ {file = "sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0"}, {file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"}, ] -stringcase = [ - {file = "stringcase-1.2.0.tar.gz", hash = "sha256:48a06980661908efe8d9d34eab2b6c13aefa2163b3ced26972902e3bdfd87008"}, -] termcolor = [ {file = "termcolor-2.3.0-py3-none-any.whl", hash = "sha256:3afb05607b89aed0ffe25202399ee0867ad4d3cb4180d98aaf8eefa6a5f7d475"}, {file = "termcolor-2.3.0.tar.gz", hash = "sha256:b5b08f68937f138fe92f6c089b99f1e2da0ae56c52b78bf7075fd95420fd9a5a"}, diff --git a/pyproject.toml b/pyproject.toml index 811752b1..ece600f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,10 +25,10 @@ python = "^3.7" fastavro = "^1.7.3" dacite = "^1.8.0" faker = "^18.3.1" -stringcase = "^1.2.0" inflector = "^3.1.0" pydantic = {version = "^1.10.7", optional = true} faust-streaming = {version = "^0.10.11", optional = true} +casefy = "^0.1.7" [tool.poetry.group.dev.dependencies] mypy = "^1" diff --git a/tests/case/test_case_records.py b/tests/case/test_case_records.py index 55aac1a8..c9e5323a 100644 --- a/tests/case/test_case_records.py +++ b/tests/case/test_case_records.py @@ -6,18 +6,18 @@ from dataclasses_avroschema import AvroModel, case, types -# Summary from https://github.com/okunishinishi/python-stringcase -# stringcase.camelcase('foo_bar_baz') # => "fooBarBaz" -# stringcase.capitalcase('foo_bar_baz') # => "Foo_bar_baz" -# stringcase.constcase('FooBarBaz') # => "_FOO_BAR_BAZ" -# stringcase.lowercase('FooBarBaz') # => "foobarbaz" -# stringcase.pascalcase('FooBarBaz') # => "FooBarBaz" -# stringcase.pathcase('foo_bar_baz') # => "foo/bar/baz" -# stringcase.snakecase('FooBarBaz') # => "foo_bar_baz" -# stringcase.spinalcase('FooBarBaz') # => "-foo-bar-baz" -# stringcase.trimcase('FooBarBaz') # => "FooBarBaz" -# stringcase.uppercase('FooBarBaz') # => "FOOBARBAZ" -# stringcase.alphanumcase('Foo_123 Bar!') # =>'Foo123Bar' +# casefy.camelcase('foo_bar_baz') # => "fooBarBaz" +# casefy.capitalcase('foo_bar_baz') # => "Foo_bar_baz" +# casefy.constcase('FooBarBaz') # => "_FOO_BAR_BAZ" +# casefy.lowercase('FooBarBaz') # => "foobarbaz" +# casefy.pascalcase('FooBarBaz') # => "FooBarBaz" +# casefy.pathcase('foo_bar_baz') # => "foo/bar/baz" +# casefy.snakecase('FooBarBaz') # => "foo_bar_baz" +# casefy.kebabcase('FooBarBaz') # => "-foo-bar-baz" +# casefy.upperkebabcase('FooBarBaz') # => "FOO-BAR" +# casefy.trimcase('FooBarBaz') # => "FooBarBaz" +# casefy.uppercase('FooBarBaz') # => "FOOBARBAZ" +# casefy.alphanumcase('Foo_123 Bar!') # =>'Foo123Bar' CASE_TO_DATA = [ @@ -29,9 +29,10 @@ (case.PATHCASE, '{"type": "record", "name": "Event", "fields": [{"name": "event/id", "type": "string"}]}'), (case.SNAKECASE, '{"type": "record", "name": "Event", "fields": [{"name": "event_id", "type": "string"}]}'), (case.SPINALCASE, '{"type": "record", "name": "Event", "fields": [{"name": "event-id", "type": "string"}]}'), + (case.UPPERSPINALCASE, '{"type": "record", "name": "Event", "fields": [{"name": "EVENT-ID", "type": "string"}]}'), (case.TRIMCASE, '{"type": "record", "name": "Event", "fields": [{"name": "event_id", "type": "string"}]}'), (case.UPPERCASE, '{"type": "record", "name": "Event", "fields": [{"name": "EVENT_ID", "type": "string"}]}'), - (case.ALPHANUMCASE, '{"type": "record", "name": "Event", "fields": [{"name": "event_id", "type": "string"}]}'), + (case.ALPHANUMCASE, '{"type": "record", "name": "Event", "fields": [{"name": "eventid", "type": "string"}]}'), ] @@ -68,6 +69,10 @@ case.SPINALCASE, '{"type": "record", "name": "Event", "fields": [{"name": "event-id", "type": "string"}, {"name": "user", "type": {"type": "record", "name": "User", "fields": [{"name": "name", "type": "string"}]}}]}', # noqa ), + ( + case.UPPERSPINALCASE, + '{"type": "record", "name": "Event", "fields": [{"name": "EVENT-ID", "type": "string"}, {"name": "USER", "type": {"type": "record", "name": "User", "fields": [{"name": "NAME", "type": "string"}]}}]}', # noqa + ), ( case.TRIMCASE, '{"type": "record", "name": "Event", "fields": [{"name": "event_id", "type": "string"}, {"name": "user", "type": {"type": "record", "name": "User", "fields": [{"name": "name", "type": "string"}]}}]}', # noqa @@ -78,7 +83,7 @@ ), ( case.ALPHANUMCASE, - '{"type": "record", "name": "Event", "fields": [{"name": "event_id", "type": "string"}, {"name": "user", "type": {"type": "record", "name": "User", "fields": [{"name": "name", "type": "string"}]}}]}', # noqa + '{"type": "record", "name": "Event", "fields": [{"name": "eventid", "type": "string"}, {"name": "user", "type": {"type": "record", "name": "User", "fields": [{"name": "name", "type": "string"}]}}]}', # noqa ), ] @@ -94,7 +99,7 @@ ), ( case.CONSTCASE, - '{"type": "record", "name": "UserAdvance", "fields": [{"name": "NAME", "type": "string"}, {"name": "AGE", "type": "long"}, {"name": "PETS", "type": {"type": "array", "items": "string", "name": "PET"}}, {"name": "ACCOUNTS", "type": {"type": "map", "values": "long", "name": "ACCOUNT"}}, {"name": "MD5", "type": {"type": "fixed", "name": "MD5", "size": 16}}, {"name": "FAVORITE_COLORS", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "HAS_CAR", "type": "boolean", "default": false}, {"name": "COUNTRY", "type": "string", "default": "Argentina"}, {"name": "ADDRESS", "type": ["null", "string"], "default": null}]}', # noqa + '{"type": "record", "name": "UserAdvance", "fields": [{"name": "NAME", "type": "string"}, {"name": "AGE", "type": "long"}, {"name": "PETS", "type": {"type": "array", "items": "string", "name": "PET"}}, {"name": "ACCOUNTS", "type": {"type": "map", "values": "long", "name": "ACCOUNT"}}, {"name": "MD_5", "type": {"type": "fixed", "name": "MD_5", "size": 16}}, {"name": "FAVORITE_COLORS", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "HAS_CAR", "type": "boolean", "default": false}, {"name": "COUNTRY", "type": "string", "default": "Argentina"}, {"name": "ADDRESS", "type": ["null", "string"], "default": null}]}', # noqa ), ( case.LOWERCASE, @@ -106,15 +111,19 @@ ), ( case.PATHCASE, - '{"type": "record", "name": "UserAdvance", "fields": [{"name": "name", "type": "string"}, {"name": "age", "type": "long"}, {"name": "pets", "type": {"type": "array", "items": "string", "name": "pet"}}, {"name": "accounts", "type": {"type": "map", "values": "long", "name": "account"}}, {"name": "md5", "type": {"type": "fixed", "name": "md5", "size": 16}}, {"name": "favorite/colors", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "has/car", "type": "boolean", "default": false}, {"name": "country", "type": "string", "default": "Argentina"}, {"name": "address", "type": ["null", "string"], "default": null}]}', # noqa + '{"type": "record", "name": "UserAdvance", "fields": [{"name": "name", "type": "string"}, {"name": "age", "type": "long"}, {"name": "pets", "type": {"type": "array", "items": "string", "name": "pet"}}, {"name": "accounts", "type": {"type": "map", "values": "long", "name": "account"}}, {"name": "md/5", "type": {"type": "fixed", "name": "md/5", "size": 16}}, {"name": "favorite/colors", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "has/car", "type": "boolean", "default": false}, {"name": "country", "type": "string", "default": "Argentina"}, {"name": "address", "type": ["null", "string"], "default": null}]}', # noqa ), ( case.SNAKECASE, - '{"type": "record", "name": "UserAdvance", "fields": [{"name": "name", "type": "string"}, {"name": "age", "type": "long"}, {"name": "pets", "type": {"type": "array", "items": "string", "name": "pet"}}, {"name": "accounts", "type": {"type": "map", "values": "long", "name": "account"}}, {"name": "md5", "type": {"type": "fixed", "name": "md5", "size": 16}}, {"name": "favorite_colors", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "has_car", "type": "boolean", "default": false}, {"name": "country", "type": "string", "default": "Argentina"}, {"name": "address", "type": ["null", "string"], "default": null}]}', # noqa + '{"type": "record", "name": "UserAdvance", "fields": [{"name": "name", "type": "string"}, {"name": "age", "type": "long"}, {"name": "pets", "type": {"type": "array", "items": "string", "name": "pet"}}, {"name": "accounts", "type": {"type": "map", "values": "long", "name": "account"}}, {"name": "md_5", "type": {"type": "fixed", "name": "md_5", "size": 16}}, {"name": "favorite_colors", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "has_car", "type": "boolean", "default": false}, {"name": "country", "type": "string", "default": "Argentina"}, {"name": "address", "type": ["null", "string"], "default": null}]}', # noqa ), ( case.SPINALCASE, - '{"type": "record", "name": "UserAdvance", "fields": [{"name": "name", "type": "string"}, {"name": "age", "type": "long"}, {"name": "pets", "type": {"type": "array", "items": "string", "name": "pet"}}, {"name": "accounts", "type": {"type": "map", "values": "long", "name": "account"}}, {"name": "md5", "type": {"type": "fixed", "name": "md5", "size": 16}}, {"name": "favorite-colors", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "has-car", "type": "boolean", "default": false}, {"name": "country", "type": "string", "default": "Argentina"}, {"name": "address", "type": ["null", "string"], "default": null}]}', # noqa + '{"type": "record", "name": "UserAdvance", "fields": [{"name": "name", "type": "string"}, {"name": "age", "type": "long"}, {"name": "pets", "type": {"type": "array", "items": "string", "name": "pet"}}, {"name": "accounts", "type": {"type": "map", "values": "long", "name": "account"}}, {"name": "md-5", "type": {"type": "fixed", "name": "md-5", "size": 16}}, {"name": "favorite-colors", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "has-car", "type": "boolean", "default": false}, {"name": "country", "type": "string", "default": "Argentina"}, {"name": "address", "type": ["null", "string"], "default": null}]}', # noqa + ), + ( + case.UPPERSPINALCASE, + '{"type": "record", "name": "UserAdvance", "fields": [{"name": "NAME", "type": "string"}, {"name": "AGE", "type": "long"}, {"name": "PETS", "type": {"type": "array", "items": "string", "name": "PET"}}, {"name": "ACCOUNTS", "type": {"type": "map", "values": "long", "name": "ACCOUNT"}}, {"name": "MD-5", "type": {"type": "fixed", "name": "MD-5", "size": 16}}, {"name": "FAVORITE-COLORS", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "HAS-CAR", "type": "boolean", "default": false}, {"name": "COUNTRY", "type": "string", "default": "Argentina"}, {"name": "ADDRESS", "type": ["null", "string"], "default": null}]}', # noqa ), ( case.TRIMCASE, @@ -126,7 +135,7 @@ ), ( case.ALPHANUMCASE, - '{"type": "record", "name": "UserAdvance", "fields": [{"name": "name", "type": "string"}, {"name": "age", "type": "long"}, {"name": "pets", "type": {"type": "array", "items": "string", "name": "pet"}}, {"name": "accounts", "type": {"type": "map", "values": "long", "name": "account"}}, {"name": "md5", "type": {"type": "fixed", "name": "md5", "size": 16}}, {"name": "favorite_colors", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "has_car", "type": "boolean", "default": false}, {"name": "country", "type": "string", "default": "Argentina"}, {"name": "address", "type": ["null", "string"], "default": null}]}', # noqa + '{"type": "record", "name": "UserAdvance", "fields": [{"name": "name", "type": "string"}, {"name": "age", "type": "long"}, {"name": "pets", "type": {"type": "array", "items": "string", "name": "pet"}}, {"name": "accounts", "type": {"type": "map", "values": "long", "name": "account"}}, {"name": "md5", "type": {"type": "fixed", "name": "md5", "size": 16}}, {"name": "favoritecolors", "type": {"type": "enum", "name": "ColorEnum", "symbols": ["BLUE", "YELLOW", "GREEN"]}}, {"name": "hascar", "type": "boolean", "default": false}, {"name": "country", "type": "string", "default": "Argentina"}, {"name": "address", "type": ["null", "string"], "default": null}]}', # noqa ), ] @@ -163,6 +172,10 @@ case.SPINALCASE, '{"type": "record", "name": "UserAdvance", "fields": [{"name": "users", "type": {"type": "array", "items": {"type": "record", "name": "User", "fields": [{"name": "name", "type": "string"}], "namespace": "types.user"}, "name": "user"}}, {"name": "accounts", "type": {"type": "map", "values": "types.user.User", "name": "account"}}]}', # noqa ), + ( + case.UPPERSPINALCASE, + '{"type": "record", "name": "UserAdvance", "fields": [{"name": "USERS", "type": {"type": "array", "items": {"type": "record", "name": "User", "fields": [{"name": "NAME", "type": "string"}], "namespace": "types.user"}, "name": "USER"}}, {"name": "ACCOUNTS", "type": {"type": "map", "values": "types.user.User", "name": "ACCOUNT"}}]}', # noqa + ), ( case.TRIMCASE, '{"type": "record", "name": "UserAdvance", "fields": [{"name": "users", "type": {"type": "array", "items": {"type": "record", "name": "User", "fields": [{"name": "name", "type": "string"}], "namespace": "types.user"}, "name": "user"}}, {"name": "accounts", "type": {"type": "map", "values": "types.user.User", "name": "account"}}]}', # noqa