Closed arthur-proglove closed 4 years ago
Describe the bug A JSON schema with a special character in its title (non alphanumerical) causes the generated Python code to be incorrect.
Steps to Reproduce Create a JSON schema with the following title: "My Test JSON Schema!"
"My Test JSON Schema!"
Expected behaviour A class should be defined without the exclamation mark: class MyTestJSONSchema:
class MyTestJSONSchema:
Actual behaviour The class is defined as is: class MyTestJSONSchema!:
class MyTestJSONSchema!:
Sanitizing the title with something like re.sub('[^a-zA-Z0-9_\s]', '_', name) should do the trick ;-)
re.sub('[^a-zA-Z0-9_\s]', '_', name)
Well spotted @arthur-proglove - and thanks for providing a clear example! :+1:
That was fast! :-D
Fixed in 0.13.0 (PyPI, GitHub)
Describe the bug A JSON schema with a special character in its title (non alphanumerical) causes the generated Python code to be incorrect.
Steps to Reproduce Create a JSON schema with the following title:
"My Test JSON Schema!"
Expected behaviour A class should be defined without the exclamation mark:
class MyTestJSONSchema:
Actual behaviour The class is defined as is:
class MyTestJSONSchema!: