Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change type and add parameter guard for language in magic link options #124

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

ctran88
Copy link
Contributor

@ctran88 ctran88 commented Jan 8, 2025

What's New?

  • runs codegen updates against latest published schema (using GHA artifact instead of SwaggerHub, which isn't updated)
    • the codegen changes also drop the AppInfo types since the last codegen in CI failed to run
  • updates MagicLinkOptions.Language type
  • adds parameter guard to check language value against enum

Screenshots (if appropriate):

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have manually tested my code thoroughly
  • I have added/updated inline documentation for public facing interfaces if relevant
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing integration and unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional context

@ctran88 ctran88 force-pushed the PSG-5701-use-language-enum branch from 4d019a5 to a2deba6 Compare January 9, 2025 01:00
@ctran88 ctran88 marked this pull request as ready for review January 9, 2025 01:01
@ctran88 ctran88 changed the title chore: codegen update feat: change type and add parameter guard for language in magic link options Jan 9, 2025
auth.go Outdated
Comment on lines 172 to 178
validLanguages := []MagicLinkLanguage{De, En, Es, It, Pl, Pt, Zh}

for _, l := range validLanguages {
if l == language {
return nil
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that the SDK is using Go 1.21, the slices package is available (release note), so this could be simplified to:

import "slices"

validLanguages := []MagicLinkLanguage{De, En, Es, It, Pl, Pt, Zh}

if slices.Contains(validLanguages, language) {
    return nil
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦 630b223

@ctran88 ctran88 merged commit afb86ea into main Jan 10, 2025
6 checks passed
@ctran88 ctran88 deleted the PSG-5701-use-language-enum branch January 10, 2025 20:37
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.

3 participants