Skip to content

feat: add region support to config, generator, templates and testapi - #38

Merged
cvejk merged 3 commits into
masterfrom
feature/region-support
Jul 2, 2026
Merged

cvejk merged 3 commits into
masterfrom
feature/region-support

Conversation

@cvejk

@cvejk cvejk commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds support for Contentful's EU infrastructure region. The region can be specified via the -region flag or the region field in the config YAML. When set, the generated client code calls .SetRegion() on all client modes (CDA, CPA, CMA) as well as the offline client.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation
  • ♻️ Refactoring
  • ⚡ Performance
  • ✅ Tests
  • 🔧 Build/CI

Changes

  • Added Region field to Config struct
  • Added -region CLI flag to main.go
  • GenerateAPI now validates the region via contentful.ParseRegion and passes it to the template
  • Template (contentful_vo_lib.gotmpl) conditionally emits .SetRegion() in both getContentfulAPIClient and NewOfflineContentfulClient
  • Added generator tests covering EU region, empty region, and invalid region inputs
  • Regenerated test/testapi to reflect the refactored getContentfulAPIClient function

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.

Notes

This PR depends on foomo/contentful#20 which adds the SetRegion/ParseRegion API. Once that PR is merged and a new release is cut, the contentful dependency version in go.mod should be bumped accordingly.

@cvejk
cvejk requested a review from cvidmar July 1, 2026 14:55

@cvidmar cvidmar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cvejk
cvejk merged commit ed4ae02 into master Jul 2, 2026
4 checks passed
@cvejk
cvejk deleted the feature/region-support branch July 2, 2026 07:47
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.

2 participants