Skip to content

Conversation

@jsklan
Copy link
Contributor

@jsklan jsklan commented Jan 8, 2026

Description

Fixes an issue with the Go SDK generator's OAuth client-credentials flow where form params were not being attached to the GetToken request.

The newFormURLEncodedRequestBody function was using reflection to extract struct fields based on json tags, but this missed fields like grant_type that are added via custom MarshalJSON methods (private fields with no json tag).

Link to Devin run: https://app.devin.ai/sessions/8389b34fca664959a8935f69d4e1fd72
Requested by: @jsklan

Changes Made

  • Changed newFormURLEncodedRequestBody in caller.go_ template to marshal the request to JSON first (respecting custom MarshalJSON methods), then convert to form URL encoded values
  • Updated versions.yml with changelog entries for v1.22.3 and v1.22.4
  • Updated oauth-client-credentials and imdb:with-wiremock-tests seed fixture outputs

Updates Since Last Revision

  • Fixed wiremock port collisions in CI (v1.22.4): When running wire tests in parallel with --parallel 16, multiple wiremock containers were trying to bind to the same host port 8080
    • Changed docker-compose.test.yml to use ephemeral ports ("0:8080" instead of "8080:8080")
    • Updated WireTestGenerator.ts to generate test code that reads WIREMOCK_PORT env var with fallback to 8080
    • Updated seed.yml scripts to discover the assigned port using docker compose port wiremock 8080 and export it as WIREMOCK_PORT
    • Regenerated affected seed fixtures (imdb:with-wiremock-tests, oauth-client-credentials)

Testing

  • Ran pnpm seed:local test --generator go-sdk --fixture oauth-client-credentials - passed
  • Ran pnpm seed:local test --generator go-sdk --fixture imdb:with-wiremock-tests - passed
  • Ran pnpm run check - lint checks passed
  • Tested against customer's fern folder - generated code includes the fix

Review Checklist

  • Verify the JSON marshaling approach handles edge cases correctly (nested objects, arrays may serialize as JSON strings in form data)
  • Verify the port discovery command (docker compose port wiremock 8080 | cut -d: -f2) works correctly in CI environment
  • Verify the WIREMOCK_PORT fallback to 8080 works for local development without docker
  • Consider if other fixtures using form URL encoding should be tested for regressions

devin-ai-integration bot and others added 2 commits January 8, 2026 19:31
…thods

Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@fern-support fern-support enabled auto-merge (squash) January 8, 2026 21:55
jsklan and others added 5 commits January 8, 2026 16:59
…names

The previous fix used $(basename $(pwd)) which returns 'generated' because
the script runs from the 'generated' subdirectory inside the container.
Changed to $(basename $(dirname $(pwd))) to get the actual fixture name
and prevent parallel test conflicts.

Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
Docker-compose project names must consist only of lowercase alphanumeric
characters, hyphens, and underscores. The fixture name 'oauth-client-credentials_.'
contains a period which is invalid. Added 'tr -d .' to remove periods from
the project name.

Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
…lisions

- Change docker-compose.test.yml to use ephemeral ports (0:8080) instead of fixed port 8080
- Update generated test code to read WIREMOCK_PORT env var with fallback to 8080
- Update seed.yml scripts to discover assigned port and export WIREMOCK_PORT
- Regenerate affected seed fixtures (imdb:with-wiremock-tests, oauth-client-credentials)

Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
@fern-support fern-support merged commit 8e4ba06 into main Jan 8, 2026
135 checks passed
@fern-support fern-support deleted the devin/1767900524-fix-go-oauth-form-params branch January 8, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants