API use fails as of 1.2.2
timothymcmackin opened this issue · comments
I was working on upgrading to 2.0.0 from 1.2.1 and I've traced a problem to the upgrade from 1.2.1 to 1.2.2.
With 1.2.1 I can do this:
const apiFilter = require('openapi-filter');
async function filterInternalRoutes(docPromise, filterTags) {
const openApiDocument = await Promise.resolve(docPromise);
return apiFilter.filter(openApiDocument, {
tags: filterTags || ['x-internal', 'x-alpha'],
});
}
When I do that in 1.2.2, I get this error:
Usage: openapi-filter [options] {infile} [{outfile}]
Options:
-h, --help Show help [boolean]
--version Show version number [boolean]
-i, --inverse output filtered elements only [boolean]
-t, --tags tags to filter by [array] [default: ["x-internal"]]
Not enough non-option arguments: got 0, need at least 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm
and.
Did the way openapi-filter API is invoked change in 1.2.2? Same error with 2.0.0.
Thanks for reporting this. PR #5 broke the API support for require
ing this module and I didn't notice.
Should be fixed in v2.0.1
. Note you'll have to change the option tags
to flags
.