Skip to content

Users should be able to define their own schema namespace #46

@DanWertheimer

Description

@DanWertheimer

Currently, users have their namespace automatically created for them at python.kafka.modelname

py2k/py2k/record.py

Lines 66 to 80 in 14d82e5

@staticmethod
def schema_extra(schema: Dict[str, Any],
model: Type['KafkaRecord']) -> None:
schema['type'] = 'record'
schema['name'] = schema.pop('title')
schema['namespace'] = (f'python.kafka.'
f'{schema["name"].lower()}')
schema = process_properties(schema)
schema.pop('properties')
# Dynamically generated schemas might not have this field,
# which is removed anyway.
if 'required' in schema:
schema.pop('required')
update_optional_schema(schema=schema, model=model)

We should allow users to define their own namespace.

something like,

class MyRecord(KafkaRecord):
    name: str
    
    @property
    def namespace():
        return 'my.name.space'

or as an argument to PandasToRecordsTransformer

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions