Skip to content
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: Validate policy and test files with JSON schema #1526

Merged
merged 6 commits into from
Apr 17, 2023

Conversation

oguzhand95
Copy link
Member

No description provided.

@oguzhand95 oguzhand95 added the kind/enhancement New feature or request label Apr 12, 2023
@oguzhand95 oguzhand95 self-assigned this Apr 12, 2023
@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

Merging #1526 (96e8369) into main (b6fdc81) will increase coverage by 0.15%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1526      +/-   ##
==========================================
+ Coverage   53.45%   53.61%   +0.15%     
==========================================
  Files         128      128              
  Lines       14412    14426      +14     
==========================================
+ Hits         7704     7734      +30     
+ Misses       6036     6018      -18     
- Partials      672      674       +2     
Impacted Files Coverage Δ
internal/audit/conf.go 70.27% <ø> (ø)
internal/storage/conf.go 52.17% <ø> (ø)
schema/schema.go 0.00% <ø> (ø)
internal/storage/index/builder.go 84.76% <100.00%> (+7.57%) ⬆️
internal/verify/verify.go 76.85% <100.00%> (-6.93%) ⬇️

... and 3 files with indirect coverage changes

@oguzhand95 oguzhand95 marked this pull request as ready for review April 12, 2023 14:01
Copy link
Contributor

@charithe charithe left a comment

Choose a reason for hiding this comment

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

The validation step needs to be a part of the index build process. As the index builder goes through each file, it should validate them using the appropriate schema and collect any validation errors to be returned back as index build errors.

cmd/cerbos/compile/compile.go Outdated Show resolved Hide resolved
cmd/cerbos/compile/compile.go Outdated Show resolved Hide resolved
schema/schema.go Outdated Show resolved Hide resolved
internal/jsonschema/jsonschema.go Outdated Show resolved Hide resolved
@oguzhand95 oguzhand95 force-pushed the schema branch 4 times, most recently from c4ff9cd to 6b7dbf2 Compare April 14, 2023 12:39
internal/jsonschema/jsonschema.go Outdated Show resolved Hide resolved
internal/test/testdata/index/incomplete_files.yaml Outdated Show resolved Hide resolved
schema/schema.go Outdated Show resolved Hide resolved
schema/schema.go Outdated Show resolved Hide resolved
go.mod Show resolved Hide resolved
internal/jsonschema/jsonschema.go Show resolved Hide resolved
Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
internal/jsonschema/jsonschema.go Show resolved Hide resolved
internal/jsonschema/jsonschema.go Show resolved Hide resolved
internal/storage/index/builder.go Outdated Show resolved Hide resolved
internal/jsonschema/jsonschema.go Outdated Show resolved Hide resolved
internal/jsonschema/jsonschema.go Outdated Show resolved Hide resolved
Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
Copy link
Contributor

@charithe charithe left a comment

Choose a reason for hiding this comment

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

LGTM

@charithe charithe changed the title enhancement: Validate policy and test files with JSON schema feat: Validate policy and test files with JSON schema Apr 17, 2023
@oguzhand95 oguzhand95 merged commit 7570df3 into cerbos:main Apr 17, 2023
@oguzhand95 oguzhand95 deleted the schema branch April 17, 2023 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request kind/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants