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

Adding a new enum value to GraphQL schema is not backwards compatible #349

Open
admund opened this issue Jun 11, 2021 · 1 comment
Open
Labels
codegen feature-request Request a new feature

Comments

@admund
Copy link

admund commented Jun 11, 2021

Describe the bug
I'm adding a new enum value to my GraphQL schema and I'm starting sending it. My older version apps crash or not work properly, because auto generated pares can handle that. It's done that way:

        final MyEnum something;
        if (somethingStr != null) {
          something = MyEnum.valueOf(somethingStr);
        } else {
          something = null;
        }

And valueOf will throw exception if it will get unknown value.

Expected behavior
if we just catch exception and return null, everything will keep working.

        MyEnum something = null;
        if (somethingStr != null) {
          try {
            something = MyEnum.valueOf(something);
          } catch (IllegalArgumentException exception) {
            // some log?
          }
        }

Environment(please complete the following information):

  • AppSync SDK Version: 3.1.4

Additional context
I'm not sure if this is AppSync problem or GraphQL which is used here. If second option, maybe AppSync should update this lib to newer one. From iOS team I know that this is working correctly with their AppSync SDK.

@ksgangadharan
Copy link

Hi, we are facing the same issue in our android app. As @admund suggested, we just need to catch the exception and set the field to null. Especially if we are doing a list query of say 100 records, even if one record has an unrecognised enum value, the entire 100 records do not get processed.

@sktimalsina sktimalsina added the feature-request Request a new feature label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

4 participants