jsf
jsf copied to clipboard
`minLength` and `maxLength` are not respected if `pattern` is specified
JSF does not respect the minLength and maxLength fields of a string property if a pattern field is defined.
Current output:
>>> from jsf import JSF
>>> JSF({"type": "string", "minLength": 2, "maxLength": 3}).generate()
'ut'
>>> JSF({"type": "string", "minLength": 2, "maxLength": 3, "pattern": "^[A-Z]+$"}).generate()
'OPFJJDSPZOMZSWAXQXDBAGZYHZJDPSQXFJPRULKUYQLVITLJVCXINUFVULHXTCFZEJDU'
>>> JSF({"type": "string", "minLength": 100, "maxLength": 110, "pattern": "^[A-Z]+$"}).generate()
'DYDJNFOQDOVKAZYBSGYEICJWMMKYKYSLHMYWNKDPHZDSNJLNPRZLRBZYBXZJTABKXDOJHM'
Expected output:
>>> from jsf import JSF
>>> JSF({"type": "string", "minLength": 2, "maxLength": 3}).generate()
'ut'
>>> JSF({"type": "string", "minLength": 2, "maxLength": 3, "pattern": "^[A-Z]+$"}).generate()
'OPF'
>>> JSF({"type": "string", "minLength": 100, "maxLength": 110, "pattern": "^[A-Z]+$"}).generate()
'DYDJNFOQDOVKAZYBSGYEICJWMMKYKYSLHMYWNKDPHZDSNJLNPRZLRBZYBXZJTABKXDOJHMWHQLQHNSFZCRNJVUYWGSGRKZCZIGYASEVPA'