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

Parse function should be able to parse string of raml #135

Open
econchick opened this issue Apr 16, 2017 · 1 comment
Open

Parse function should be able to parse string of raml #135

econchick opened this issue Apr 16, 2017 · 1 comment

Comments

@econchick
Copy link
Contributor

Like in pyyaml's yaml.loads, ramlfication.parse should be able to take a string of raml format, e.g.

raml = """title: foo API
baseUri: https://foo-api.example.com
"""
ramlfications.parse(raml)
{'title': 'foo API', 'baseUri': 'https://foo-api.example.com'}

There's a preference to not need a separate function (e.g. yaml.load vs yaml.loads), but if it's the only way, that's fine.

PR 120 attempts to address this, but I don't like how it designates a file vs a string by the presence of a file header. I think it should be something like if os.exists(filename), then parse file, otherwise try to parse string as raml.

@freddrake
Copy link
Collaborator

My preference would be separate functions. The caller should know what they have; a YAML syntax error on what was expected to be a path is likely to confuse an end user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants