Open j616 opened 4 months ago
Hey James, yes it would be really helpful to check what's the issue
It seems that ramlfications no longer likes file objects opened as bytes
type. I'm not sure how this ever worked, given the lack of recent changes, to be honest!
If I have a dummy file:
title: Dummy RAML
version: 0.1
mediaType: application/json
documentation:
- title: Overview
content: |
This is a test of
the yaml parsing.
And a script as follows:
import ramlfications
with open("test.raml", "rb") as ramlFile:
ramlfications.parse(ramlFile)
I get the following traceback:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/__init__.py", line 68, in parse
loader = load(raml)
File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/__init__.py", line 31, in load
return load_file(raml_file)
File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/utils/__init__.py", line 198, in load_file
return RAMLLoader().load(raml)
File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/loader.py", line 123, in load
raml_version, _raml_fragment_type = self._parse_raml_header(raml)
File "/home/jamessa/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ramlfications/loader.py", line 88, in _parse_raml_header
if not header.startswith(RAMLHEADER):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
Hello, I've getting the following (partial) traceback as of v0.2.2.
Looks to be a strait up type error internal to ramlifications. I can try and create a minimal test case to re-create the issue if required.