stripe-go 27.0.0: form tags and cleanup (please test upgrades!)

380 views
Skip to first unread message

Brandur

unread,
Sep 19, 2017, 1:16:18 PM9/19/17
to Stripe API Announcements
Hi api-announce@,

We've recently released two major version increments for
stripe-go: 26.0.0 and 27.0.0. The latter is a very minor
breaking change, but we've still incrementing the major
version in accordance with semver. See the changelog [1]
for details.

26.0.0 contains a few changes to the Go API that are
breaking, but they're largely for cleanup purposes (for
example, `FraudReport` under `ChargeParams` becomes
`FraudDetails` to better reflect how the API works). It
does however come with some internals that have been
significantly reworked through the introduction of a new
`form` package [2]. This allows us to tag fields on
parameter structs in a way that's reminiscent of
`encoding/json`:

    type ChargeParams struct {
        Params        `form:"*"`
        Amount        uint64              `form:"amount"`
        Currency      Currency            `form:"currency"`

        ...
    }

By doing so, we get to remove boilerplate that had to be
written for every field that needed encoding:

if len(params.Amount) > 0 {
body.Add("amount", strconv.FormatUint(params.Amount, 10))
}

This change will make new features faster to write and is
far less prone to the copy paste and omission problems that
plagued the old implementation. However, although we've
written extensive tests and run QA, there is still some
risk that we missed something. **Please be cautious when
upgrading and test as extensively as possible!**

In addition to the `form` package, the test suite has been
upgraded and many of its long-standing problems fixed. This
will make it easier to catch regressions, and should
further lower the bar to contribution. We have a few more
ideas for changes as well to help move stripe-go to being a
first-class member of the Go ecosystem, and will continue
to work on those.

In the meantime, if you encounter any problems or have any
feedback, let us know!

Thanks,
Brandur


Reply all
Reply to author
Forward
0 new messages