Comments (14)
Feeding the data to swagger-ui will display the paths in the wrong order. This might be confusing for people if they want to preserve the order in the generated api docs.
from play-swagger.
@carlsonngo thanks for reporting, I am curious how important this order is to you?
from play-swagger.
@carlsonngo thanks for the context.
from play-swagger.
+1 For me it's not even reverse order, but a completely random one. Using 0.2.0.
from play-swagger.
+1 for me, it is displayed as random order. Using play 2.5.4, play-swagger 0.5.0
from play-swagger.
So how do we order, using play 2.5.x, play-swagger 0.5.3? Looks random to me.
from play-swagger.
@tculshaw we haven't implement the feature the preserve the ordering in the routes file. Any PR will be more than welcome :)
from play-swagger.
If any one is interested I have a partial solution, hence this isn't a formal pull request.
Replacing the path function in SwaggerSpecGenerator, I order the main unique paths as per the ROUTE file, but NOT the order where multiple methods (GET,PUT,POST,DELETE) apply to the same path. It's a lot better than it used to be, and will suffice for my needs, but still not quite 100%!
private def paths(routes: Seq[Route], prefix: String, tag: Option[Tag]): JsObject = {
JsObject {
val endPointEntries = routes.flatMap(route => endPointEntry(route, prefix, tag))
val zgbp = endPointEntries.zipWithIndex.groupBy(_._1._1)
import collection.mutable.LinkedHashMap
val lhm = LinkedHashMap(zgbp.toSeq sortBy (_._2.head._2): _*)
val gbp2 = lhm mapValues (_ map (_._1)) toSeq
gbp2.toSeq.map( x => (x._1,x._2.map(_._2).reduce(_ deepMerge _)))
}
}
I banged my head against the wall to get this going, so hope this is helpful to somebody!
from play-swagger.
Thanks very much @tculshaw, it's not quite 100% but it's still a step forward. I will appreciate it if you want to submit a PR (just need a simple test for the ordering).
from play-swagger.
This can now be closed? Thanks for accepting my change #152
from play-swagger.
@tculshaw it's still a partial solution right? ("NOT the order where multiple methods (GET,PUT,POST,DELETE) apply to the same path")
from play-swagger.
from play-swagger.
I imagine it would be nice for some users, but I don't particularly have that need in my projects. Thanks for offering! And thanks again for your contribution!
from play-swagger.
from play-swagger.
Related Issues (20)
- Request parameters not visible in Swagger ui
- Open API spec generated is incorrect
- Swagger generating type zoneddatetime in the swagger json
- Support for Optional in schemas
- Swagger Custom Mappings not working with multiples parameters HOT 1
- array[byte] transforms to array-byte .Must transform string
- Swagger-ui compatibility HOT 4
- How to request a release? HOT 2
- Which PLAY versions must be supported? HOT 2
- Please release 0.11.0 HOT 2
- Allow passing classloader to DefinitionGenerator HOT 1
- Definitions description based on Scaladoc HOT 2
- Please Release 0.13.0
- Reusable enums are not working HOT 1
- Skip routes w/ no Swagger Spec comment HOT 1
- java.util.zip.ZipException: duplicate entry: public/swagger.json HOT 1
- Support Scala 3 HOT 2
- Wildcard matching for `swaggerDomainNameSpaces` HOT 1
- [Urgent] Deployment Failures of This Repository Since April. HOT 4
- Remove Swagger Json from Public Folder HOT 1
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 play-swagger.