@@ -281,30 +281,28 @@ def _get_validation_rule_based_fields(
281281 # Schematic will use the implicit type if the explicit type isn't specified for now,
282282 # but this behavior is deprecated and will be removed in the future by SCHEMATIC-326
283283 implicit_js_type = get_js_type_from_inputted_rules (validation_rules )
284- # If there is an explicit type set...
285- if explicit_js_type :
286- # and the implicit type conflicts with the explicit type, then an exception is raised
287- if explicit_js_type != implicit_js_type :
288- msg = (
289- f"Property: '{ name } ', has explicit type: '{ explicit_js_type } ' "
290- f"that conflicts with the implicit type: '{ implicit_js_type } ' "
291- f"derived from its validation rules: { validation_rules } "
292- )
293- raise ValueError (msg )
294- # If there is no explicit type...
295- else :
296- # and there is an implicit type...
297- if implicit_js_type :
298- # then the implicit type is used...
299- js_type = implicit_js_type
300- # and a warning is raised since this behavior is deprecated
301- msg = (
302- f"No explicit type set for property: '{ name } ', "
303- "using validation rules to set the type. "
304- "Using validation rules to set type is deprecated. "
305- "You should set the columnType for this property in your data model."
306- )
307- warnings .warn (msg )
284+ # If there is an explicit and implicit type set and the implicit type conflicts with the
285+ # explicit type, then an exception is raised
286+ if (
287+ explicit_js_type
288+ and implicit_js_type
289+ and explicit_js_type != implicit_js_type
290+ ):
291+ msg = (
292+ f"Property: '{ name } ', has explicit type: '{ explicit_js_type } ' "
293+ f"that conflicts with the implicit type: '{ implicit_js_type } ' "
294+ f"derived from its validation rules: { validation_rules } "
295+ )
296+ raise ValueError (msg )
297+ if implicit_js_type :
298+ js_type = implicit_js_type
299+ msg = (
300+ f"No explicit type set for property: '{ name } ', "
301+ "using validation rules to set the type. "
302+ "Using validation rules to set type is deprecated. "
303+ "You should set the columnType for this property in your data model."
304+ )
305+ warnings .warn (msg )
308306
309307 if ValidationRuleName .URL in validation_rule_names :
310308 js_format = JSONSchemaFormat .URI
0 commit comments