Skip to content

fix: Add missing comma when generating relations#78

Merged
erezrokah merged 2 commits intocloudquery:mainfrom
erezrokah:fix/relations
Sep 11, 2022
Merged

fix: Add missing comma when generating relations#78
erezrokah merged 2 commits intocloudquery:mainfrom
erezrokah:fix/relations

Conversation

@erezrokah
Copy link
Copy Markdown
Member

@erezrokah erezrokah commented Sep 11, 2022

Summary

The TableDefinition.Relations accepts a string array but it's a bit confusing to use when you have multiple relations as it doesn't add a comma between relations.
As a result if someone has multiple relations they need to work around the issue by doing either:

  • relations: []string{"siteAuthSettings(),publishingProfiles(),vnetConnections(),publishingProfiles()"} (a single string) (code)
    or
  • relations: []string{"siteAuthSettings(),", "publishingProfiles(),"}

This PR fixes the issue (this makes the code consistent with how we template columns).

Another solution is to make relations a string type (instead of an array) to make it clear that it's printed as is.

For clarity the first commit of this PR adds a test to generate a table template and the second has the fix with the change in the snapshot c9d9db2


Use the following steps to ensure your PR is ready to be reviewed

  • Read the contribution guidelines 🧑‍🎓
  • Run go fmt to format your code 🖊
  • Lint your changes via golangci-lint run 🚨 (install golangci-lint here)
  • Update or add tests 🧪
  • Ensure the status checks below are successful ✅

@erezrokah erezrokah changed the title fix: Add missing command when generating relations fix: Add missing comma when generating relations Sep 11, 2022
@github-actions github-actions bot added fix and removed fix labels Sep 11, 2022
Copy link
Copy Markdown
Contributor

@yevgenypats yevgenypats left a comment

Choose a reason for hiding this comment

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

I like the new snapshot idea!

@erezrokah erezrokah merged commit 41172d4 into cloudquery:main Sep 11, 2022
@erezrokah erezrokah deleted the fix/relations branch September 11, 2022 08:33
kodiakhq bot pushed a commit that referenced this pull request Sep 11, 2022
🤖 I have created a release *beep* *boop*
---


## [0.2.7](v0.2.6...v0.2.7) (2022-09-11)


### Bug Fixes

* Add missing comma when generating relations ([#78](#78)) ([41172d4](41172d4))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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.

2 participants