fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.69k stars 151 forks source link

feat(go): Add inlinePathParameters configuration #5244

Closed amckinney closed 11 hours ago

amckinney commented 12 hours ago

This adds the new inlinePathParameters configuration option so that users can generate their in-lined request types to contain the path parameters specified by the endpoint (which are generated as positional parameters by default).

With this, users are now presented with path parameter endpoint signatures that look like the following:

func (c *Client) GetUser(
    ctx context.Context,
    request *acme.GetUserRequest,
    opts ...option.RequestOption,
) error {
        ...
}

Note that this also updates a couple other minor details:

  1. Updates the Dynamic IR to contain the includePathParameters and onlyPathParameters fields in the InlinedRequest.
  2. Updates the DynamicSnippetsGenerator to fix the dynamic snippets produced when this configuration is toggled.
    • Note that a follow-up is required to use the new configuration introduced in the PR here (denoted by a TODO).
  3. Updates the AbstractDynamicSnippetGeneratorContext to reference the same IR version.
    • This is a temporary fix - in a follow-up, we'll remove the constraint that the two IR versions are consistent between these packages.
github-actions[bot] commented 12 hours ago

🌿 Preview your docs: https://fern-preview-4e103306-ed8b-4299-876b-5afdda6171be.docs.buildwithfern.com/learn