Skip to content

Commit

Permalink
Symbols with inVocab: false should still have avro-safe names (#477)
Browse files Browse the repository at this point in the history
* Symbols with inVocab: false should still have avro-safe names

Because the avro-safe names are now namespaced (they didn't used to
be) we no longer want "out of vocabulary" symbols to be added as URLs.
  • Loading branch information
tetron authored Nov 16, 2021
1 parent 51f2b92 commit e90a557
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion schema_salad/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def make_valid_avro(
# Possibly could be integrated into our fork of avro/schema.py?
if isinstance(items, MutableMapping):
avro = copy.copy(items)
if avro.get("name") and avro.get("inVocab", True):
if avro.get("name"):
if fielddef:
avro["name"] = avro_field_name(avro["name"])
else:
Expand Down
3 changes: 3 additions & 0 deletions schema_salad/tests/test_avro_names.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Avro related tests."""
from schema_salad.schema import load_schema
from schema_salad.avro.schema import Names

from .util import get_data

Expand All @@ -9,3 +10,5 @@ def test_avro_loading() -> None:
path = get_data("tests/test_schema/avro_naming.yml")
assert path
document_loader, avsc_names, schema_metadata, metaschema_loader = load_schema(path)
assert isinstance(avsc_names, Names)
assert avsc_names.get_name("com.example.derived_schema.ExtendedThing", None)

0 comments on commit e90a557

Please sign in to comment.