0

I am trying to create a model for my api. But aws returns 3x invalid model schema error, couldn't figure out the reason:

{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "EmailInputModel",
"type":"object",
"properties":{
"email":{
    "type":"string",
    "required":true,
    "patternProperties":{ 
        "^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i": {}
        }
    },
"message":{
    "type":"string",
    "required":true
},
"sender":{
    "type":"string",
    "required":true
}
}

}

Thanks in advance for help and efforts.

Ergun
  • 458
  • 1
  • 8
  • 21

1 Answers1

1

Looks like the usage of required attribute should be fixed. Try below.

{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "EmailInputModel",
"type": "object",
"properties": {
    "email": {
        "type": "string",
        "patternProperties":{ 
    "^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i": {}
        }
    },
    "message": {
        "type": "string"
    },
    "sender": {
        "type": "string"
    }
},
"required": ["email", "message", "sender"]
}
Denis Weerasiri
  • 1,120
  • 1
  • 8
  • 16