Skip to content

Conversation

@jeffreyaven
Copy link
Member

Adds queryParamPushdown configuration option to x-stackQL-config enabling SQL clause pushdown to API query parameters
Supports OData dialect with sensible defaults and custom API dialects for flexible integration
Configuration can be set at provider, service, resource, or method level with lower-level config overriding higher-level

Supported Pushdown Options

  • $select - Column projection (SELECT clause)
  • $filter - Row filtering (WHERE clause) with supportedOperators and supportedColumns
  • $orderby - Ordering (ORDER BY clause)
  • $top - Row limit (LIMIT clause) with optional maxValue cap
  • $count - Count support (SELECT COUNT(*))

Test plan

  • Unit tests in query_param_pushdown_test.go cover OData defaults, custom dialects, and column/operator validation
  • Integration test TestQueryParamPushdownConfig validates configuration loading from TripPin provider
  • TripPin test provider demonstrates full OData support, restricted columns, and maxValue constraints

…te pushdown

This adds support for configuring SQL clause pushdown to API query parameters,
enabling providers to specify which SQL operations (SELECT columns, WHERE filters,
ORDER BY, LIMIT, COUNT) can be translated to native API query parameters.

Features:
- Support for OData dialect with sensible defaults ($filter, $select, $orderby, $top, $count)
- Support for custom API dialects with configurable parameter names and syntax
- Per-clause configuration (select, filter, orderBy, top, count)
- Supported operators and columns lists for fine-grained control
- Hierarchical config at provider/service/resource/operation levels

New files:
- anysdk/query_param_pushdown.go: Core types and interfaces
- anysdk/query_param_pushdown_test.go: Unit tests

Updated:
- anysdk/config.go: Added GetQueryParamPushdown to StackQLConfig interface
- .claude/skills/stackql-provider-development.md: Added documentation
- cicd/tools/api/exported_funcs.txt: Added GetTestingQueryParamPushdown
- Add cloudpricing provider with Azure Retail Prices API spec to
  test/registry/unsigned-src/ for testing queryParamPushdown config
- Add TestQueryParamPushdownConfig test that validates:
  - OData filter config with supported operators and columns
  - OData select config
  - OData orderBy config with supported columns
  - Proper handling of unconfigured options (top, count)
- Add test function to exported_funcs.txt
Azure Retail Prices API only supports:
- $filter with 'eq' operator only
- Filterable columns: armRegionName, location, meterId, meterName,
  productId, skuId, productName, skuName, serviceName, serviceId,
  serviceFamily, priceType, armSkuName

Does NOT support: $select, $orderby, $top, $count

Updated test assertions accordingly.
Switch to OData TripPin reference service for testing queryParamPushdown
configuration. TripPin provides full OData support including $filter,
$select, $orderby, $top, and $count, making it ideal for comprehensive
testing.

Changes:
- Remove cloudpricing test provider (limited to $filter only)
- Add odata_trippin provider with three resources demonstrating
  different pushdown configurations
- Update registry_test.go with comprehensive TripPin assertions
- Update skill documentation with TripPin example
Add new exported interfaces and test functions to API snapshot files:
- CountPushdown, FilterPushdown, OrderByPushdown, QueryParamPushdown,
  SelectPushdown, TopPushdown interfaces
- Test functions for pushdown configuration validation

Document new API additions in docs/future_api.md per CI requirements.
The test was using 'ok' variable for both FindMethod (which returns error)
and GetQueryParamPushdown (which returns bool). Go's variable shadowing with
:= caused type conflicts when the same variable name was reused across
different return types.

Fix by using unique variable names:
- methodErr for FindMethod error returns
- qppExists, filterExists, etc. for bool returns from pushdown getters
The path /People('{UserName}') uses OData parentheses notation which
is not supported by the OpenAPI path parser. Remove this path and its
resource references since the queryParamPushdown test only needs the
list endpoints.
The StackQLConfig field in standardOpenAPIOperationStore expects the
config to be at the method level, not the resource level. This moves
the queryParamPushdown configuration from each resource's config
block into the methods.list.config block where it will be properly
parsed.
- Create docs/provider_spec.md: comprehensive provider anatomy documentation
  covering hierarchy, config options, SQL verb mapping, inheritance, and
  all OpenAPI extensions
- Update skill file to clarify that queryParamPushdown must be at method
  level (no inheritance from resource/service/provider levels)
- Fix OData example in skill to show config at method level
Implement inheritance for queryParamPushdown configuration, following the
same pattern as other config options (pagination, requestTranslate, etc.):

  Method → Resource → Service → ProviderService → Provider

Changes:
- Add GetQueryParamPushdown() to OperationStore interface with inheritance
- Add GetQueryParamPushdown() to Provider, ProviderService, Resource interfaces
- Add getQueryParamPushdown() to OpenAPIService interface
- Update test provider to demonstrate all three inheritance levels:
  - Service-level: airlines (inherits from x-stackQL-config)
  - Resource-level: people (overrides service-level)
  - Method-level: airports (overrides service-level)
- Update skill file and provider_spec.md documentation

This enables setting a default OData config at the service level for
providers like EntraID, avoiding repetitive config at every method level.
@jeffreyaven jeffreyaven deleted the claude/add-odata-config-option-01TFLCZJNDDC2ZhhusydBXTG branch November 30, 2025 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants