Skip to content

IBX-10375 - Fix validator names being mangled in production builds #1655

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"php": " >=8.3",
"ext-json": "*",
"babdev/pagerfanta-bundle": "^4.5",
"ibexa/content-forms": "~5.0.x-dev",
"ibexa/core": "~5.0.x-dev",
"ibexa/design-engine": "~5.0.x-dev",
"ibexa/content-forms": "~5.0",
"ibexa/core": "~5.0",
"ibexa/design-engine": "~5.0",
"ibexa/polyfill-php82": "^1.0",
"ibexa/rest": "~5.0.x-dev",
"ibexa/search": "~5.0.x-dev",
"ibexa/twig-components": "~5.0.x-dev",
"ibexa/user": "~5.0.x-dev",
"ibexa/rest": "~5.0",
"ibexa/search": "~5.0",
"ibexa/twig-components": "~5.0",
"ibexa/user": "~5.0",
"jms/translation-bundle": "^2.4",
"knplabs/knp-menu-bundle": "^3.0",
"mck89/peast": "^1.9",
Expand Down Expand Up @@ -61,15 +61,15 @@
"require-dev": {
"ext-zip": "*",
"dama/doctrine-test-bundle": "^8.2",
"ibexa/behat": "~5.0.x-dev",
"ibexa/behat": "~5.0",
"ibexa/code-style": "~2.0.0",
"ibexa/doctrine-schema": "~5.0.x-dev",
"ibexa/http-cache": "~5.0.x-dev",
"ibexa/notifications": "~5.0.x-dev",
"ibexa/phpstan": "~5.0.x-dev",
"ibexa/rector": "~5.0.x-dev",
"ibexa/test-core": "~5.0.x-dev",
"ibexa/test-rest": "~5.0.x-dev",
"ibexa/doctrine-schema": "~5.0",
"ibexa/http-cache": "~5.0",
"ibexa/notifications": "~5.0",
"ibexa/phpstan": "~5.0",
"ibexa/rector": "~5.0",
"ibexa/test-core": "~5.0",
"ibexa/test-rest": "~5.0",
"matthiasnoback/symfony-dependency-injection-test": "^5.0",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
Expand Down Expand Up @@ -98,4 +98,4 @@
"dev-main": "5.0.x-dev"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
const fields = doc.querySelectorAll('.ibexa-field-edit');
const getValidationResults = (validator) => {
const isValid = validator.isValid();
const validatorName = validator.constructor.name;
const validatorName = validator.getValidatorName();
const result = { isValid, validatorName };

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
return this.fieldContainer ? this.fieldContainer : fallback;
}

getValidatorName() {
return 'BaseFieldValidator';
}

/**
* Attaches event to elements found with a selector provided by field config
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
this.containerSelectors = containerSelectors;
}

getValidatorName() {
return 'MultiInputFieldValidator';
}

toggleInvalidState(isError, config, input) {
super.toggleInvalidState(isError, config, input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
const SELECTOR_ERROR_NODE = '.ibexa-form-error';

class IbexaBooleanValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaBooleanValidator';
}

/**
* Validates the input field value
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
const SELECTOR_ERROR_NODE = '.ibexa-form-error';

class IbexaCountryValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaCountryValidator';
}

/**
* Validates the country field value
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
const SELECTOR_ERROR_NODE = '.ibexa-form-error';

class IbexaDateValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaDateValidator';
}

/**
* Validates the input
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
const { convertDateToTimezone } = ibexa.helpers.timezone;

class IbexaDateTimeValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaDateTimeValidator';
}

/**
* Validates the input
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
const SELECTOR_ERROR_NODE = '.ibexa-form-error';

class IbexaEmailValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaEmailValidator';
}

/**
* Validates the input
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
const SELECTOR_ERROR_NODE = `${SELECTOR_FIELD} .ibexa-form-error`;

class IbexaFloatValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaFloatValidator';
}

/**
* Validates the input
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
const maps = [];

class IbexaGMapLocationValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaGMapLocationValidator';
}

/**
* Validates latitude/longitude input value
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
const SELECTOR_ERROR_NODE = `${SELECTOR_FIELD} .ibexa-form-error`;

class IbexaIntegerValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaIntegerValidator';
}

/**
* Validates the input
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
const SELECTOR_ERROR_NODE = '.ibexa-form-error';

class IbexaKeywordValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaKeywordValidator';
}

/**
* Validates the keywords input
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
const EVENT_CUSTOM = 'validateInput';

class IbexaObjectRelationListValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaObjectRelationListValidator';
}

/**
* Validates the input
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
const EVENT_VALUE_CHANGED = 'change';

class IbexaSelectionValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaSelectionValidator';
}

/**
* Validates the textarea field value
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
const SELECTOR_SOURCE_INPUT = '.ibexa-data-source__input';

class IbexaStringValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaStringValidator';
}

/**
* Validates the input
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
const SELECTOR_FIELD = '.ibexa-field-edit--ibexa_text';

class IbexaTextValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaTextValidator';
}

/**
* Validates the textarea field value
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
const EVENT_VALUE_CHANGED = 'change';

class IbexaTimeValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaTimeValidator';
}

/**
* Validates the input
*
Expand Down
4 changes: 4 additions & 0 deletions src/bundle/Resources/public/js/scripts/fieldType/ibexa_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
const SELECTOR_ERROR_NODE = '.ibexa-data-source__field--link .ibexa-form-error';

class IbexaUrlValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaUrlValidator';
}

validateUrl(event) {
const result = {
isError: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
const SELECTOR_ERROR_WRAPPER = '.ibexa-form-error';

class IbexaUserValidator extends ibexa.BaseFieldValidator {
getValidatorName() {
return 'IbexaUserValidator';
}

/**
* Validates the input field value
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class RichTextValidator extends ibexa.BaseFieldValidator {
this.labelSelector = labelSelector;
}

getValidatorName() {
return 'RichTextValidator';
}

/**
* Validates the input
*
Expand Down
Loading