1

swagger.js

enter image description here

I have swagger.js it contain 100,000 lines of codes. It contain about 50 sections of routes.

Yep, 100,000 lines

You guys can imagine how brutal it is to even look at it.

Example.

enter image description here

I’m thinking

to slice my main file into peaces and include them back. I would prefer crate a : swagger/ inside that, I will place section1.js , section2.js ,... section50.js .

Benifits

  • When I need to add more section in the future, I can just create one more js. Ex. newSection.js
  • When I need update a tiny thing, I can just go into that specific section, and update it without to messed around with 100,000 lines of codes.
  • It’s much more easier to maintenance.
  • It’s less CPU intensive for my IDE. My computer fan went nuts when I open that file.
  • Faster to find what to modify/add

Can someone please show me to get start on that ?

Community
  • 1
  • 1
code-8
  • 54,650
  • 106
  • 352
  • 604
  • Does this answer your question? [How to break Swagger 2.0 JSON file into multiple modules](https://stackoverflow.com/q/26917188/113116) – Helen May 15 '20 at 14:44

1 Answers1

1

You can try yamlinc to split the file into multiple files referencing them with $include properties and compile back again.