Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to identify what JSON key is wrong or missing? #2

Open
surajssd opened this issue Sep 11, 2017 · 0 comments
Open

How to identify what JSON key is wrong or missing? #2

surajssd opened this issue Sep 11, 2017 · 0 comments

Comments

@surajssd
Copy link

Problem

I am using this tool to convert the augmented K8s openAPI schema to JSONSchema. But it fails for me without saying what JSON key is missing.

Background

I am working on a project Kedge which is easier way of definig k8s artifacts. So we have created structs which are embedding Kubernetes structs from upstream. Now I wanted to create OpenAPI schema for Kedge. So I am reading our Kedge spec and augmenting our information into existing k8s openAPI schema. But it seems like some JSON keys are mis-matching but I cannot see which keys are mis-matching with use of this tool.

Running

$ mkdir -p configs
$ openapi2jsonschema output.json -o configs/ --stand-alone
Downloading schema
Parsing schema
Generating shared definitions
Generating individual schemas
Generating nonresourceattributes.json
...

Generating deploymentspec.json
Traceback (most recent call last):
  File "/usr/local/bin/openapi2jsonschema", line 11, in <module>
    load_entry_point('openapi2jsonschema', 'console_scripts', 'openapi2jsonschema')()
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/src/openapi2jsonschema/command.py", line 154, in default
    schema_file.write(json.dumps(specification, indent=2))
  File "/usr/local/lib/python2.7/json/__init__.py", line 251, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/local/lib/python2.7/json/encoder.py", line 209, in encode
    chunks = list(chunks)
  File "/usr/local/lib/python2.7/json/encoder.py", line 434, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/usr/local/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/usr/local/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/usr/local/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/usr/local/lib/python2.7/json/encoder.py", line 442, in _iterencode
    o = _default(o)
  File "/usr/local/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
  File "/usr/local/lib/python2.7/site-packages/proxytypes.py", line 91, in wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/jsonref.py", line 212, in __repr__
    return repr(self.__subject__)
  File "/usr/local/lib/python2.7/site-packages/proxytypes.py", line 131, in __getattribute__
    return _oga(self, attr)
  File "/usr/local/lib/python2.7/site-packages/proxytypes.py", line 91, in wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/proxytypes.py", line 209, in __subject__
    self.cache = super(LazyProxy, self).__subject__
  File "/usr/local/lib/python2.7/site-packages/proxytypes.py", line 91, in wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/proxytypes.py", line 195, in __subject__
    return self.callback()
  File "/usr/local/lib/python2.7/site-packages/proxytypes.py", line 91, in wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/jsonref.py", line 159, in callback
    result = self.resolve_pointer(self.store[uri], fragment)
  File "/usr/local/lib/python2.7/site-packages/proxytypes.py", line 91, in wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/jsonref.py", line 197, in resolve_pointer
    self._error("Unresolvable JSON pointer: %r" % pointer, cause=e)
  File "/usr/local/lib/python2.7/site-packages/proxytypes.py", line 91, in wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/jsonref.py", line 207, in _error
    cause=cause
jsonref.JsonRefError

Full log at: http://pastebin.centos.org/235096/

lirik90 referenced this issue in lirik90/swagger2jsonschema Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant