Sha256: 69cb79151bb8f3f201b9edb8b555703e51bdcf7ff7063380acee7f05b705d4ef

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

Feature: Core schema: patternProperties

  Scenario: one pattern
    When the schema is:
      """
      {
          "patternProperties": {
              "[Nn]ame$": { "type": "string" }
          }
      }
      """
    Then these are valid JSON:
      | { "name": "Felizberto" }        |
      | { "firstName": "Fitzheraldo" }  |
      | { "fullName": "Inigo Montoya" } |
      | { "doesNotMatch": 12345678 }    |
    But these are not valid JSON:
      | { "name": 2112 }         |
      | { "aNiceName": [1,2,3] } |

  Scenario: multiple patterns
    When the schema is:
      """
      {
          "patternProperties": {
              "^foos": { "type": "string" },
              "umber$": { "type": "integer" }
          }
      }
      """
    Then these are valid JSON:
      | { "foosball": "is a silly game" } |
      | { "number": 2112 }                |
    But these are not valid JSON:
      | { "humber": "Fourty-two" }        |
      | { "foos": 2112 }                  |

  Scenario: pattern with vanilla property
    When the schema is:
      """
      {
          "properties": {
              "a": { "type": "string" }
          },

          "patternProperties": {
              "a": { "enum": ["fnord", 42] }
          }
      }
      """
    Then this is valid JSON:
      """
      {
          "a": "fnord",
          "apple": 42,
          "aardvark": "fnord"
      }
      """
    But these are not valid JSON:
      | { "a": 42 }          |
      | { "apple": "6 * 9" } |
      | { "aardvark": 41 }   |

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jschematic-0.1.0 features/pattern_properties.feature
jschematic-0.0.9 features/pattern_properties.feature
jschematic-0.0.6 features/pattern_properties.feature
jschematic-0.0.5 features/pattern_properties.feature
jschematic-0.0.2 features/pattern_properties.feature