Closed senarijit2021 closed 2 years ago
Hey @senarijit2021 👋 it isn't an error of this library but it looks like there are duplicated post endpoints in your yaml spec. Check the swagger file or try to remove duplicates. Also, if you share a part of your specification it would be more useful than just an error
Hi, Getting a duplicate key error for a openapi spec file:
Error:
`Traceback (most recent call last): File "/home/arijit/Documents/API_Test/main.py", line 38, in
specification = parse('data/openapi-schema.yml')
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/openapi_parser/parser.py", line 111, in parse
specification = resolver.resolve()
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/openapi_parser/resolver.py", line 34, in resolve
self._resolver.parse()
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/prance/init.py", line 133, in parse
self.specification = fetch_url(self.url, encoding=encoding, strict=strict)
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/prance/util/url.py", line 245, in fetch_url
result = parse_spec(content, url.path, content_type=content_type)
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/prance/util/formats.py", line 204, in parse_spec
result, ctype, ext = parse_spec_details(spec_str, filename, *kwargs)
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/prance/util/formats.py", line 179, in parse_spec_details
result = parser(spec_str)
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/prance/util/formats.py", line 69, in __parse_yaml
return yaml.load(str(spec_str))
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/ruamel/yaml/main.py", line 434, in load
return constructor.get_single_data()
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 121, in get_single_data
return self.construct_document(node)
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 131, in construct_document
for _dummy in generator:
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 674, in construct_yaml_map
value = self.construct_mapping(node)
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 445, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 263, in construct_mapping
if self.check_mapping_key(node, key_node, mapping, key, value):
File "/home/arijit/.local/share/virtualenvs/API_Test-WyJS1pN4/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 294, in check_mapping_key
raise DuplicateKeyError(args)
ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping
in "", line 102, column 5
found duplicate key "post" with value "{}" (original value: "{}")
in "", line 136, column 5
To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys`
I went to the link it took me to some other yaml dependency. Can someone help me out with it?