Skip to content

Commit c17a692

Browse files
committed
clean up docstrings
1 parent 4ef2f61 commit c17a692

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

schematic/schemas/create_json_schema.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def _get_validation_rule_based_fields(
240240
241241
Arguments:
242242
validation_rules: A list of input validation rules
243-
explicit_js_type: If the type has been set explicitly in the data model, otherwise None
243+
explicit_js_type: A JSONSchemaType if set explicitly in the data model, otherwise None
244244
name: The name of the node the validation rules belong to
245245
246246
Raises:
@@ -276,35 +276,38 @@ def _get_validation_rule_based_fields(
276276
js_is_array = ValidationRuleName.LIST in validation_rule_names
277277

278278

279-
# The explicit JSON Schema type is the one set in the data model.
279+
# The explicit JSON Schema type is the one set in the data model
280280
# The implicit JSON Schema type is the one implied by the presence
281-
# of certain validation rules.
282-
# Schematic will use the implicit type for if the explicit type isn't specified for now,
283-
# but this behavior is deprecated and will be removed in the future in SCHEMATIC-326
281+
# of certain validation rules
282+
# Schematic will use the implicit type if the explicit type isn't specified for now,
283+
# but this behavior is deprecated and will be removed in the future by SCHEMATIC-326
284284
implicit_js_type = get_js_type_from_inputted_rules(validation_rules)
285-
# If there is an explicit type that is used ...
285+
# If there is an explicit type set...
286286
if explicit_js_type:
287-
# unless there the implicit type conflicts the an exception is raised
287+
# and the implicit type conflicts with the explicit type, then an exception is raised
288288
if explicit_js_type != implicit_js_type:
289289
msg = (
290290
f"Property: '{name}', has explicit type: '{explicit_js_type}' "
291291
f"that conflicts with the implicit type: '{implicit_js_type}' "
292292
f"derived from its validation rules: {validation_rules}"
293293
)
294294
raise ValueError(msg)
295+
# otherwise the explicit type is used
295296
js_type = explicit_js_type
296-
# If there is no explicit type then the implicit type is used and ...
297+
# If there is no explicit type...
297298
else:
298-
# a warning is raised since this behavior is deprecated
299+
# and there is an implicit type...
299300
if implicit_js_type:
301+
# then the implicit type is used...
302+
js_type = implicit_js_type
303+
# and a warning is raised since this behavior is deprecated
300304
msg = (
301305
f"No explicit type set for property: '{name}', "
302306
"using validation rules to set the type. "
303307
"Using validation rules to set type is deprecated. "
304308
"You should set the columnType for this property in your data model."
305309
)
306310
warnings.warn(msg)
307-
js_type = implicit_js_type
308311

309312
if ValidationRuleName.URL in validation_rule_names:
310313
js_format = JSONSchemaFormat.URI

0 commit comments

Comments
 (0)