Skip to content

Conversation

@elasticmachine
Copy link
Collaborator

@elasticmachine elasticmachine commented Feb 26, 2025

This codegen PR applies new logic to how each API function determines where to put passed parameters.

Up to now the logic has been as follows:

  1. if recognized as a body param from the spec, put it in the JSON body
  2. if recognized as a path param, put it in the URL path
  3. otherwise, put it in the querystring

For 9.x and from this PR forward, the logic changes to:

  1. if recognized as a body param from the spec, put it in the JSON body
  2. if recognized as a path param, put it in the URL path
  3. if recognized as a query param or a "common" query param (e.g. pretty, error_trace), put it in the querystring
  4. if not recognized and this API accepts a JSON body, put it in the JSON body
  5. if not recognized and this API does not accept a JSON body, put it in the querystring

This change also updates each API function to only instantiate its arrays of accepted body/path/query param names once per client instance rather than during every function call, by moving the array values up to the constructor or module, depending on which is available.

This change is being made as part of the solution to #2584.

@JoshMock JoshMock merged commit 6f9e106 into main Feb 26, 2025
21 of 22 checks passed
@JoshMock JoshMock deleted the generates_main_code branch February 26, 2025 18:31
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