Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation with Regex doesn't allow type regexp for a pattern #1178

Open
psavary opened this issue Feb 9, 2023 · 6 comments
Open

Validation with Regex doesn't allow type regexp for a pattern #1178

psavary opened this issue Feb 9, 2023 · 6 comments
Assignees

Comments

@psavary
Copy link

psavary commented Feb 9, 2023

Steps to Reproduce

Running ctf-migrate up

const regexPattern = /^[^.~:\/?#[\]@!$&'()*+,;=%\s]+(?:-+)*$/;
 
const formPage = migration.editContentType('formPage');
  formPage
    .editField('slug')
    .validations([
      {
        'unique': true
      },
      {
        'regexp': {
          'pattern': regexPattern
        }
      }
    ]);

Expected Behavior

I'd expect that the property pattern accepts a variable of type Regex so that I don't have to write a string and therefore have to escape escape characters like this:

const regexPattern = '^[^.~:\\/?#[\\]@!$&\'()*+,;=%\\s]+(?:-+)*$';

Actual Behavior

image

Possible Solution

Allow type regexp as a type on property pattern

Environment

package.json

"@contentful/rich-text-html-renderer": "^15.13.1",
"@types/git-branch": "^2.0.1",
"@types/node": "^14.14.5",
"commander": "^6.2.0",
"contentful-management": "^6.1.2",
"contentful-migrate": "^0.17.0",
"cross-var": "^1.1.0",
"dotenv": "^8.2.0",
"dotenv-cli": "^4.0.0",
"git-branch": "^2.0.1",
"prettier": "^2.3.1",
"slugify": "^1.4.5",
"ts-node": "^9.0.0",
"tslint": "^6.1.3",
"typescript": "^4.0.5",
"uuid62": "^1.0.2"

package-json.lock

"contentful-migration": {
  "version": "4.8.1",
  "resolved": "https://registry.npmjs.org/contentful-migration/-/contentful-migration-4.8.1.tgz",
  "integrity": "sha512-2HTvnSlyjNmmjgjHLAuq0a2alnf7QZMI1nwoFvQ2E5aSH7H39GaxLwWQqUn7Xe5fnCHFLHXTM9bXEJ0XfZIg4Q==",
  "requires": {
    "axios": "^0.21.0",
    "bluebird": "^3.7.2",
    "callsites": "^3.1.0",
    "cardinal": "^2.1.1",
    "chalk": "^4.0.0",
    "contentful-management": "^7.51.5",
    "didyoumean2": "^5.0.0",
    "hoek": "^6.1.3",
    "https-proxy-agent": "^5.0.0",
    "inquirer": "^8.1.2",
    "joi": "^17.4.0",
    "kind-of": "^6.0.3",
    "listr2": "^3.13.5",
    "lodash": "^4.17.15",
    "uuid": "^8.3.2",
    "yargs": "^15.3.1"
  },
@psavary
Copy link
Author

psavary commented Mar 13, 2023

No update, or does nobody care for this repo? 😢

@psavary
Copy link
Author

psavary commented Mar 16, 2023

This is just sad, you know?

@psavary
Copy link
Author

psavary commented Apr 26, 2023

Still sad.

@psavary
Copy link
Author

psavary commented Apr 26, 2023

Every decent developer seems to have jumped ship in this company. I think I have seen enough. Won't recommend this software until you change this situation.

@psavary
Copy link
Author

psavary commented Jun 16, 2023

I'm just here to check how utterly abandoned the codebase here is. Shame on you contentful.

@jjolton-contentful
Copy link
Contributor

Hey @psavary this sounds like it would be a great improvement, thanks very much for the suggestion and really truly sorry about the radio silence you received. I am gonna see about landing this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants