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

ModelConverter fails on certain class definitions due to Java 8 and below limitations. #47

Open
dpogretskiy opened this issue Feb 15, 2018 · 1 comment

Comments

@dpogretskiy
Copy link

    sealed abstract class Status(val id: String) {
      def self: Status = this
    }
    case object New extends Status("new")
    case object Processed extends Status("processed")

Using this kind of constructions in model definitions leads to errors on Java 8 and below.

        at java.lang.Class.getSimpleName(Class.java:1330)
        at java.lang.Class.getCanonicalName(Class.java:1399)
        at io.swagger.jackson.ModelResolver._isOptionalType(ModelResolver.java:175)
        at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:157)
        at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:112)
        at io.swagger.scala.converter.SwaggerScalaModelConverter.resolveProperty(SwaggerScalaModelConverter.scala:70)
        at io.swagger.converter.ModelConverterContextImpl.resolveProperty(ModelConverterContextImpl.java:80)
        at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:464)
        at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:185)
        at io.swagger.scala.converter.SwaggerScalaModelConverter.resolve(SwaggerScalaModelConverter.scala:86)
        at io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:100)
        at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:236)
        at io.swagger.jackson.ModelResolver.resolve(ModelResolver.java:185)
        at io.swagger.scala.converter.SwaggerScalaModelConverter.resolve(SwaggerScalaModelConverter.scala:86)
        at io.swagger.converter.ModelConverterContextImpl.resolve(ModelConverterContextImpl.java:100)
        at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:161)
        at io.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:112)
        at io.swagger.scala.converter.SwaggerScalaModelConverter.resolveProperty(SwaggerScalaModelConverter.scala:70)
        at io.swagger.converter.ModelConverterContextImpl.resolveProperty(ModelConverterContextImpl.java:80)
        at io.swagger.converter.ModelConverters.readAsProperty(ModelConverters.java:58)
        at io.swagger.util.ParameterProcessor.applyAnnotations(ParameterProcessor.java:263)
        at play.modules.swagger.PlayReader.readImplicitParam(PlayReader.java:390)
        at play.modules.swagger.PlayReader.readImplicitParameters(PlayReader.java:360)
        at play.modules.swagger.PlayReader.read(PlayReader.java:198)
        at play.modules.swagger.PlayReader.read(PlayReader.java:63)
        at play.modules.swagger.PlayReader.read(PlayReader.java:57)
        at play.modules.swagger.ApiListingCache$.$anonfun$listing$1(ApiListingCache.scala:17)
        at scala.Option.orElse(Option.scala:289)
        at play.modules.swagger.ApiListingCache$.listing(ApiListingCache.scala:11)
        at play.modules.swagger.SwaggerPluginImpl.<init>(SwaggerPlugin.scala:164)
        at myutil.environment$ApplicationEnvironment.<init>(BootstrapLoader.scala:170)
        at myutil.BootstrapLoader.load(BootstrapLoader.scala:31)
        at play.core.server.ProdServerStart$.start(ProdServerStart.scala:51)
        at play.core.server.ProdServerStart$.main(ProdServerStart.scala:25)
        at play.core.server.ProdServerStart.main(ProdServerStart.scala)

It uses jackson ModelConverter and crashes whole plugin.

pjfanning pushed a commit to pjfanning/swagger-scala-module that referenced this issue Feb 16, 2018
@pjfanning
Copy link
Contributor

pjfanning@314fbee tests pass

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

No branches or pull requests

2 participants