-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Changing load/dump in source files #190641
Changes from 9 commits
0525b00
260680b
9a420ab
d2fefb8
407ba6a
e9d20a4
b8eaa17
c2b18f9
415d452
89f18e8
49ee5a4
f165d5a
04a56a3
3c3f076
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,8 @@ describe('OpenAPI Bundler - remove custom x- props', () => { | |
expect(bundledSpec.paths['/api/some_api']!.post).not.toMatchObject({ | ||
'x-codegen-enabled': expect.anything(), | ||
}); | ||
// As we have switched to using the js-yaml safeDump function, we are stripping | ||
// out invalid types like 'undefined' when the spec is written to file. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To reviewers: does it make sense to refactor this test, or rather to implement unit tests for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact The output of this utility is committed to the repo so we can immediately spot any inconsistencies. It also means that having a lot of unit tests to verify all aspects isn't strictly necessary. |
||
expect(bundledSpec.paths['/api/some_api']!.put).not.toMatchObject({ | ||
'x-codegen-enabled': expect.anything(), | ||
}); | ||
|
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.
Adding
skipInvalid: true
allows the files to be written even if they contain invalid types (e.g.undefined
). The result is that the invalid types will not be written to the file rather than the default behavior of throwing an exception.Previous use of the
dump
function would write files containing invalid types. It looks like we relied on parsing the file contents to handling removing the invalid values, which may no longer be necessary.