diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx index d863ffe1ad336..f1b8662dd59d2 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx @@ -237,7 +237,7 @@ function dbReducer( if (action.payload?.parameters?.credentials_info) { // deserialize credentials info for big query editting - action.payload.parameters.credentials_info = JSON.stringify( + deserializeExtraJSON = JSON.stringify( action.payload?.parameters.credentials_info, ); } diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts index 282cd4f5b1c74..d293b74846893 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/styles.ts @@ -141,8 +141,7 @@ export const antDModalStyles = (theme: SupersetTheme) => css` export const antDAlertStyles = (theme: SupersetTheme) => css` border: 1px solid ${theme.colors.info.base}; padding: ${theme.gridUnit * 4}px; - margin: ${theme.gridUnit * 8}px 0 - ${theme.gridUnit * 4}px; + margin: ${theme.gridUnit * 8}px 0 ${theme.gridUnit * 4}px; .ant-alert-message { color: ${theme.colors.info.dark2}; font-size: ${theme.typography.sizes.s + 1}px; diff --git a/tests/databases/api_tests.py b/tests/databases/api_tests.py index 479a4dfd6c0ff..59023cca4ba75 100644 --- a/tests/databases/api_tests.py +++ b/tests/databases/api_tests.py @@ -1498,7 +1498,6 @@ def test_available(self, app, get_available_engine_specs): "x-encrypted-extra": True, } }, - "required": ["credentials_info"], "type": "object", }, "preferred": True, @@ -1675,74 +1674,39 @@ def test_validate_parameters_invalid_payload_schema(self): response = json.loads(rv.data.decode("utf-8")) assert rv.status_code == 422 - invalid_schema = response["errors"][0]["extra"]["invalid"][0] - # This is done because this array of errors does not have a deterministic order - if invalid_schema == "engine": - assert response == { - "errors": [ - { - "message": "Missing data for required field.", - "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", - "level": "error", - "extra": { - "invalid": ["engine"], - "issue_codes": [ - { - "code": 1020, - "message": "Issue 1020 - The submitted payload has the incorrect schema.", - } - ], - }, - }, - { - "message": "Missing data for required field.", - "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", - "level": "error", - "extra": { - "invalid": ["configuration_method"], - "issue_codes": [ - { - "code": 1020, - "message": "Issue 1020 - The submitted payload has the incorrect schema.", - } - ], - }, - }, - ] - } - else: - assert response == { - "errors": [ - { - "message": "Missing data for required field.", - "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", - "level": "error", - "extra": { - "invalid": ["configuration_method"], - "issue_codes": [ - { - "code": 1020, - "message": "Issue 1020 - The submitted payload has the incorrect schema.", - } - ], - }, + response["errors"].sort(key=lambda error: error["extra"]["invalid"][0]) + assert response == { + "errors": [ + { + "message": "Missing data for required field.", + "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", + "level": "error", + "extra": { + "invalid": ["configuration_method"], + "issue_codes": [ + { + "code": 1020, + "message": "Issue 1020 - The submitted payload has the incorrect schema.", + } + ], }, - { - "message": "Missing data for required field.", - "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", - "level": "error", - "extra": { - "invalid": ["engine"], - "issue_codes": [ - { - "code": 1020, - "message": "Issue 1020 - The submitted payload has the incorrect schema.", - } - ], - }, + }, + { + "message": "Missing data for required field.", + "error_type": "INVALID_PAYLOAD_SCHEMA_ERROR", + "level": "error", + "extra": { + "invalid": ["engine"], + "issue_codes": [ + { + "code": 1020, + "message": "Issue 1020 - The submitted payload has the incorrect schema.", + } + ], }, - ] - } + }, + ] + } def test_validate_parameters_missing_fields(self): self.login(username="admin")