Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Swagger core 2.0.0 #56

Closed
wants to merge 19 commits into from

Conversation

pjfanning
Copy link
Contributor

@pjfanning pjfanning commented Aug 10, 2018

Relates to #49

  • Uses changes in swagger-core 2.0.4
  • The only thing that is broken compared to v1.0.4 is scala enum support

@pjfanning
Copy link
Contributor Author

I've published this branch as a snapshot to https://oss.sonatype.org/content/repositories/staging/

"com.github.swagger-akka-http" %% "swagger-scala-module" % "2.0.0-SNAPSHOT"

@pjfanning pjfanning changed the title WIP: Swagger core 2.0.0 Swagger core 2.0.0 Sep 15, 2018
@zsoltherpai
Copy link

An issue I noticed with this one: the optional values in scala case classes are documented as objects with 2 fields: "empty", "defined"

@pjfanning
Copy link
Contributor Author

@zsoltherpai could you be hitting #55 ?

@zsoltherpai
Copy link

zsoltherpai commented Oct 5, 2018

@zsoltherpai could you be hitting #55 ?

Sorry that was my mistake, the converter has not been correctly registered.

Another issue I noticed: Option[AnyRef] works fine now but having problems with Option[AnyVal]

For example Option[Int] shows up as
{ "type" : "object" }

Annotating the field as a temporary workaround didn't work (still type: object)
@Schema(type= "integer")`

@pjfanning
Copy link
Contributor Author

@zsoltherpai I've reproduced the issue where @Parameter and @Schema annotations don't seem to seem to allow overrides of the param type - most of the code that is used in the model generation comes from https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-jaxrs2 - so might be best to report that issue there

One workaround is to use Option[BigInt] instead of Option[Int]. The type erasure issue only seems to affect primitives like Int, Boolean etc.

@pjfanning
Copy link
Contributor Author

@zsoltherpai I fixed the issue with the annotations being ignored in my fork of swagger-scala-module. There is a sample that demonstrates the fix - https://github.com/pjfanning/swagger-akka-http-sample

@zsoltherpai
Copy link

zsoltherpai commented Oct 11, 2018 via email

@zsoltherpai
Copy link

zsoltherpai commented Oct 11, 2018 via email

@reppners
Copy link

reppners commented Feb 3, 2020

Would this PR enable enum support? Is there anything I can do to support the effort?

@pjfanning
Copy link
Contributor Author

https://github.com/pjfanning/swagger-akka-http-sample has an example of how to handle an enum with swagger-2 - not ideal but I haven't been able to fix the automatic handling of enums

@gaeljw
Copy link

gaeljw commented Jul 11, 2020

Wow great work, how can we make the project move forward especially with this PR?

@pjfanning
Copy link
Contributor Author

I have a fork that supports swagger 2 / OpenAPI 3 - https://github.com/swagger-akka-http/swagger-scala-module

@pjfanning pjfanning closed this Sep 6, 2020
@gaeljw
Copy link

gaeljw commented Sep 6, 2020

@pjfanning Do you use the swagger-scala-module only? I started having a look at using it in swagger-play but there's a significant amount of changes, not sure it's worth the effort considering that other alternatives such as Tapir already provides OAS 3.0 support (in a totally different way than swagger-play obviously).

@pjfanning
Copy link
Contributor Author

@gaeljw I'm keeping alive swagger-scala-module (in a fork) because it is used in some existing libs that can use the updated code. It is good to see alternatives because swagger-scala-module is based on Java reflection and there are issues with type erasure that can be avoided with alternative approaches.

I just gave up on this PR because it is time consuming to keep it updated but with little chance of it being merged.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants