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

Fails if invalid custom types are specified #84

Merged

Conversation

shuheiktgw
Copy link
Collaborator

Please read the contribution guidelines and the CLA carefully before
submitting your pull request.

https://cla.developers.google.com/

Currently, the yo command succeeds even if non-existing custom type tables or columns are specified. This behavior makes it hard for users to notice misconfiguration in their custom types. It would be great if yo would validate their existence so I implemented the logic. Thank you for your review!

@shuheiktgw shuheiktgw force-pushed the custom_type_validation branch 3 times, most recently from 3140d0c to d73d3ce Compare December 18, 2021 05:21
@@ -26,5 +26,5 @@ tables:
- name: "FullTypes"
columns:
FTInt: "int32"
FTInitNull: "uint64"
FTIntNull: "uint64"
Copy link
Collaborator Author

@shuheiktgw shuheiktgw Dec 18, 2021

Choose a reason for hiding this comment

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

I've fixed this typo then it raises an error since yo tries to convert spanner.NullInt64 into uint64. What should I do to resolve the problem? 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, it seems broken in this type conversion. Please just remove this line from the yaml for now.


// validate custom type columns
if columnTypes != nil {
columnSet := map[string]bool{}
Copy link
Collaborator

@kazegusuri kazegusuri Dec 20, 2021

Choose a reason for hiding this comment

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

super nit: good to use map[string]struct{}{} when the value is meaningless, then substitute struct{}{} instead of true

@shuheiktgw
Copy link
Collaborator Author

@kazegusuri Updated it! Would you review the PR again? 🙏

@kazegusuri kazegusuri merged commit f04de87 into cloudspannerecosystem:master Jan 12, 2022
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.

None yet

2 participants