Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DanWertheimer opened this issue Apr 1, 2021 · 0 comments
Open

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

DanWertheimer opened this issue Apr 1, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@DanWertheimer
Copy link
Collaborator

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

@DanWertheimer DanWertheimer added the enhancement New feature or request label Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant