Prettify OpenAPI filter descriptions for the read-only API - #636
Draft
joshdimanteto wants to merge 1 commit into
Draft
joshdimanteto wants to merge 1 commit into
joshdimanteto wants to merge 1 commit into
Conversation
The filter descriptions rendered in the OpenAPI docs were dense single-paragraph blobs, built by `.format()`-ing pre-baked strings that each caller had to hand-write its field list into. This reworks them into Markdown-formatted descriptions generated by helper functions. Why this reads better in the docs: - Operators are now a bulleted list with one operator per line and its aliases grouped together (`neq` / `ne`), instead of a run-on sentence of fifteen comma-separated pairs. - Field lists, formats and examples are labelled with bold headings (**Queryable fields:**, **Format:**, **Example:**) so a reader can find the bit they need without parsing the whole paragraph. - Field names and operators are rendered as inline code spans rather than 'single quotes', so they stand out against prose. - The `where` description now includes a concrete worked example built from the entity's first queryable field. - Added the missing `nilike` operator and documented the `isnull` true/false semantics, which the old text left unexplained. Why this is nicer to maintain: - `WHERE_DESCRIPTION.format(queryable_fields="'a', 'b', and 'c'")` is replaced by `where_description(ENTITY_QUERYABLE_FIELDS)`. Callers now declare their fields as a tuple of plain names and the formatting (quoting, comma joining) happens in one place. - That also fixes a latent bug in investigation.py, where the queryable field list had a stray trailing comma and was being passed as a tuple, so the docs rendered the Python tuple repr instead of the field list. - `skip`, `limit` and `distinct` descriptions are pulled out into module-level constants alongside the others, so all the filter copy lives in common.py rather than being scattered inline. The prettifying pass here was done by Claude. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DO NO MERGE THIS IN. THIS IS JUST FOR VIEWING
The filter descriptions rendered in the OpenAPI docs were dense single-paragraph blobs, built by
.format()-ing pre-baked strings that each caller had to hand-write its field list into. This reworks them into Markdown-formatted descriptions generated by helper functions.Why this reads better in the docs:
neq/ne), instead of a run-on sentence of fifteen comma-separated pairs.wheredescription now includes a concrete worked example built from the entity's first queryable field.nilikeoperator and documented theisnulltrue/false semantics, which the old text left unexplained.Why this is nicer to maintain:
WHERE_DESCRIPTION.format(queryable_fields="'a', 'b', and 'c'")is replaced bywhere_description(ENTITY_QUERYABLE_FIELDS). Callers now declare their fields as a tuple of plain names and the formatting (quoting, comma joining) happens in one place.skip,limitanddistinctdescriptions are pulled out into module-level constants alongside the others, so all the filter copy lives in common.py rather than being scattered inline.The prettifying pass here was done by Claude.
DO NO MERGE THIS IN. THIS IS JUST FOR VIEWING