fix(package): Normalize tables when writing tables.json#1227
Merged
kodiakhq[bot] merged 2 commits intocloudquery:mainfrom Sep 20, 2023
Merged
fix(package): Normalize tables when writing tables.json#1227kodiakhq[bot] merged 2 commits intocloudquery:mainfrom
kodiakhq[bot] merged 2 commits intocloudquery:mainfrom
Conversation
erezrokah
commented
Sep 20, 2023
| buffer := &bytes.Buffer{} | ||
| m := json.NewEncoder(buffer) | ||
| m.SetIndent("", " ") | ||
| m.SetIndent("", "") |
Member
Author
There was a problem hiding this comment.
I think we want this JSON as compact as possible
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1227 +/- ##
==========================================
+ Coverage 48.63% 48.77% +0.14%
==========================================
Files 88 88
Lines 8262 8285 +23
==========================================
+ Hits 4018 4041 +23
Misses 3869 3869
Partials 375 375
☔ View full report in Codecov by Sentry. |
hermanschaaf
approved these changes
Sep 20, 2023
|
|
||
| if len(tables) != 0 { | ||
| if len(tables) != 2 { | ||
| t.Fatalf("Expected 0 tables but got %d", len(tables)) |
Contributor
There was a problem hiding this comment.
Suggested change
| t.Fatalf("Expected 0 tables but got %d", len(tables)) | |
| t.Fatalf("Expected 2 tables but got %d", len(tables)) |
| tablesString := string(content) | ||
|
|
||
| if diff := cmp.Diff(tablesString, "[{\"name\":\"table1\",\"relations\":[\"table2\"]},{\"name\":\"table2\"}]\n"); diff != "" { | ||
| t.Fatalf("unexpected files in docs directory (-want +got):\n%s", diff) |
Contributor
There was a problem hiding this comment.
Suggested change
| t.Fatalf("unexpected files in docs directory (-want +got):\n%s", diff) | |
| t.Fatalf("unexpected content in tables.json (-want +got):\n%s", diff) |
| Name string `json:"name,omitempty"` | ||
| Parent *string `json:"parent,omitempty"` | ||
| Relations *[]string `json:"relations,omitempty"` | ||
| Title string `json:"title,omitempty"` |
Contributor
There was a problem hiding this comment.
Don't we also need the columns?
kodiakhq bot
pushed a commit
that referenced
this pull request
Sep 20, 2023
🤖 I have created a release *beep* *boop* --- ## [4.9.2](v4.9.1...v4.9.2) (2023-09-20) ### Bug Fixes * **package:** Normalize tables when writing tables.json ([#1227](#1227)) ([06c84c0](06c84c0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We might want to refactor this to no (ab)use the MemDB plugin but I think this is ok for now. Also we should call
FlattenTablesotherwise we only output the top level onesUse the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)