-
Notifications
You must be signed in to change notification settings - Fork 55
Comparing changes
Open a pull request
base repository: go-openapi/validate
base: v0.22.6
head repository: go-openapi/validate
compare: v0.23.0
- 6 commits
- 34 files changed
- 2 contributors
Commits on Jan 27, 2024
-
* refact(validators) Readability improvements: * Introduced private constructors for all validators * All private constructors can use a *SchemaValidatorOptions (generalize options passing pattern) * All exported methods use private constructors (hide the implementation of options) * Readability: reduced the level of indentation with early exit conditions than nested conditions * Object validator: refactored Validate in smaller functions * Removed dead code/commented out code Minor efficiency improvements * In Applies method: reflect replaced by type switch whenever possible * Removed (mostly unusable) debugLog * In object validator: * pattern properties now use the regexp cache readily available * split path may be performed only once * In schema props: keep arrays of pointers []*SchemaValidator and avoid copying a new schema * In default & example validators: * map[string]bool -> map[string]struct{} * clear, don't reallocate the visited map * []validator slice -> [n]validator array * introduced a benchmark follow-up document, based on the existing Kubernetes API fixture Signed-off-by: Frederic BIDON <[email protected]> * fixed typo Signed-off-by: Frederic BIDON <[email protected]> --------- Signed-off-by: Frederic BIDON <[email protected]>Configuration menu - View commit details
-
Copy full SHA for 7c3e606 - Browse repository at this point
Copy the full SHA 7c3e606View commit details
Commits on Feb 1, 2024
-
perf(validators): reduced GC pressure
This PR is a follow-up on #169, which cames with innocuous changes, but already reduced the total number of allocations when validating a swagger spec. We reduce further the pressure on go's GC by pooling temporarily allocated objects: validators and results. When recursively allocating validators, calls to "Validate()" redeem to the pool the allocated validator. This means that a validator is usable only once. A similar approach is taken for `Result`s: upon merge, the merged result is redeemed to the pool. Eventually, temporarily allocated `spec.Schema`s are also pooled. In order not to break existing interfaces, this is enabled by default only when validating a spec (`Spec()`) or when using `AgainstSchema()`. Another option at the spec level allows for skipping the gathering of schemas into the result ("schemata"): these schemas must be cloned to remain valid after their parent is redeemed to the pool. Comment on the benchmark: CPU profiling shows that about 30% of the CPU time is spent managing garbage. Memory profiling shows that our benchmark (validating the k8s API spec) goes down from 25M allocated objects down to ~ 17M (#169 went down from 60M to 25M). The `Validate` method generates only ~ 5M of those, out of which ~ 4M are caused by the schema unmarshaling & expansion and 1M by string allocations for the validator "path". Unfortunately, classic string interning methods don't work well with this dynamic "path", so I leave it there. Integration tests (go-swagger/go-swagger#3064) show a significant improvement when running go-swagger validate in codegen. * contributes: go-swagger/go-swagger#2649 Further improvements would most likely come from optimizing the validation of defaults and examples (which amount for 2M allocs). Signed-off-by: Frederic BIDON <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8c60715 - Browse repository at this point
Copy the full SHA 8c60715View commit details -
ci(dependencies): automate dependencies updates
Signed-off-by: Frédéric BIDON <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 906adc1 - Browse repository at this point
Copy the full SHA 906adc1View commit details -
Bump the development-dependencies group with 3 updates
Bumps the development-dependencies group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [actions/setup-go](https://github.com/actions/setup-go) and [codecov/codecov-action](https://github.com/codecov/codecov-action). Updates `actions/checkout` from 3 to 4 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v3...v4) Updates `actions/setup-go` from 4 to 5 - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v4...v5) Updates `codecov/codecov-action` from 3 to 4 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major dependency-group: development-dependencies - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major dependency-group: development-dependencies - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: development-dependencies ... Signed-off-by: dependabot[bot] <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8c2a862 - Browse repository at this point
Copy the full SHA 8c2a862View commit details -
Bump the go-openapi-dependencies group with 2 updates
Bumps the go-openapi-dependencies group with 2 updates: [github.com/go-openapi/analysis](https://github.com/go-openapi/analysis) and [github.com/go-openapi/swag](https://github.com/go-openapi/swag). Updates `github.com/go-openapi/analysis` from 0.22.0 to 0.22.2 - [Commits](go-openapi/analysis@v0.22.0...v0.22.2) Updates `github.com/go-openapi/swag` from 0.22.8 to 0.22.9 - [Commits](go-openapi/swag@v0.22.8...v0.22.9) --- updated-dependencies: - dependency-name: github.com/go-openapi/analysis dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-openapi-dependencies - dependency-name: github.com/go-openapi/swag dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-openapi-dependencies ... Signed-off-by: dependabot[bot] <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7135206 - Browse repository at this point
Copy the full SHA 7135206View commit details -
chore(ci): prevents duplicate workflow runs
Signed-off-by: Frédéric BIDON <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for fb01d6d - Browse repository at this point
Copy the full SHA fb01d6dView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v0.22.6...v0.23.0