Conversation
|
Why are not there |
|
Yarn is used, not npm. There is yarn lockfile in root of repo, there is no need to run |
kylef
left a comment
There was a problem hiding this comment.
I've commented on some cases where the changes in lib/parser.js can return an undesired output given certain inputs. I'd suggest using the document variable to retieve the version. document will contain the parsed YAML/JSON document as Minim elements (wrapped in parse result). You could use something along the lines of document.content.find(isObject) to get the "object" element which represent the tree. The getValue('openapi') on an object element can get you the value of the key (which might be a string element, you would want to confirm that is true).
| document | ||
| ); | ||
|
|
||
| if (!isAnnotation(parseResult.content[0])) { |
There was a problem hiding this comment.
I think this check can be removed like in the API Blueprint version.
| ); | ||
|
|
||
| if (!isAnnotation(parseResult.content[0])) { | ||
| const formatVersion = R.pipe( |
There was a problem hiding this comment.
I'd suggest adding a check here for the value of the openapi member element being a string element, and if any of these checks fail I think we should default to the latest OpenAPI 3 version we know about which is 3.0.3. I think there may be cases where we could get here with an invalid document which cannot be parsed correctly.
Making a test similar to it('add the format link', () => { but instead the source is invalid document should verify this, if you set source to be an unexpected value such as const source = '{}' or const source = '[]' etc.
There was a problem hiding this comment.
check if the value of the OpenAPi member element is a string element 88bcb56
Closes APIARY-6106