Comments (9)
https://github.com/pjfanning/swagger-akka-http-sample/blob/master/src/main/scala/com/example/akka/swagger/SwaggerDocService.scala doesn't seem overly complicated to me.
from swagger-akka-http.
As minimun it is redundant using scala.reflect where it is just not needed, no real difference but redundant conversions inside SwaggerHttpService:
object SwaggerDocService extends SwaggerHttpService {
//similar but with classes
override val apiTypes = Seq(classOf[AddService], classOf[HelloService])
override val host = "localhost:12345"
override val info = Info(version = "1.0")
override val externalDocs = Some(new ExternalDocs("Core Docs", "http://acme.com/docs"))
override val securitySchemeDefinitions = Map("basicAuth" -> new BasicAuthDefinition())
}
Additionally, in my case it doesnt work because I determine concrete type at runtime. I have a bunch of services and just registering them in SwaggerHttpService to be scanned and showed and it is much more convenient to use simple Class
instead of searching Type
when I register services at runtime, i.e. I do not know concrete list of services in advance to hardcode them.
from swagger-akka-http.
def toJavaTypeSet(apiTypes: Seq[Type]): Set[Class[_]] = {
apiTypes.map(t => getClassForType(t)).toSet
}
private lazy val mirror = scala.reflect.runtime.universe.runtimeMirror(getClass.getClassLoader)
def getClassForType(t: Type): Class[_] = {
mirror.runtimeClass(t.typeSymbol.asClass)
}
Is this really needed in SwaggerHttpService
object?
from swagger-akka-http.
If you are blocked, could you copy the SwaggerHttpService code into your own code base and modify it for your own usage?
I will look at changing from types to classes but it could take me a while to get back to it.
from swagger-akka-http.
yeah, thanks, I can possibly create PR tomorrow, if you are very busy).
from swagger-akka-http.
How about adding a new val apiClasses: Seq[Class[_]]
and merging the the 2 Seqs? This retains backward compatible support for apiTypes but allows users to use apiClasses instead (or as well).
from swagger-akka-http.
you broke compat since 0.10.0-SNAPSHOT so now master branch is not compatible with previous versions, so I guess it can be now split to two branches, old branch can remain compatible and new one I guess can be refactored with breaking it. What do you think about splitting?
from swagger-akka-http.
I like the scala type support and use it in my projects.
from swagger-akka-http.
Merged Pull Request
from swagger-akka-http.
Related Issues (20)
- Required properties do not work for case class with fields of the same type HOT 2
- Produce Swagger 2.0 Specification with swagger-akka-http v2.0.4 HOT 1
- Update to akka 2.6.x? HOT 7
- Disable swagger api and document generation. HOT 2
- How change swagger doc to Swagger 2.0.x specification instead of OpenApi 3 ? HOT 1
- How can I generate the complete API path when my routing are split into multiple classes? HOT 2
- add back ability to set schemes in Java API HOT 15
- add host and security to Java SwaggerGenerator HOT 1
- Generic type in ApiResponse HOT 1
- jackson 2.13 HOT 4
- Swagger-akka-http with UI built using webjar HOT 4
- Scala 3 binaries? HOT 1
- Swagger generates empty schemas HOT 7
- Some endpoints don't get generated, but with no error?? HOT 3
- Question : How can I specify one or more base URLs for the API using an array of servers? HOT 2
- support OpenAPI v3.1.0 HOT 1
- Update Jackson Dependency HOT 5
- Investigate switching to Pekko due to OS license change HOT 4
- NullPointerException when annotations are unavailable (not defined or private) HOT 5
- Support for Scala 3 cross compilation & upgrade of dependencies HOT 2
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-akka-http.