From 4fdbf0c335aab167b7ef730fc3dd448230b1f26b Mon Sep 17 00:00:00 2001 From: David Harsha Date: Thu, 23 Nov 2023 10:24:05 -0800 Subject: [PATCH] Drop incorrect `uri-reference` OpenAPI formats Temporary fix until upstream schemas are fixed and published: https://github.com/OAI/OpenAPI-Specification/pull/3455 Closes: https://github.com/davishmcclurg/json_schemer/issues/158 --- lib/json_schemer/openapi30/document.rb | 3 +-- lib/json_schemer/openapi31/document.rb | 6 ++---- test/json_schemer_test.rb | 5 +++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/json_schemer/openapi30/document.rb b/lib/json_schemer/openapi30/document.rb index 0bc81873..d01302c2 100644 --- a/lib/json_schemer/openapi30/document.rb +++ b/lib/json_schemer/openapi30/document.rb @@ -1584,8 +1584,7 @@ module Document 'type' => 'string' }, 'operationRef' => { - 'type' => 'string', - 'format' => 'uri-reference' + 'type' => 'string' }, 'parameters' => { 'type' => 'object', diff --git a/lib/json_schemer/openapi31/document.rb b/lib/json_schemer/openapi31/document.rb index 93ac8695..8bd319fa 100644 --- a/lib/json_schemer/openapi31/document.rb +++ b/lib/json_schemer/openapi31/document.rb @@ -270,8 +270,7 @@ def self.dialect_schema(dialect) 'type' => 'object', 'properties' => { 'url' => { - 'type' => 'string', - 'format' => 'uri-reference' + 'type' => 'string' }, 'description' => { 'type' => 'string' @@ -1054,8 +1053,7 @@ def self.dialect_schema(dialect) 'type' => 'object', 'properties' => { 'operationRef' => { - 'type' => 'string', - 'format' => 'uri-reference' + 'type' => 'string' }, 'operationId' => { 'type' => 'string' diff --git a/test/json_schemer_test.rb b/test/json_schemer_test.rb index 346ba11c..fae8aae3 100644 --- a/test/json_schemer_test.rb +++ b/test/json_schemer_test.rb @@ -435,8 +435,9 @@ def test_published_meta_schemas JSONSchemer::Draft4::SCHEMA, JSONSchemer::OpenAPI31::SCHEMA, JSONSchemer::OpenAPI31::Meta::BASE, - JSONSchemer::OpenAPI31::Document::SCHEMA, - JSONSchemer::OpenAPI30::Document::SCHEMA + # fixme: https://github.com/OAI/OpenAPI-Specification/pull/3455 + # JSONSchemer::OpenAPI31::Document::SCHEMA, + # JSONSchemer::OpenAPI30::Document::SCHEMA ].each do |meta_schema| id = meta_schema.key?('$id') ? meta_schema.fetch('$id') : meta_schema.fetch('id') assert_equal(meta_schema, JSON.parse(fetch(id)))