Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 08 16:26
    scala-steward closed #368
  • Apr 08 16:26
    scala-steward commented #368
  • Apr 08 16:26
    scala-steward opened #371
  • Mar 25 04:22
    bpiper commented #362
  • Mar 25 04:21
    bpiper closed #362
  • Mar 14 22:19
    kailuowang commented #363
  • Mar 14 22:08
    kailuowang commented #363
  • Mar 14 22:06

    kailuowang on v0.10.3-PLAY2.8

    (compare)

  • Mar 14 22:06

    kailuowang on play2.8

    Setting version to 0.10.3-PLAY2… Setting version to 0.10.4-SNAPS… (compare)

  • Mar 14 21:54

    kailuowang on play2.8

    Handle non-aliased Scala collec… Merge branch 'play2.8' of githu… Merge pull request #363 from Bi… (compare)

  • Mar 14 21:54
    kailuowang closed #363
  • Mar 14 21:52

    kailuowang on master

    Update snakeyaml to 1.28 Merge pull request #366 from sc… (compare)

  • Mar 14 21:52
    kailuowang closed #366
  • Mar 14 19:34
    bpiper commented #363
  • Mar 14 19:33
    bpiper synchronize #363
  • Mar 12 14:21
    zcabjro commented #363
  • Feb 26 22:48
    scala-steward opened #370
  • Feb 26 22:48
    scala-steward opened #369
  • Feb 25 05:27
    scala-steward opened #368
  • Feb 25 05:27
    scala-steward synchronize #359
Justin Reeves
@justinallenreeves
got around it by hiding the type, adding offset and limit parameters to the base swagger.yml and referenceing them manually, which seems to almost entirely defeat the point of QueryStringBindable
Gabriel Francisco
@gabfssilva

Given something like

case class Envelope[T](success: Boolean, data: Option[T])
case class SampleData(foo: Foo, bar: Bar)
case class Foo(s: String)
case class Bar(b: Bar)

How would you create a definition/component schema for an endpoint that returns a Envelope[SampleData], not a SampleData?

You need to describe Envelope manually, for instance:

###
#  summary: fetch an user by id
#  responses:
#    200:
#      description: success
#      content:
#        application/json:
#          schema:
#            type: object
#            properties:
#              pagination:
#                $ref: '#/components/schemas/models.responses.Pagination'
#              messages:
#                type: array
#                items:
#                  $ref: '#/components/schemas/models.responses.Message'
#              _links:
#                type: object
#                properties:
#                  self:
#                    $ref: '#/components/schemas/models.responses.Link'
#              items:
#                type: array
#                items:
#                  $ref: '#/components/schemas/models.User'
#    404:
#      description: not found
#      content:
#        application/json:
#          schema:
#            type: object
#            example: {"messages":[{"type":"info","message":"Resource not found, maybe not created yet. Try again later."}]}
#            properties:
#              messages:
#                type: array
#                items:
#                  $ref: '#/components/schemas/models.responses.Message'
###
GET      /api/v1/users/:id                       controllers.UserController.fetchById(id: java.util.UUID)
Justin Reeves
@justinallenreeves
given every single model I have nests like that, that's a pain
I've cludged it together by using a extension that pulls in the schema for the model then replaces itself after generation with the correct response, but that's cludge
also couldn't use an output transformer because needed it to traverse and add the schema to the components first
prouzpe3
@prouzpe3
How exactly do I map Date field of a response body object to string? I have tried setting something in swagger-custom-mappings.yml as well as in swagger.yml but with no luck :/
Also, is there an easy way to provide example values of fields of transfered objects (body of a request / response).
Gabriel Francisco
@gabfssilva
@kailuowang could you take a look at iheartradio/play-swagger#327
Gabriel Ciuloaica
@devsprint_twitter
Hi, starting from yesterday, play-swagger suddenly stop working. It is working properly if I’m invoking sbt from my laptop, but it is not working anymore when it is run inside docker container. It works properly in docker container until yesterday. Now I’m getting a ClassNotFoundException (0.9.0-PLAY2.7 or 0.9.1-PLAY2.7):
[info] Compiling 2 Scala sources to /workspace/target/scala-2.12/classes ...
[error] (run-main-0) java.lang.ClassNotFoundException: com.iheart.playSwagger.SwaggerSpecRunner
[error] java.lang.ClassNotFoundException: com.iheart.playSwagger.SwaggerSpecRunner
[error]         at java.lang.ClassLoader.findClass(ClassLoader.java:530)
[error]         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]         at sbt.internal.inc.classpath.ClasspathFilter.loadClass(ClassLoaders.scala:84)
[error]         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]         at java.lang.Class.forName0(Native Method)
[error]         at java.lang.Class.forName(Class.java:348)
[error]         at sbt.Run.getMainMethod(Run.scala:132)
[error]         at sbt.Run.execute$1(Run.scala:78)
[error]         at sbt.Run.$anonfun$runWithLoader$4(Run.scala:92)
[error]         at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error]         at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
[error]         at sbt.TrapExit$App.run(TrapExit.scala:257)
[error]         at java.lang.Thread.run(Thread.java:748)
[warn] one warning found
[info] Done compiling.
[error] java.lang.RuntimeException: Nonzero exit code: 1
[error]         at scala.sys.package$.error(package.scala:30)
[error]         at com.iheart.sbtPlaySwagger.SwaggerPlugin$.$anonfun$projectSettings$15(SwaggerPlugin.scala:53)
[error]         at scala.util.Success.foreach(Try.scala:253)
[error]         at com.iheart.sbtPlaySwagger.SwaggerPlugin$.$anonfun$projectSettings$14(SwaggerPlugin.scala:53)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error]         at sbt.Execute.work(Execute.scala:290)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
Gabriel Ciuloaica
@devsprint_twitter
Regarding my previous reported issue, it was not reproducible locally due to the fact that the com.iheart %% play-swagger library was cached locally. The work-a-round that I have found was to add to the list of resolvers JCenter repository. What I still do not understand is why build in docker works previously without this change...
Quafadas
@Quafadas
@devsprint_twitter I've got exactly this error message. Would you have any further hints on how to get round it?
Gabriel Ciuloaica
@devsprint_twitter
@Quafadas Hi, I just added the JCenter resolver to the build.sbt resolvers += JCenterRepository
Quafadas
@Quafadas
@devsprint_twitter Thanks ... but alas... that solution hasn't worked for me, perhaps because I'm sat behind a corporate proxy. Will persevere a little, but think this one might be a bust.
Anil Kumar
@akandach
how to set the conext path for swagger swagger-ui.path and api-docs.path in the config file?
danielklein45
@danielklein45
Hi, does someone know of way for creating 2 different swagger_v<int>.json on the same package commands. Each swagger.json is originiated from a different routes file. I am trying to create 2 different jsons in order to seperate the UI by versions
Mododo
@Mododo

