You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.
def gen_debugger_protocol():
import os.path
json_file = os.path.join(os.path.dirname(__file__), 'debugProtocol.json')
if not os.path.exists(json_file):
import requests
req = requests.get('https://raw.githubusercontent.com/Microsoft/vscode-debugadapter-node/master/debugProtocol.json')
assert req.status_code == 200
with open(json_file, 'wb') as stream:
stream.write(req.content)
import json
import schemapi
with open(json_file, 'rb') as json_contents:
contents = json.loads(json_contents.read())
api = schemapi.JSONSchema(contents)
api.write_module('debug_protocol_schema')
if __name__ == '__main__':
gen_debugger_protocol()
The error I have is:
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\schemapi\jsonschema.py", line 466, in write_module
return utils.save_module(spec=self.source_tree(),
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\schemapi\jsonschema.py", line 413, in source_tree
schema_content = template.render(cls=self, classes=classes)
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\jinja2\asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\jinja2\environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\jinja2\_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 12, in top-level template code
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\schemapi\jsonschema.py", line 344, in object_code
return trait_extractor.object_code()
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\schemapi\trait_extractors.py", line 191, in object_code
for ref in self.schema['allOf']]
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\schemapi\trait_extractors.py", line 191, in <listcomp>
for ref in self.schema['allOf']]
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\schemapi\jsonschema.py", line 333, in trait_code
return trait_extractor.trait_code(**kwargs)
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\schemapi\trait_extractors.py", line 482, in trait_code
in self.schema.wrapped_properties().items()}
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\schemapi\trait_extractors.py", line 481, in <dictcomp>
trait_codes = {name: Variable(prop.trait_code) for (name, prop)
File "C:\tools\Miniconda\envs\tests_py36\lib\site-packages\schemapi\jsonschema.py", line 336, in trait_code
"keys {0}".format(tuple(self.schema.keys())))
ValueError: No recognized trait code for schema with keys ('type', 'description')
The text was updated successfully, but these errors were encountered:
Well, I was investigating a way to create objects from/to json messages (to adapt the pydevd debugger to the vscode protocol).
In the end I didn't really find anything and decided to roll my own code generator as the schema is actually simple (but decided on reporting the bug since it seems like it should work, although I won't be using it given that it didn't really work out of the box, so, feel free to close it if you don't think it's worth it).
For what it's worth, it was issues like this one that led me to abandon the traitlets-based approach in the end. I couldn't see any way to fix them given the constraints of traitlets and the assumptions of jsonschema.
The code below reproduces the problem:
The error I have is:
The text was updated successfully, but these errors were encountered: