question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Adding the ability to include multiple api files to the command arguments

See original GitHub issue

Hi, currently the validate command can only validate one file. I currently work on a project that has multiple files I want to validate all of them. I could create a bash script that runs this command multiple times, but I think something like this would be awesome:

swagger-cli validate file1.yml file2.yml ... file3.yml

Not sure if this is feasible for the project, so feel free to give me feedback. I am willing to make a pull request to implement this.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Toltarcommented, Jul 22, 2020

@rahulbreezo I like your suggestion. Might need to analyze how the code works first. I’m sure we both can work something out. So far, I see that we need to possibly do something on this line where we can get an array of file paths instead of a single file: https://github.com/APIDevTools/swagger-cli/blob/master/bin/swagger-cli.js#L14

And also creating a function that loops through the files and call this: https://github.com/APIDevTools/swagger-cli/blob/master/bin/swagger-cli.js#L162

Or simply modify the bundle file to accept an array of filenames/paths.

For a directory, we would have to somehow figure that out for it to know that it is a directory and that it needs to recursively look through said directory for the files. But with my feature request, I will have to do the same except, the specific file paths are known in this case. But good that you brought this up @rahulbreezo so I can think about your feature as well.

I suggest we focus on building the thing where it will loop through a set of files. I can already foresee creating an isolated function that is given an array of file paths, which is agnostic to where they come from.

If @rahulbreezo, you could build the part where it can get me an array of filepaths/files from a directory so that we can hook into this one function I am imagining that would be great. We can possibly do this in around ~3ish small PRs.

1reaction
JamesMessingercommented, Jul 18, 2020

I think that’s a great idea! If you’re able to submit a PR, I’d be happy to review it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use a mapping template to override an API's request and ...
Learn how to override a an API's request and response parameters and status codes. ... In the Mapping Templates section, choose Add mapping...
Read more >
GitLab CI/CD include examples
You can use include to include external YAML files in your CI/CD jobs. Include a single configuration file. To include a single configuration...
Read more >
Git Feature Branch Workflow | Atlassian Git Tutorial
Start with the main branch · Create a new-branch · Update, add, commit, and push changes · Push feature branch to remote ·...
Read more >
Document command-line syntax - Google Developers
Use square brackets around an argument to indicate that it's optional. If there's more than one optional argument, enclose each item in its...
Read more >
Grouping requests in collections - Postman Learning Center
There are several ways to add existing and new requests to a collection. ... Collections can power various parts of your API development, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found