Skip to content

feat(api chart): allow customizing api chart with query or body parameters#278

Open
arnaud-moncel wants to merge 2 commits intomainfrom
feat/params-in-chart
Open

feat(api chart): allow customizing api chart with query or body parameters#278
arnaud-moncel wants to merge 2 commits intomainfrom
feat/params-in-chart

Conversation

@arnaud-moncel
Copy link
Member

@arnaud-moncel arnaud-moncel commented Mar 18, 2026

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

Note

Pass query/body parameters to API chart handlers in collection and datasource routes

  • Adds QueryStringParser.parse_chart_parameters to extract scalar request params (filtering out nil, Hash, and Array values) as a normalized string hash.
  • Passes the parsed parameters as an extra argument to render_chart on both collection and datasource routes, threading through all decorator and base class signatures.
  • Introduces DatasourceChartContext for datasource-level chart handlers and extends ChartContext with a frozen parameters attribute, making request params accessible inside chart handler blocks.
  • Behavioral Change: render_chart signatures across Collection, Datasource, CollectionDecorator, DatasourceDecorator, CompositeDatasource, and their chart decorators now accept an optional parameters hash; existing handlers without a parameters argument are unaffected due to the default value.

Macroscope summarized a4b4ebf.

@qltysh
Copy link

qltysh bot commented Mar 18, 2026

4 new issues

Tool Category Rule Count
qlty Structure Function with many parameters (count = 4): render_chart 4

end

def render_chart(caller, name, record_id)
def render_chart(caller, name, record_id, parameters = {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with many parameters (count = 4): render_chart [qlty:function-parameters]

attr_reader :composite_record_id, :parameters

def initialize(collection, caller, record_id)
def initialize(collection, caller, record_id, parameters = {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with many parameters (count = 4): initialize [qlty:function-parameters]

end

def render_chart(_caller, name, _record_id)
def render_chart(_caller, name, _record_id, _parameters = {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with many parameters (count = 4): render_chart [qlty:function-parameters]


def render_chart(caller, name, record_id)
@child_collection.render_chart(caller, name, record_id)
def render_chart(caller, name, record_id, parameters = {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with many parameters (count = 4): render_chart [qlty:function-parameters]

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.

1 participant