def get_schema_fields()

in ees_sharepoint/sync_sharepoint.py [0:0]


    def get_schema_fields(self, document_name):
        """returns the schema of all the include_fields or exclude_fields specified in the configuration file.
        :param document_name: document name from SITES, LISTS, LIST_ITEMS OR DRIVE_ITEMS
        Returns:
            schema: included and excluded fields schema
        """
        fields = self.objects.get(document_name)
        adapter_schema = adapter.DEFAULT_SCHEMA[document_name]
        field_id = adapter_schema["id"]
        if fields:
            include_fields = fields.get("include_fields")
            exclude_fields = fields.get("exclude_fields")
            if include_fields:
                adapter_schema = {
                    key: val
                    for key, val in adapter_schema.items()
                    if val in include_fields
                }
            elif exclude_fields:
                adapter_schema = {
                    key: val
                    for key, val in adapter_schema.items()
                    if val not in exclude_fields
                }
            adapter_schema["id"] = field_id
        return adapter_schema