diff --git a/msc_pygeoapi/provider/msc_dms.py b/msc_pygeoapi/provider/msc_dms.py index 63a069d8..e7ce4944 100644 --- a/msc_pygeoapi/provider/msc_dms.py +++ b/msc_pygeoapi/provider/msc_dms.py @@ -100,6 +100,9 @@ def __init__(self, provider_def): LOGGER.debug('Grabbing field information') self.fields = self.get_fields() + self.sortables = [sortable for sortable + in provider_def.get('sortables', [self.time_field])] + def get_fields(self): """ Get provider field information (names, types) @@ -243,8 +246,9 @@ def query( sort_by_values = [] for sort in sortby: # only allow sort on time_field - if sort['property'] != self.time_field: - msg = f'Sorting only enabled for {self.time_field}' + if sort['property'] not in self.sortables: + msg = f'Sorting only enabled for {self.sortables}' + LOGGER.error(msg) raise ProviderQueryError(msg) LOGGER.debug(f'processing sort object: {sort}') sort_property = f'{sort["order"]}properties.{sort["property"]}'