-
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
feat: Add support for jsonschema #1214
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1214 +/- ##
==========================================
- Coverage 48.75% 48.63% -0.12%
==========================================
Files 88 88
Lines 8240 8262 +22
==========================================
+ Hits 4017 4018 +1
- Misses 3850 3869 +19
- Partials 373 375 +2
☔ View full report in Codecov by Sentry. |
Seems something is off with main tests as don't think this PR relates to the failed tests. |
@@ -120,6 +140,17 @@ func (p *Plugin) Init(ctx context.Context, spec []byte, options NewClientOptions | |||
} | |||
defer p.mu.Unlock() | |||
var err error | |||
|
|||
if p.schemaValidator != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to validate the top level schema too via JSON schema? Otherwise the validation error messages might be confusing (some in the JSON schema validator format and others in the JSON decoder format). We'll probably need to do this in the CLI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also maybe you can share how a validation error looks like from the console
To fix the test error, I think you need to run |
For this to be useful in the cloud version, or if we wanted to generate docs from it like the |
I thought initially that we don't need to expose it via gRPC because we can upload it to the hub as json - this way it's very easy for the frontend to use this JSONschema . |
⏱️ Benchmark results
|
🤖 I have created a release *beep* *boop* --- ## [4.9.0](v4.8.0...v4.9.0) (2023-09-20) ### Features * Add support for jsonschema ([#1214](#1214)) ([2d766dc](2d766dc)) ### Bug Fixes * **deps:** Update module github.com/cloudquery/plugin-pb-go to v1.10.0 ([#1220](#1220)) ([aa01b1f](aa01b1f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Documentation generation will fail otherwise. Follow-up for #1214
I was a bit blocked on the backend so took a short detour on our SDK. This will be needed for our upcoming cloud version as we need to generate forms automatically for every plugin version.
The JSON schema will also go into the registry backend and we can also integrate it nicely with the hub - with something like https://codesandbox.io/s/material-ui-json-schema-viewer-2u6zq