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

Merge configuration options to pass to subschemas #208

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

davishmcclurg
Copy link
Owner

This effectively merges Schema.new options with the provided Configuration object (or the default global one) so that subschemas validate using the same configuration as the parent schema.

base_uri and meta_schema are still instance variables because they're modified by keywords (that's why they're attr_accessor).

resolve_ref still passes ref_resolver and regexp_resolver to subschemas to support caching (because the CachedResolver instances are created in Schema). They could maybe be cached in Configuration instead, but that felt like a bigger change.

Fixes: #198

This effectively merges `Schema.new` options with the provided
`Configuration` object (or the default global one) so that subschemas
validate using the same configuration as the parent schema.

`base_uri` and `meta_schema` are still instance variables because
they're modified by keywords (that's why they're `attr_accessor`).

`resolve_ref` still passes `ref_resolver` and `regexp_resolver` to
subschemas to support caching (because the `CachedResolver` instances
are created in `Schema`). They could maybe be cached in `Configuration`
instead, but that felt like a bigger change.

Fixes: #198
@ahx
Copy link

ahx commented Jan 21, 2025

This works for me. Thank you!

@davishmcclurg davishmcclurg merged commit 58c920a into main Jan 22, 2025
58 checks passed
@davishmcclurg davishmcclurg deleted the subschema-configuration branch January 22, 2025 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schema#ref does not apply custom configuration options
2 participants