Skip to content

feat: Add JSON type schema#1796

Merged
kodiakhq[bot] merged 7 commits intomainfrom
feat/add_json_type_schema
Jul 24, 2024
Merged

feat: Add JSON type schema#1796
kodiakhq[bot] merged 7 commits intomainfrom
feat/add_json_type_schema

Conversation

@erezrokah
Copy link
Copy Markdown
Member

@erezrokah erezrokah commented Jul 17, 2024

Summary

Part of cloudquery/cloudquery#2023 Still WIP and depends on cloudquery/cloudquery-api-go#196


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 ✅

@github-actions github-actions Bot added the feat label Jul 17, 2024
Comment thread serve/package.go
Comment thread transformers/struct.go
Comment thread transformers/struct.go Outdated
Comment thread schema/column.go Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 17, 2024

⏱️ Benchmark results

Comparing with 7955c53

  • Glob-8 ns/op: 91.89 ⬇️ 2.50% decrease vs. 7955c53

@github-actions github-actions Bot added feat and removed feat labels Jul 17, 2024
@erezrokah erezrokah force-pushed the feat/add_json_type_schema branch from d8d56c2 to bc10bdb Compare July 17, 2024 14:00
Comment thread transformers/struct.go Outdated
@erezrokah erezrokah marked this pull request as ready for review July 17, 2024 14:04
@erezrokah erezrokah requested review from a team and bbernays July 17, 2024 14:04
Comment thread transformers/struct_test.go Outdated
@bbernays bbernays requested a review from marianogappa July 22, 2024 15:47
@bbernays
Copy link
Copy Markdown
Contributor

Adding @marianogappa as a reviewer to this because I don't have the bandwidth to dive into this and give it the proper level of attention

@erezrokah erezrokah force-pushed the feat/add_json_type_schema branch from dc8cd41 to 36ec297 Compare July 23, 2024 09:28
Comment thread schema/column.go Outdated
Comment thread transformers/struct.go Outdated
Comment thread transformers/struct_test.go
Comment thread transformers/struct_test.go
@erezrokah erezrokah force-pushed the feat/add_json_type_schema branch from 8c9b343 to 927da7b Compare July 23, 2024 17:37
@erezrokah erezrokah force-pushed the feat/add_json_type_schema branch from 927da7b to b664157 Compare July 23, 2024 17:37
Comment thread transformers/struct.go
}

columnType, err := t.typeTransformer(field)
columnType, err := t.getColumnType(field)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Extracted getColumnType to a dedicated function

@erezrokah erezrokah requested a review from marianogappa July 23, 2024 17:41
@erezrokah
Copy link
Copy Markdown
Member Author

Sorry for the review noise, I basically re-did the PR without using TransformWithStruct as it didn't provide me the output I wanted from the schema. Please see updated tests that I believe look better now and always return a valid JSON

Copy link
Copy Markdown
Contributor

@marianogappa marianogappa left a comment

Choose a reason for hiding this comment

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

Some comments

Comment thread schema/column.go
// PrimaryKeyComponent is a flag that indicates if the column is used as part of the input to calculate the value of `_cq_id`.
PrimaryKeyComponent bool `json:"primary_key_component"`

TypeSchema string `json:"type_schema,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All the other fields here have docs. I think a comment is warranted on this one too 🤔

Comment thread transformers/struct.go Outdated
Comment thread transformers/struct.go
Comment thread transformers/struct.go Outdated
Comment thread transformers/struct_test.go
Comment thread transformers/struct_test.go
@erezrokah erezrokah requested a review from marianogappa July 24, 2024 11:05
@kodiakhq kodiakhq Bot merged commit dbc534b into main Jul 24, 2024
@kodiakhq kodiakhq Bot deleted the feat/add_json_type_schema branch July 24, 2024 11:20
kodiakhq Bot pushed a commit that referenced this pull request Jul 24, 2024
🤖 I have created a release *beep* *boop*
---


## [4.52.0](v4.51.0...v4.52.0) (2024-07-24)


### Features

* Add JSON type schema ([#1796](#1796)) ([dbc534b](dbc534b))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
kodiakhq Bot pushed a commit that referenced this pull request Jul 24, 2024
#### Summary

I missed this in #1796. Actually added the `normalizePointer` for this reason just forgot to use it for map and slice pointers 

---
kodiakhq Bot pushed a commit to cloudquery/cloudquery that referenced this pull request Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants