Skip to content

Commit eb7e60f

Browse files
hf-kkleinKonstantin
andauthored
chore: fix linter warning in json schema generation (#681)
Co-authored-by: Konstantin <[email protected]>
1 parent 5e056d7 commit eb7e60f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

json_schemas/generate_json_schemas.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
file_name: str
4343
json_schema_dict: dict[str, Any]
4444
try: # marshmallow json schema approach (deprecated - to be phased out one after another)
45-
file_name = schema_type.__name__ + ".json" # pylint:disable=invalid-name
45+
FILE_NAME = schema_type.__name__ + ".json" # pylint:disable=invalid-name
4646
schema_instance = schema_type()
4747
if "requirement_indicator" in schema_instance.fields: # type:ignore[union-attr]
4848
# raises attribute error for pydantic classes
@@ -61,10 +61,10 @@
6161
field_dict["requirement_indicator"] = fields.String(name="requirement_indicator")
6262
json_schema_dict = json_schema.dump(schema_instance)
6363
except (AttributeError, ValidationError): # means, we're creating a json schema from a pydantic class
64-
file_name = schema_type.__name__ + "Schema.json" # other than for the marshmallow classes, we add 'Schema' here
64+
FILE_NAME = schema_type.__name__ + "Schema.json" # other than for the marshmallow classes, we add 'Schema' here
6565
assert hasattr(schema_type, "model_json_schema")
6666
json_schema_dict = schema_type.model_json_schema()
67-
file_path = this_directory / file_name
67+
file_path = this_directory / FILE_NAME
6868
# We want our JSON schemas to be compatible with a typescript code generator:
6969
# https://github.com/bcherny/json-schema-to-typescript/
7070
# However there's an unresolved bug: The root level of the schema must not contain any '$ref' key.

0 commit comments

Comments
 (0)