-
Notifications
You must be signed in to change notification settings - Fork 63
fix: stop pascal casing enums for MIS #931
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
Conversation
@@ -305,7 +305,7 @@ export class AppSyncSwiftVisitor< | |||
.asKind('enum') | |||
.access('public') | |||
.withProtocols(['String', 'EnumPersistable']) | |||
.withName(this.getEnumName(enumValue)); | |||
.withName(pascalCase(this.getEnumName(enumValue))); |
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.
Is there a swift test case?
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.
@@ -143,6 +147,10 @@ describe('Model Introspection Visitor', () => { | |||
expect((visitor as any).getType('SimpleInterface')).toEqual({ interface: 'SimpleInterface' }); | |||
}); | |||
|
|||
it('should not pascal case enum', () => { | |||
expect((visitor as any).getType('camel')).toEqual({ enum: 'camel' }) |
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.
Can we test with a two word name like camelCase
to ensure that Case
is still capitalized?
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.
Addressed in aea768b
5ff2728
to
aea768b
Compare
Description of changes
Codegen currently pascal cases enums defined in the GraphQL schema.
Gen 2 doesn't pascal case top-level enums:
generates:
This naming discrepancy hasn't caused problems yet because:
But we create a wrapper input type for all model generated queries. So the actual GraphQL mutation here uses CreateTodoInput + Variables and never mentions the
foo
type.This changes with the custom type / enum input for custom operation work in progress.
will generate a GraphQL query like:
because there isn’t a wrapper input type.
Note
This change only applies to the model introspection schema.
Codegenerated enums are still pascal cased because changing that will cause a breaking change if the schema defined enum casing doesn't match. Non-MIS consuming clients (e.g. native codegen) doesn't support custom operations, so the feature motivating this change doesn't apply.
Codegen Paramaters Changed or Added
Issue #, if available
N/A
Description of how you validated changes
Note
Two Gen 2 related E2Es are failing in this run, but they have been failing for a long time and the failures are unrelated. I'm unsure of when the change causing these failures was introduced. The only way I've been able to repro the failure locally is by running
yarn e2e ...
instead ofnpm e2e ...
, which results in both yarn.lock and package-lock.json files being generated in the project root. This in turn causes an error when deploying and mimics the observed failures in CloudBuild runs.Checklist
yarn test
passesRelevant documentation is changed or added (and PR referenced)Breaking changes to existing customers are released behind a feature flag or major version updateChanges are tested using sample applications for all relevant platforms (iOS/android/flutter/Javascript) that use the feature added/modifiedChanges are tested on windows. Some Node functions (such aspath
) behave differently on windows.type
,input
,enum
,interface
,union
and scalar types.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.