-
Notifications
You must be signed in to change notification settings - Fork 18
feat(oas3): add format link #533
base: master
Are you sure you want to change the base?
Conversation
Why are not there |
Yarn is used, not npm. There is yarn lockfile in root of repo, there is no need to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
R.pipe( | ||
parseDocument, | ||
deduplicateUnsupportedAnnotations(context.namespace), | ||
context.options.generateSourceMap ? filterColumnLine : filterSourceMaps | ||
), | ||
document | ||
); | ||
|
||
if (!isAnnotation(parseResult.content[0])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check can be removed like in the API Blueprint version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
R.pipe( | ||
parseDocument, | ||
deduplicateUnsupportedAnnotations(context.namespace), | ||
context.options.generateSourceMap ? filterColumnLine : filterSourceMaps | ||
), | ||
document | ||
); | ||
|
||
if (!isAnnotation(parseResult.content[0])) { | ||
const formatVersion = R.pipe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed here f52cd03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if the value of the OpenAPi member element is a string element 88bcb56
Closes APIARY-6106