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

Allow null and primitive values in an Extension #1040

Merged
merged 3 commits into from Jul 31, 2021
Merged

Conversation

mhyeun
Copy link
Contributor

@mhyeun mhyeun commented Jul 23, 2021

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you written unit tests?
  • Have you written unit tests that cover the negative cases (i.e.: if bad data is submitted, does the library respond properly)? (Already existed as InvalidExtensionControllerGenerator test suite)
  • This PR is associated with an existing issue?

Closing issues

Closes #958.

Test plan

Updated the Extension data being used in methodController.ts and updated the tests in metadata.spec.ts, schemaDetails.spec.ts and schemaDetails3.spec.ts. These tests now include null, primitive values, and their usage in objects and arrays.

@mhyeun mhyeun changed the title Allow null and primitive values for Extension values Allow null and primitive values in an Extension Jul 23, 2021
@@ -39,6 +39,8 @@ export const getInitializerValue = (initializer?: ts.Expression, typeChecker?: t
return dateString;
}
return;
case ts.SyntaxKind.NullKeyword:
return null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without this case, null would fall to the default case, being returned as undefined.

@WoH
Copy link
Collaborator

WoH commented Jul 31, 2021

LGTM, congrats and thank you for your first contribution!

@WoH WoH merged commit a202ded into lukeautry:master Jul 31, 2021
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.

Extensions don't allow scalar / primitive values
2 participants