-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: Use field name in json type schema if json tag is missing #2011
Conversation
I think this impacts the behaviour of the |
I'll do that. Also added an option so plugins can override this. It's required for Azure that doesn't use |
Also opened Azure/azure-sdk-for-go#23882 |
I'll just verify the |
OK so it changes the nested columns names in AWS with the JSON flattener We could make it so the Regardless don't think this should block this PR |
🤖 I have created a release *beep* *boop* --- ## [4.72.2](v4.72.1...v4.72.2) (2024-12-19) ### Bug Fixes * Use field name in json type schema if json tag is missing ([#2011](#2011)) ([7ca8009](7ca8009)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
#### Summary I think we want all columns to be snake case for consistency. Also helps with cloudquery/plugin-sdk#2011 ### Before ![image](https://github.com/user-attachments/assets/c3cdd366-a8a1-4b3f-b4f4-14aa360716da) ### After ![image](https://github.com/user-attachments/assets/864e6867-eda3-4a3e-8f77-b766d6d53c37)
Summary
I'm working on validating some data (internal issue https://github.com/cloudquery/cloudquery-issues/issues/2971) using the json type schema and noticed a bug (noticeable on AWS where structs don't have json tags).
We should not use the name transformer to get the name as it defaults to
ToSnake
when a json tag is missing.Instead we should mimic the JSON marshaling default behavior to use the field name as is.
A better approach can be to create an instance of the type, marshal it to JSON, then use that for the names. Open to ideas how to do that using reflection, with a caveat that we might need to initialize it using non zero values otherwise those can be omitted
Use the following steps to ensure your PR is ready to be reviewed
go fmt
to format your code 🖊golangci-lint run
🚨 (install golangci-lint here)