Skip to content

Describe the filter parameters - #1084

Merged
mevdschee merged 1 commit into
mainfrom
openapi-phase-4
Aug 28, 2026
Merged

mevdschee merged 1 commit into
mainfrom
openapi-phase-4

Conversation

@mevdschee

Copy link
Copy Markdown
Owner

Phase 4 of #1078, which closes #571 and replaces #980.

Only the plain filter parameter was in the document. A generated client had no way to express an "or" and no idea what the operators were, and the parameter that is there said nothing beyond id,eq,1.

The numbered and lettered variants can be repeated any number of times, but OpenAPI has no way to say that, every parameter has to be named. How many of them are described is therefore a setting: openApiFilterCount is the number of filter1 to filterN parameters and defaults to 3, openApiSubFilterCount is the number of lettered ones per numbered one and defaults to 0, since the full grid is a lot of parameters for something few APIs need. The ones that are not described still work, they are just not in the document.

They are appended after the other parameters of the operation rather than inserted next to filter, so the positions of the parameters that were already there do not shift. That is the objection the author of #980 raised against his own change.

The description of filter now lists the eleven operators, the n prefix that negates them, the eleven spatial operators (with the three that take no value marked as such) and the path syntax that filters on a related table. The numbered and lettered ones say how they combine into the condition tree.

The parameters of a list operation moved into OpenApiRecordParameters, which is where the components they refer to are written. The records builder and the geojson builder each had their own copy of the array plus the same text search append, so they could disagree about it.

The expected document grew from 131 KB to 136 KB, on sqlite from 122 KB to 126 KB.

Added tests/functional/001_records/108_filter_on_nested_or.log, which pins the semantics that the new descriptions claim. There was no test for the letter suffixed depth at all. filter1=category_id,eq,1&filter1a=id,eq,1&filter1b=id,eq,5 answers with two records where a flat reading of the letters would answer with ten.

Checked the parameter list of the record and geojson list operations with the two settings at 0, at their defaults and past the letter range.

Only the plain "filter" parameter was in the document, so a generated client had
no way to express an "or" and no idea what the operators were.

The numbered and lettered variants can be repeated any number of times, but
OpenAPI has no way to say that, every parameter has to be named. How many of
them are described is therefore a setting: "openApiFilterCount" is the number of
"filter1" to "filterN" parameters and defaults to 3, "openApiSubFilterCount" is
the number of lettered ones per numbered one and defaults to 0, as the full grid
of them is a lot of parameters for something that few APIs need. The ones that
are not described still work. They are appended after the other parameters, as a
client generated from the document may pass them by position, which is what the
review of #980 pointed out.

The description of "filter" now lists the operators, the "n" prefix that negates
them, the spatial operators and the path syntax that filters on a related table.
The numbered and lettered ones say how they combine.

The parameters of a list operation moved into OpenApiRecordParameters, which is
where the components they refer to are written, so the records builder and the
geojson builder cannot disagree about them.

Closes #571
@mevdschee
mevdschee merged commit dadaa3d into main Aug 28, 2026
@mevdschee mevdschee mentioned this pull request Aug 28, 2026
28 tasks
@mevdschee mevdschee self-assigned this Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for "filterX or groups" on OpenApi

1 participant