json_schemer 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/Gemfile.lock +2 -2
- data/lib/json_schemer/draft202012/vocab/core.rb +3 -3
- data/lib/json_schemer/keyword.rb +8 -0
- data/lib/json_schemer/openapi30/document.rb +1 -2
- data/lib/json_schemer/openapi31/document.rb +2 -4
- data/lib/json_schemer/schema.rb +7 -8
- data/lib/json_schemer/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1981782f2342c7123beb0374680037bc11f3be72a8e4be0a213cfb7691643415
         | 
| 4 | 
            +
              data.tar.gz: e8b6c605ba1ce2a2751ac90167f53c27fad975140ab9a0e8328c2b04ce8fe732
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4d4c6e6c3660560a602b5610559efe37b5839f1142af6486e350bd207cad49e37a00f397d555878957b14951da95745092240bd14417e2ffd02826f053099952
         | 
| 7 | 
            +
              data.tar.gz: 8dc561414463ceeacf7bbd0be95be9c441a50919cdb839ff8366fa0268d96d91e4947985bd7bab406f3c163e913bf7ca923a38e22d777d2549af3329f91c14f2
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,6 +1,15 @@ | |
| 1 1 | 
             
            # Changelog
         | 
| 2 2 |  | 
| 3 | 
            -
            ## [2.1. | 
| 3 | 
            +
            ## [2.1.1] - 2023-11-28
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ### Bug Fixes
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            - Fix refs to/through keyword objects: https://github.com/davishmcclurg/json_schemer/pull/160
         | 
| 8 | 
            +
            - Temporary fix for incorrect `uri-reference` format in OpenAPI 3.x: https://github.com/davishmcclurg/json_schemer/pull/161
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            [2.1.1]: https://github.com/davishmcclurg/json_schemer/releases/tag/v2.1.1
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ## [2.1.0] - 2023-11-17
         | 
| 4 13 |  | 
| 5 14 | 
             
            ### Bug Fixes
         | 
