Argus icon indicating copy to clipboard operation
Argus copied to clipboard

Fix openapi parameters for incidents/ and incidents/mine

Open elfjes opened this issue 6 months ago • 3 comments

I noticed a discrepancy between the (filtering) parameters that are accepted in the incidents/ and incidents/mine. Namely

"tags=" was not a documented parameter "id__in=" was a documented parameter for incidents/mine but in SourceLockedIncidentFilter this filter is not available

This was non-obvious due to the way that INCIDENT_OPENAPI_PARAMETER_DESCRIPTIONS and SOURCE_LOCKED_INCIDENT_OPENAPI_PARAMETER_DESCRIPTIONS were defined. I restructured those lists by splitting them up in components based on where there implementation is defined (IncidentFilter, IncidentFilter.Meta, SourceLockedIncidentFIlter.Meta etc) and ordered them according to their implementation order. I then combined them as appropiate and sort the resulting lists.

This resulted in some deduplication and I could detect and fix the aforemention discrepancy

Then I noticed that the openapi documentation for incidents/mine was incorrect and it showed all parameters (also those for filtering by source), so I fixed that. This also showed that there were some more differences between those endpoints

  • SourceLockedIncidentViewSet does not support search
  • SourceLockedIncidentViewSet has different prefetches (which may impact performance)

However, I did not change that because I did not want to change actual behaviour

elfjes avatar Jul 31 '24 13:07 elfjes