Skip to content

feat: custom schema #30

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

darthmiguel
Copy link

  • add custom schema flag to the config
  • refactor toStruct method
  • refactor toStruct implementation StringStructConverter
  • refactor toStruct implementation JsonStructConverter
  • ConverterUtils, methods to extract the schema from the record value

* add custom schema flag to the config
* refactor toStruct method
* refactor toStruct implementation StringStructConverter
* refactor toStruct implementation JsonStructConverter
* ConverterUtils, methods to extract the schema from the record value
Struct messageStruct = getStruct(message);
String topic = getTopic(message);
String db = getDB(message);
String timestamp = getTimestamp(message);
records.add(new SourceRecord(Collections.singletonMap("mongodb", db), Collections.singletonMap(db, timestamp), topic, messageStruct.schema(), messageStruct));
Object objectKey = ((Map<String, Object>) message.get("o")).get("_id");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please clean up the extraneous whitespace here and at line 152?

}

try{
customSchema = Boolean.parseBoolean(map.get(MongodbSourceConfig.CUSTOM_SCHEMA));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest making the boolean optional (check for existence with map.containsKey()), and if not specified, default to false to allow the original behavior. The new behavior will be opt-in then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants