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 inlineFileProperties configuration #5202

Closed amckinney closed 3 days ago

amckinney commented 3 days ago

This adds the new inlineFileProperties configuration option so that users can generate their in-lined request types to contain the io.Reader file properties (which are generated as positional parameters by default).

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

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

Note that this also updates a couple other minor details:

  1. Updates the internal.MultipartWriter abstraction to expose a WithDefaultContentType option.
    • This is primarily meant to simplify the generated code.
  2. Fix an issue where the internal.MultipartWriter utilities were unnecessarily generated for SDKs that don't define any multipart/form-data endpoints.
github-actions[bot] commented 3 days ago

🌿 Preview your docs: https://fern-preview-0fe10c4c-e4d6-4ddd-b297-2899f4e77593.docs.buildwithfern.com/learn