I think this makes sense as generally an identifier part may not start with a 
number (2 here). I’m unfamiliar with the influence that a schema’s namespace 
has on code generation in Python but this makes sense from the Java perspective 
at least.

—Ivan

> On Sep 26, 2019, at 1:20 PM, Neil McBride 
> <[email protected]> wrote:
> 
> Apologies Ivan, I used a bad example. A specific case is where the name =
> "ADFORM__DELIVERY" and the namespace = "io.2sixty":
> 
>>>> fullname='io.2sixty.ADFORM__DELIVERY'
>>>> _RE_FULL_NAME = re.compile(
> ...     r'^'
> ...     r'[.]?(?:[A-Za-z_][A-Za-z0-9_]*[.])*'  # optional namespace
> ...     r'([A-Za-z_][A-Za-z0-9_]*)'            # name
> ...     r'$'
> ... )
>>>> print(_RE_FULL_NAME.match(fullname))
> None
> 
> On Thu, 26 Sep 2019 at 19:09, Ivan Greene <[email protected]> wrote:
> 
>> In a Python 3 repl, a full name like ‘org.apache.avro.ipc.Foo’ matches
>> this pattern. It looks like the pattern you suggest is not used to prevent
>> repeating full stops.
>> 
>> —Ivan
>> 
>>> On Sep 26, 2019, at 12:42 PM, Neil McBride
>> <[email protected]> wrote:
>>> 
>>> Hello,
>>> 
>>> We're unable to make use of the Python 3 Avro package as it does not
>> allow
>>> full stops within the namespace; they will fail with "Invalid schema name
>>> %r infered from name %r and namespace %r.". An example namespace is
>>> org.apache.avro.ipc.
>>> 
>>> The regex is in:
>>> 
>>> https://github.com/apache/avro/blob/master/lang/py3/avro/schema.py#L236
>>> 
>>> _RE_FULL_NAME = re.compile(
>>>   r'^'
>>>   r'[.]?(?:[A-Za-z_][A-Za-z0-9_]*[.])*'  # optional namespace
>>>   r'([A-Za-z_][A-Za-z0-9_]*)'            # name
>>>   r'$'
>>> )
>>> 
>>> Is there a reason why the validation for _RE_FULL_NAME could not be
>>> r'[A-Za-z_][A-Za-z0-9_.]*
>>> 
>>> Thanks
>> 
>> 

Reply via email to