Emil Thorenfeldt
5582d069a8
Fix schema matching when using multiple schema locations
...
When multiple schema locations are provided, ensure each resource
is validated against the correct schema by checking if the schema's
kind constraints match the expected resource type.
Fixes #299
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 14:13:15 +02:00
Yann Hamon
e65429b1e5
Add support for duration ( #328 )
...
* Add custom validation logic for durations
2025-05-12 11:15:53 +02:00
Yann Hamon
a23275d5ca
Invalid JSON should not be considered an error - see https://github.com/yannh/kubeconform/issues/67 ( #327 )
2025-05-12 10:21:02 +02:00
Yann Hamon
9f04fec268
Add tests for the HTTP loader ( #325 )
...
Add another test case, remove accidental double memory caching
2025-05-11 04:13:07 +02:00
Yann Hamon
31e9679c96
Update jsonschema library to v6 ( #324 )
2025-05-11 02:05:01 +02:00
Yann Hamon
df26febc54
Update go/goreleaser ( #322 )
2025-05-10 18:20:42 +02:00
Yann Hamon
43a2445cb4
Retry ( #282 )
...
* fix: use hashicorp/go-retryablehttp to retry failed schema downloads
---------
Co-authored-by: Carlos Sanchez <carlos@apache.org>
2024-07-30 23:22:45 +02:00
Yann Hamon
706cd56e87
Revert "fix: retry on download errors ( #274 )" ( #279 )
...
This reverts commit 50ce5f8ecb .
2024-07-29 10:37:43 +02:00
Carlos Sanchez
50ce5f8ecb
fix: retry on download errors ( #274 )
...
* Retry on download errors
---------
Co-authored-by: Yann Hamon <yann@mandragor.org>
2024-07-29 10:10:44 +02:00
guoguangwu
347cd5e4c9
fix: close resource ( #272 )
2024-06-30 15:15:53 +02:00
Yann Hamon
7062384492
Slightly improve the coverage of the validator test ( #271 )
2024-05-09 16:37:20 +02:00
Michael Lee
20805f652c
Stop validating output of closed channel in Validate ( #265 )
...
Currently, Validate and ValidateWithContext always returns a
result with status `Empty` and a `missing 'kind' key` error as
the final item in the returned slice.
This is because ValidateWithContext currently will parse the output of
`resourcesChan`, even when the context is finished and we get back
a default `Resource` struct.
This PR modifies the code to skip validating this case.
2024-05-09 16:27:59 +02:00
PatDyn
ad166c7f0d
Sanitize csv strings ( #258 )
...
* Support spaces before/after commas when passing list of Kinds
2024-05-09 14:21:36 +02:00
Yann Hamon
b6728f181c
Fix junit output, also ensure junit output is deterministic ( #253 )
2023-12-24 18:06:03 +01:00
Yann Hamon
a4d74ce7d2
Fail early on incorrect version of k8s ( #254 )
...
* Fail early on incorrect version of k8s
* fix tests
2023-12-24 18:05:04 +01:00
Yann Hamon
d8f00a3a30
Update Golang to 1.21.4 ( #245 )
2023-11-18 18:31:34 +01:00
Yann Hamon
13a78ebad8
Avoid unnecessary type conversions ( #222 )
2023-07-16 10:27:26 +02:00
Yann Hamon
ae67bb4709
Force Draft version of JsonSchema ( #221 )
...
* Force Draft version of JsonSchema
* Add test validating using CRD that misses explicit draft version
2023-07-16 09:42:11 +02:00
Will Yardley
71fd5f8386
fix: add missing output formats in error message ( #213 )
...
- Add missing 'junit' and 'pretty' output formats.
- Use quotes vs. backticks around command name
2023-06-14 22:41:51 +02:00
Yann Hamon
ad935b7e32
Add JSON/YAML annotations to Config struct
...
Co-authored-by: Ahmed AbouZaid <6760103+aabouzaid@users.noreply.github.com>
2023-04-23 13:55:09 +02:00
Yann Hamon
d038bf8840
Do not hardcode output stream in pkg/output
...
Co-authored-by: Ahmed AbouZaid <6760103+aabouzaid@users.noreply.github.com>
2023-04-23 13:39:43 +02:00
Yann Hamon
8bc9f42f39
Add support for "pretty" output ( #195 )
...
* feat: add pretty output format
---------
Co-authored-by: William Yardley <wyardley@users.noreply.github.com>
2023-04-22 18:41:51 +02:00
Aleksey Levenstein
e3bb34851d
fix: expose error instance path instead of schema path ( #177 )
2023-02-27 16:16:00 +01:00
Yann Hamon
563e1db94c
Try to expose JSON paths ( #173 )
...
* Try to expose JSON paths
* update validationErrors format in json output
* Add test to JSON output with validationError
2023-02-26 12:32:51 +01:00
Yann Hamon
ee7c498580
Migrate to santhosh-tekuri/jsonschema ( #168 )
...
* Migrate to santhosh-tekuri/jsonschema
2023-01-23 19:22:20 +01:00
Andrea Tosatto
d8e348a597
Allow to skip resources using the GVK notation ( #92 )
...
* Allow to skip resources using the GVK notation
* Update flags description, add integration tests and update readme
Co-authored-by: Yann Hamon <yann@mandragor.org>
2022-10-16 14:59:48 +02:00
Yann Hamon
dbcd787256
Do not expose internal CPU profiling option as flag ( #136 )
2022-10-16 14:06:42 +02:00
Yann Hamon
f5338b07f9
Validate JUnit output against Jenkins JUnit XSD ( #134 )
...
* Validate JUnit output against Jenkins JUnix XSD
* Add missing Jenkins JUnit XSD
* Add time to TestCase for #127
2022-10-16 13:52:04 +02:00
Yann Hamon
f68d6ec6ea
Add debug information to help understand failures finding schemas ( #133 )
...
* Add debug information to help understand failures finding schemas
* Add debug information to help understand failures finding schemas
2022-10-16 12:28:11 +02:00
John-Michael Mulesa
5cbbd1a898
Upgrade hash to sha256. ( #126 )
2022-09-02 10:28:07 +02:00
hadar-co
5e63bc5ad7
add {{ .Group }} variable to schema location options ( #120 )
2022-07-16 14:13:17 +02:00
Bill Franklin
9a6fff13cb
Forbid duplicate keys in strict mode ( #121 )
...
* Forbid duplicate keys in strict mode
Prevents specifying duplicate keys using
UnmarshallStrict: https://pkg.go.dev/gopkg.in/yaml.v2#UnmarshalStrict
* Add acceptance tests for duplicated properties
2022-07-15 14:23:10 +02:00
Calle Pettersson
7bf1e01dec
fix: change flag parse error handling to return errors instead of exiting ( #107 )
...
* fix: change flag parse error handling to return errors instead of exiting
Having ExitOnError in combination with SetOutput to a buffer instead of
stdout/stderr means flags.Parse output is swallowed and kubeconform silently
exits directly with exit code 2 instead of returning the error.
Setting ContinueOnError instead returns the error, and writes usage help to
the buffer, so error handling code in main is reached.
* Add test for parsing incorrect flags
Co-authored-by: Yann Hamon <yann@mandragor.org>
2022-06-19 18:38:52 +02:00
Carlos Sanchez
932b35d71f
chore: print the url of failed download ( #96 )
2022-02-22 23:59:39 +01:00
Yann Hamon
85b30f8c2a
Improve handling of cmdline errors ( #91 )
...
Improve handling of cmdline errors
2022-01-06 12:39:24 +01:00
Maxime Brunet
ff2ab3d770
feat(output/tap): Output qualified resource name
2021-12-17 19:18:55 -08:00
z0mbix
c3e6205f15
Move version to main package
2021-11-16 17:19:54 +00:00
z0mbix
d63de52458
Add -v to output version number
2021-11-16 15:30:33 +00:00
Yann Hamon
ab4745ddf0
Small clean-up
2021-09-26 22:55:01 +02:00
Yann Hamon
b5c823d6b5
Also read up to 256MB from stdin
2021-09-26 17:45:27 +02:00
Yann Hamon
8bb87b9a63
Allow bufio.Scanner to resize buffer when reading large files
2021-09-26 17:27:20 +02:00
Yann Hamon
4e83800979
gofmt
2021-09-26 11:58:09 +02:00
Christian Brauchli
dee75355d0
FIX: enable http_proxy environment variable
2021-09-17 09:32:36 +02:00
Yann Hamon
2eefa7fc22
Update Junit tests, fix #45
2021-08-29 12:57:25 +02:00
Victor Cardenas
44b7ba9aef
Properly handle successful http requests to registries sending invalid schema responses
2021-08-03 19:46:18 -04:00
Yann Hamon
53a1689bac
Fix unit tests
2021-07-11 22:57:20 +02:00
Yann Hamon
3a697f3ce2
validate against master by default, not 1.18.0
2021-07-11 22:53:23 +02:00
Yann Hamon
df386fc1fd
Reformat strings
2021-07-03 16:01:51 +02:00
Yann Hamon
4eb75860d9
support for lists
2021-07-03 15:49:37 +02:00
Yann Hamon
77682c3142
fix junit test
2021-03-30 15:31:42 +02:00