Skip to content

Commit

Permalink
connector_importer: take full control of what are the required_keys
Browse files Browse the repository at this point in the history
Not forcing required default value if required_keys_ignore_mapper and required_keys are defined in options.mapper.
Adding the new property required_keys_ignore_mapper in order to override the result of required_keys function
  • Loading branch information
Ricardoalso committed Sep 12, 2024
1 parent 1f53e3f commit b40334a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions connector_importer/components/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,16 @@ def required_keys(self, create=False):
"""
req = dict(self.required)
req.update(self.work.options.mapper.get("required_keys", {}))

if self.required_keys_ignore_mapper:
req = self.work.options.mapper.get("required_keys", {})

Check warning on line 59 in connector_importer/components/mapper.py

View check run for this annotation

Codecov / codecov/patch

connector_importer/components/mapper.py#L59

Added line #L59 was not covered by tests

return req

@property
def required_keys_ignore_mapper(self):
return self.work.options.mapper.get("required_keys_ignore_mapper", False)

translatable = []

def translatable_keys(self, create=False):
Expand Down

0 comments on commit b40334a

Please sign in to comment.