-
Notifications
You must be signed in to change notification settings - Fork 31
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: Adds IntEnum support #484
Conversation
- Generate IntEnum shapes - Moves shared enum casing logic to Utils so it can be easily shared - Updates test generator to sort members by lower camel case
var enumCaseName = CaseUtils.toCamelCase( | ||
name.orElseGet { | ||
value | ||
}.replace(Regex("[^a-zA-Z0-9_ ]"), "") | ||
) | ||
if (!SymbolVisitor.isValidSwiftIdentifier(enumCaseName)) { | ||
enumCaseName = "_$enumCaseName" | ||
} | ||
|
||
if (shouldBeEscaped && reservedWords.contains(enumCaseName)) { | ||
enumCaseName = SymbolVisitor.escapeReservedWords(enumCaseName) | ||
} | ||
|
||
return enumCaseName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import software.amazon.smithy.swift.codegen.model.nestedNamespaceType | ||
import java.util.* | ||
|
||
class IntEnumGenerator( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The contents of this file are mostly taken from the existing EnumGenerator with slight tweaks to support IntEnums specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need an accompanying PR for SDK to un-pin the Smithy version?
yep! will do that next! |
Issue #
Scope
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.