| 6 15 |  | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                json_schemer (2.1. | 
| 4 | 
            +
                json_schemer (2.1.1)
         | 
| 5 5 | 
             
                  hana (~> 1.3)
         | 
| 6 6 | 
             
                  regexp_parser (~> 2.0)
         | 
| 7 7 | 
             
                  simpleidn (~> 0.2)
         | 
| @@ -30,7 +30,7 @@ GEM | |
| 30 30 | 
             
                unf (0.1.4)
         | 
| 31 31 | 
             
                  unf_ext
         | 
| 32 32 | 
             
                unf (0.1.4-java)
         | 
| 33 | 
            -
                unf_ext (0.0.9)
         | 
| 33 | 
            +
                unf_ext (0.0.9.1)
         | 
| 34 34 |  | 
| 35 35 | 
             
            PLATFORMS
         | 
| 36 36 | 
             
              java
         | 
| @@ -136,7 +136,7 @@ module JSONSchemer | |
| 136 136 | 
             
                        end
         | 
| 137 137 | 
             
                      end
         | 
| 138 138 |  | 
| 139 | 
            -
                      def  | 
| 139 | 
            +
                      def fetch(token)
         | 
| 140 140 | 
             
                        if value.is_a?(Hash)
         | 
| 141 141 | 
             
                          parsed[token] ||= JSONSchemer::Schema::UNKNOWN_KEYWORD_CLASS.new(value.fetch(token), self, token, schema)
         | 
| 142 142 | 
             
                        elsif value.is_a?(Array)
         | 
| @@ -146,8 +146,8 @@ module JSONSchemer | |
| 146 146 | 
             
                        end
         | 
| 147 147 | 
             
                      end
         | 
| 148 148 |  | 
| 149 | 
            -
                      def  | 
| 150 | 
            -
                        @ | 
| 149 | 
            +
                      def parsed_schema
         | 
| 150 | 
            +
                        @parsed_schema ||= subschema(value)
         | 
| 151 151 | 
             
                      end
         | 
| 152 152 |  | 
| 153 153 | 
             
                      def validate(instance, instance_location, keyword_location, _context)
         | 
    
        data/lib/json_schemer/keyword.rb
    CHANGED
    
    
| @@ -270,8 +270,7 @@ module JSONSchemer | |
| 270 270 | 
             
                        'type' => 'object',
         | 
| 271 271 | 
             
                        'properties' => {
         | 
| 272 272 | 
             
                          'url' => {
         | 
| 273 | 
            -
                            'type' => 'string' | 
| 274 | 
            -
                            'format' => 'uri-reference'
         | 
| 273 | 
            +
                            'type' => 'string'
         | 
| 275 274 | 
             
                          },
         | 
| 276 275 | 
             
                          'description' => {
         | 
| 277 276 | 
             
                            'type' => 'string'
         | 
| @@ -1054,8 +1053,7 @@ module JSONSchemer | |
| 1054 1053 | 
             
                        'type' => 'object',
         | 
| 1055 1054 | 
             
                        'properties' => {
         | 
| 1056 1055 | 
             
                          'operationRef' => {
         | 
| 1057 | 
            -
                            'type' => 'string' | 
| 1058 | 
            -
                            'format' => 'uri-reference'
         | 
| 1056 | 
            +
                            'type' => 'string'
         | 
| 1059 1057 | 
             
                          },
         | 
| 1060 1058 | 
             
                          'operationId' => {
         | 
| 1061 1059 | 
             
                            'type' => 'string'
         | 
    
        data/lib/json_schemer/schema.rb
    CHANGED
    
    | @@ -203,18 +203,13 @@ module JSONSchemer | |
| 203 203 | 
             
                  end
         | 
| 204 204 |  | 
| 205 205 | 
             
                  schema = Hana::Pointer.parse(pointer).reduce(schema) do |obj, token|
         | 
| 206 | 
            -
                     | 
| 207 | 
            -
                      obj.fetch_unknown!(token)
         | 
| 208 | 
            -
                    elsif obj.parsed.is_a?(Array)
         | 
| 209 | 
            -
                      obj.parsed.fetch(token.to_i)
         | 
| 210 | 
            -
                    else
         | 
| 211 | 
            -
                      obj.parsed.fetch(token)
         | 
| 212 | 
            -
                    end
         | 
| 206 | 
            +
                    obj.fetch(token)
         | 
| 213 207 | 
             
                  rescue IndexError
         | 
| 214 208 | 
             
                    raise InvalidRefPointer, pointer
         | 
| 215 209 | 
             
                  end
         | 
| 216 210 |  | 
| 217 | 
            -
                  schema = schema. | 
| 211 | 
            +
                  schema = schema.parsed_schema if schema.is_a?(Keyword)
         | 
| 212 | 
            +
                  raise InvalidRefPointer, pointer unless schema.is_a?(Schema)
         | 
| 218 213 |  | 
| 219 214 | 
             
                  schema
         | 
| 220 215 | 
             
                end
         | 
| @@ -299,6 +294,10 @@ module JSONSchemer | |
| 299 294 | 
             
                  '^'
         | 
| 300 295 | 
             
                end
         | 
| 301 296 |  | 
| 297 | 
            +
                def fetch(key)
         | 
| 298 | 
            +
                  parsed.fetch(key)
         | 
| 299 | 
            +
                end
         | 
| 300 | 
            +
             | 
| 302 301 | 
             
                def fetch_format(format, *args, &block)
         | 
| 303 302 | 
             
                  if meta_schema == self
         | 
| 304 303 | 
             
                    formats.fetch(format, *args, &block)
         | 
    
        data/lib/json_schemer/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: json_schemer
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.1. | 
| 4 | 
            +
              version: 2.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - David Harsha
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023-11- | 
| 11 | 
            +
            date: 2023-11-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |