0

I've not done a lot with JSON Schemas and I researched this but haven't found an answer (I even downloaded the ECMS-262 Standard). I'm working on a JSON report program and the schema author just changed on of the definitions:

"type":{
  "id":"http://dummyurl/type",
  "type":"string",
  "pattern":"^[a-zA-Z]{0,}$",
  "enum":[
     "XType",
     "Charge",
     "Prince"

The change was from {1,} to {0,} in the pattern.

My two questions are:

  1. what does the change from {1,} to {0,} accomplish?
  2. with the enum what does the pattern do?
CDspace
  • 2,611
  • 17
  • 32
  • 36
isucylone
  • 9
  • 2

1 Answers1

-1

Changing it from 1 to 0 would allow for an empty string. Where 1 it would have to be 1 or more characters a-zA-Z. You can test the difference here if you're still curious of the difference.

enum is a list of all valid values. So if a string is not in that list, it will not be considered valid.

John Veldboom
  • 1,880
  • 25
  • 29