Hi everybody!
Run into

[error] java.lang.NoClassDefFoundError: play/routes/compiler/RoutesFileParser$
[error]     at com.iheart.playSwagger.SwaggerSpecGenerator.$anonfun$generateFromRoutesFile$1(SwaggerSpecGenerator.scala:96)
[error]     at scala.util.Success.flatMap(Try.scala:251)
[error]     at com.iheart.playSwagger.SwaggerSpecGenerator.loop$1(SwaggerSpecGenerator.scala:80)
[error]     at com.iheart.playSwagger.SwaggerSpecGenerator.generateFromRoutesFile(SwaggerSpecGenerator.scala:121)
[error]     at com.iheart.playSwagger.SwaggerSpecGenerator.generate(SwaggerSpecGenerator.scala:66)
[error]     at com.iheart.playSwagger.SwaggerSpecRunner$.swaggerJson(SwaggerSpecRunner.scala:33)
[error]     at com.iheart.playSwagger.SwaggerSpecRunner$.delayedEndpoint$com$iheart$playSwagger$SwaggerSpecRunner$1(SwaggerSpecRunner.scala:39)
[error]     at com.iheart.playSwagger.SwaggerSpecRunner$delayedInit$body.apply(SwaggerSpecRunner.scala:9)
[error]     at scala.Function0.apply$mcV$sp(Function0.scala:39)
[error]     at scala.Function0.apply$mcV$sp$(Function0.scala:39)
[error]     at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
[error]     at scala.App.$anonfun$main$1$adapted(App.scala:80)
[error]     at scala.collection.immutable.List.foreach(List.scala:392)
[error]     at scala.App.main(App.scala:80)
[error]     at scala.App.main$(App.scala:78)
[error]     at com.iheart.playSwagger.SwaggerSpecRunner$.main(SwaggerSpecRunner.scala:9)
[error]     at com.iheart.playSwagger.SwaggerSpecRunner.main(SwaggerSpecRunner.scala)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:498)

with play 2.8.2, sbt 1.2.8, scala 2.12.8, jre 8 and sbt-play-swagger 0.10.2-PLAY2.8, building in docker with only Nexus repo (no proxy for JCenter, had to add play-swagger manually).
Fixed it with

libraryDependencies += "com.typesafe.play" %% "routes-compiler" % "2.8.2" % "compile"

Please, explain me, why this helped? Why plugin could not find RoutesFileParser in sbt plugin libs? Build inside intellij varied with environment, sometimes working like a charm. Pointing to the fine manual with an url is highly appreciated!

