-
-
Notifications
You must be signed in to change notification settings - Fork 531
adds support for glob-style input spec paths and directory output paths #616
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
Merged
drwpow
merged 3 commits into
openapi-ts:main
from
sharmarajdaksh:feature/cli-glob-paths
May 28, 2021
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
caf260c
adds support for glob-style input spec paths and directory output paths
sharmarajdaksh 70428ca
Merge branch 'drwpow:main' into feature/cli-glob-paths
sharmarajdaksh eb73a76
rebased and updated expected schemas with main to fix breaking tests
sharmarajdaksh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,14 @@ describe("cli", () => { | |
const result = execSync(`../../bin/cli.js specs/petstore.yaml`, { cwd: __dirname }); | ||
expect(result.toString("utf8")).toBe(expected); | ||
}); | ||
|
||
it("supports glob paths", () => { | ||
const expectedPetstore = fs.readFileSync(path.join(__dirname, "expected", "petstore.ts"), "utf8"); | ||
const expectedManifold = fs.readFileSync(path.join(__dirname, "expected", "manifold.ts"), "utf8"); | ||
execSync(`../../bin/cli.js \"specs/*.yaml\" -o generated/`, { cwd: __dirname }); // Quotes are necessary because shells like zsh treats glob weirdly | ||
const outputPetstore = fs.readFileSync(path.join(__dirname, "generated", "petstore.ts"), "utf8"); | ||
const outputManifold = fs.readFileSync(path.join(__dirname, "generated", "manifold.ts"), "utf8"); | ||
expect(outputPetstore).toBe(expectedPetstore); | ||
expect(outputManifold).toBe(expectedManifold); | ||
}); | ||
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. Nice test! |
||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is clever. I hadn’t thought about the
stdout
case but this seems pretty handy.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.
Oh wait—we’re logging to
stdout
elsewhere. Truth be told, I don’t know why we’re returning theresult
here; it doesn’t seem to be helpful (and possibly wasting memory?). Either way, this is fine to leave in this PR.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.
Hey, I was initially confused as well about what the reason to return the result was. In user usage, the returned result doesn't matter, but I think it gets used in certain tests so it should be kept in.
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.
OK. Yeah leave it in for now, and I can revisit that post-merge.
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.
Alright!
Rebasing and updating expected schemas fixed the broken test, so I think this PR should be ready now