Comments (8)
I think that's a great idea! If you're able to submit a PR, I'd be happy to review it.
from swagger-cli.
@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.
from swagger-cli.
@JamesMessinger Great! I might have some questions along the way. So I will ping you here if I have any if that is alright.
from swagger-cli.
That sounds good. Looking forward to it!
from swagger-cli.
@Toltar In your PR please, try to do one more thing.
Run swagger for a folder and validate all swagger files in that folder. I know there is a pre-commit tool for that but I want this feature in swagger-cli. I will be happy to help.
@JamesMessinger If my requirement is a completely different feature from what @Toltar is asking for. I would love to make one different PR that completes my requirements
from swagger-cli.
@rahulbreezo - I like your idea as well. And if @Toltar feels like adding that feature to the PR as well, then I'm all for it. Or it could be done as a separate PR. Either way.
from swagger-cli.
@Toltar Please let me know, are you going to add that feature in your PR or I need to create a different PR for that?
from swagger-cli.
@Toltar Hi, that rahulbreezo is my work account created from work email.
ok, I agree with you using a path array of files is a good idea.
Getting file paths from a directory should be easy using fs
module, but folder can contain other than swagger files as well.
So I think we can do the same as pre-commit
tool does (https://www.npmjs.com/package/swagger-cli). Only the files matching a certain pattern should go through the validator like this pattern .*swagger.*\.(json|yaml|yml)
.
is it okay? if yes then I will start writing function for this and then create a small PR for this.
from swagger-cli.
Related Issues (20)
- swagger-cli validation returns errors one by one
- invalid examples should not fail validation
- Dependabot warning for validator
- $ref bug resolving an existing folder HOT 1
- swagger-cli validate does not ensure unique operationIds
- Validate security keys against securitySchemes HOT 1
- Error: Token "Components" Does Not Exist HOT 6
- Combining multiple files can create circular references HOT 1
- Ref incorrect if path contains "{" or "}" HOT 1
- Bad error message on incorrect path provided
- Latest version of the CLI I'm getting the following error HOT 5
- bundle and validate commands are failing due to swagger-parser HOT 3
- Validation of composite keywords (anyOf, oneOf, allOf) HOT 1
- False positive: #/servers/0/variables/someParameter must NOT have unevaluated properties
- Undeclared parameters in server url should not validate
- Property examples are converted to the wrong date format
- The order of the directive changes between versions of the dependent package
- Combining multiple files into one keeps references to some api files HOT 1
- [BUG] String enum of '08' and '09 ' are wrong bundled HOT 1
- bundle removes quotes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swagger-cli.