ericdotdata
@ericdotdata
is there a simple way to run the swagger compile task during normal compile?
ericdotdata
@ericdotdata
(compile in Compile) := ((compile in Compile) dependsOn swagger).value, something like this?
Georgios Larkou
@glarkou
hello, is there a way to use play-swagger with the sird router? (https://www.playframework.com/documentation/2.8.x/ScalaSirdRouter)
Brad Rust
@bradrust
Using Play 2.8 scala, what is the right way to recompile/rebuild the /assets/swagger.json? I run from IntelliJ via "sbt run" and I can never get the asset to be rebuilt from my source ./conf/swagger.yml.
Jean-Julien ALVADO
@jjalvado
In the sbt shell, run swagger
1 reply
It will regenerate the swagger.hein artifact
Brad Rust
@bradrust
In my generated example value I am getting "Unknown type: collection.immutable.map-string_string"... I have tried numerous swagger-custom-mappings.yml attempts to resolve that. The examples I have seen have a different collection.immutable map syntax. Any thoughts on how to map Map's?
- type: collection\.immutable\.map\-string_string
  specAsParameter:
    - type: object
  specAsProperty:
    $ref: "#/definitions/SomeMapDef"
Jean-Julien ALVADO
@jjalvado
Hi Brad. I do have a similar case and this is working for me in the file 'swagger-custom-mappings.yml':
- type: collection.immutable.map[string,string]
  specAsParameter:
    - type: array
      items:
        type: object
        properties:
          key:
            type: string
          value:
            type: string
Brad Rust
@bradrust
@jjalvado, I could not get my Map to be custom-mapped with the 10's of permutations I tried. I am expecting the case class that contains the Map to be mapped correctly as a Response to an API endpoint (verses a URL parameter). Perhaps that is a different. Anyway, for now I am just writing the schema objects by hand for the ones I could not get mapped.
Has anyone written some complex info.description content -- that has markdown. Especially with regard to creating addition sections that are generated typically on the left-panel of a rendering. e.g... and "Introduction to the API" section with paragraphs of content which is somewhat formatted and presentable. I can write some html in a multi-line description but can't seem to figure out how to get new sections to render.
Jean-Julien ALVADO
@jjalvado
Hi Brad. This is my mistake. '.', '[' and ']' needs to be escaped
It I take back the example I sent you it should be:
- type: collection\.immutable\.map\[String\,\String\]
  specAsParameter:
    - type: array
      items:
        type: object
        properties:
          key:
            type: string
          value:
            type: string
There is no way this does not work as we use it on a regular basis
For your other question, we don't do it that way
What we do is that we have a very detailed documentation with exemples written in asciidoc and converted into html and we put link that specific sextion in the swagger description in our controller.
Jean-Julien ALVADO
@jjalvado
If needed, just send me your case class statement so that I can take a look
very sorry to mislead you in the first place
Brad Rust
@bradrust
Well, I swear I tried every permutation but your last response get me corrected. My output has an underscore for string_string and I had always (I guess) included the underscore or a space. But based on your response, this is how I am modelling mine.
- type: collection\.immutable\.map\[String,String\]
  specAsParameter:
    - type: object
      additionalProperties:
        type: string
Brad Rust
@bradrust
Is there a way to change the name of the automagic tag groupings of routes files? I have multiple routes files and the generated Tag is the name of the routes file. Is there a way to override that tag/name?
1 reply
Jean-Julien ALVADO
@jjalvado
Hi Brad. I didn't find how to do that....
your description of your map is kind of weird...
Jean-Julien ALVADO
@jjalvado
somehow, you should have an array of item
teh item being an object
with two properties
In my use case, the Map[String, String] is used as a key -> value Map
and with the description provided aboce
the description of the object schema is correct
Brad Rust
@bradrust
@jjalvado, I followed the suggested Map definition from the swagger definition for v3. As a response object, I think it is describing it properly however, I will take a look and make sure my realized request and response JSON is matching the generated examples. Thanks for helping BTW.
Brad Rust
@bradrust
@jjalvado, seems as my serialization of a Map to json looks like the following. And the generated/default example for the object matches it.
{
  "config":{
         "key1":"value1",
         "key2":"value2"
  }
}
Jean-Julien ALVADO
@jjalvado
Hi @bradrust , you are totally right and I changed my swagger. Thanks a lot!
Joe Netti
@nettijoe96
I deleted my previous message because I got it working! Thanks so much for making this library folks, it is very helpful
Joe Netti
@nettijoe96
All of my apis have the same 401, 403, and 500 messages. Is there a way to have this in swagger without adding it before every api in Routes?
Joe Netti
@nettijoe96
How do you reference scala enumeration in api parameters? this doesn't work (3.0.0):
- name: some name
  in: query
  required: false
  description: some description
  schema:
    $ref: '#/components/schemas/SomeEnum.SomeEnumType'