Skip to content

feat: Validate plugin spec before init#16546

Merged
kodiakhq[bot] merged 5 commits into
mainfrom
feat/cli/validate-spec
Feb 8, 2024
Merged

feat: Validate plugin spec before init#16546
kodiakhq[bot] merged 5 commits into
mainfrom
feat/cli/validate-spec

Conversation

@candiduslynx
Copy link
Copy Markdown
Contributor

@candiduslynx candiduslynx commented Feb 8, 2024

This PR adds spec validation before passing it to the plugin.

It also extracts the init logic into a handy initPlugin func.

The decision structure is the following (we allow a bit of leeway here if the schema provided isn't a correct JSON schema: the CLI will skip validation instead of failing the sync/init)

flowchart TD
    A{No Connection?} ----> |true| S
    A{No Connection?} --> |false| G[Get spec schema]
    subgraph validate
    G --> |non-empty schema| P[parse schema]
    G --> |failed call| E[error-out]
    P --> |OK| V[validate spec]
    V --> |failed| E
    end
    P --> |failed| S
    G --> |unimplemented| S
    G --> |empty schema| S
    V --> |OK| I[init]
    S[Skip validation] --> I  
Loading

@candiduslynx candiduslynx added the no automerge Block automatic merging label Feb 8, 2024
@cq-bot cq-bot added the area/cli label Feb 8, 2024
Comment thread cli/cmd/specs.go Outdated
@candiduslynx candiduslynx requested a review from disq February 8, 2024 11:17
Comment thread cli/cmd/specs.go Outdated
Co-authored-by: Kemal <223029+disq@users.noreply.github.com>
@candiduslynx candiduslynx added automerge Automatically merge once required checks pass and removed no automerge Block automatic merging labels Feb 8, 2024
@kodiakhq kodiakhq Bot merged commit 081e1b7 into main Feb 8, 2024
@kodiakhq kodiakhq Bot deleted the feat/cli/validate-spec branch February 8, 2024 14:02
kodiakhq Bot pushed a commit that referenced this pull request Feb 8, 2024
🤖 I have created a release *beep* *boop*
---


## [5.4.0](cli-v5.3.1...cli-v5.4.0) (2024-02-08)


### Features

* Validate plugin spec before init ([#16546](#16546)) ([081e1b7](081e1b7))


### Bug Fixes

* **deps:** Update module github.com/cloudquery/plugin-pb-go to v1.17.0 ([#16528](#16528)) ([c6b0142](c6b0142))
* **deps:** Update module github.com/cloudquery/plugin-pb-go to v1.17.1 ([#16539](#16539)) ([844434b](844434b))

---
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

area/cli automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants