Fix symlink path comparison in schema validation
This commit is contained in:
parent
00392b660d
commit
b34fae93f0
2 changed files with 4 additions and 2 deletions
|
|
@ -46,9 +46,10 @@ module MCP
|
||||||
def validate_schema!
|
def validate_schema!
|
||||||
check_for_refs!
|
check_for_refs!
|
||||||
schema = to_h
|
schema = to_h
|
||||||
|
gem_path = File.realpath(Gem.loaded_specs["json-schema"].full_gem_path)
|
||||||
schema_reader = JSON::Schema::Reader.new(
|
schema_reader = JSON::Schema::Reader.new(
|
||||||
accept_uri: false,
|
accept_uri: false,
|
||||||
accept_file: ->(path) { path.to_s.start_with?(Gem.loaded_specs["json-schema"].full_gem_path) },
|
accept_file: ->(path) { File.realpath(path.to_s).start_with?(gem_path) },
|
||||||
)
|
)
|
||||||
metaschema_path = Pathname.new(JSON::Validator.validator_for_name("draft4").metaschema)
|
metaschema_path = Pathname.new(JSON::Validator.validator_for_name("draft4").metaschema)
|
||||||
# Converts metaschema to a file URI for cross-platform compatibility
|
# Converts metaschema to a file URI for cross-platform compatibility
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,10 @@ module MCP
|
||||||
|
|
||||||
def validate_schema!
|
def validate_schema!
|
||||||
schema = to_h
|
schema = to_h
|
||||||
|
gem_path = File.realpath(Gem.loaded_specs["json-schema"].full_gem_path)
|
||||||
schema_reader = JSON::Schema::Reader.new(
|
schema_reader = JSON::Schema::Reader.new(
|
||||||
accept_uri: false,
|
accept_uri: false,
|
||||||
accept_file: ->(path) { path.to_s.start_with?(Gem.loaded_specs["json-schema"].full_gem_path) },
|
accept_file: ->(path) { File.realpath(path.to_s).start_with?(gem_path) },
|
||||||
)
|
)
|
||||||
metaschema_path = Pathname.new(JSON::Validator.validator_for_name("draft4").metaschema)
|
metaschema_path = Pathname.new(JSON::Validator.validator_for_name("draft4").metaschema)
|
||||||
# Converts metaschema to a file URI for cross-platform compatibility
|
# Converts metaschema to a file URI for cross-platform compatibility
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue