2

In ScalaDoc I want to have a link to an annotation from a library: discriminator.

My ScalaDoc:

/** Trait must be marked with [[json.schema.discriminator]] annotation. */

But ScalaDoc generation fails with the following error:

Could not find any member to link for "json.schema.discriminator".

UPD: It appeared that errors were because of -Xfatal-warnings scalac option.

Once it got clear I found sbt-api-mappings SBT plugin which resolves all external references with javadoc.io.

Denis Kokorin
  • 887
  • 8
  • 17
  • Sure, I have to do so because I use that annotation. Probably the issue here is that annotation (by Scala style) should start with lowercase letter. – Denis Kokorin Nov 17 '21 at 06:53
  • Unfortunately no: discriminator annotations is in json.schema package. So I specify full name. – Denis Kokorin Nov 17 '21 at 07:01

1 Answers1

1

You probably don't find it because you don't import the correct package. Please note that the json.schema.discriminator class is part of the "scala-jsonschema-core" package.

Therefore you need to add to your build.sbt:

name := "StackOverflow"
version := "0.1"
scalaVersion := "2.13.6"

libraryDependencies += "com.github.andyglow" %% "scala-jsonschema-core" % "0.7.6"
libraryDependencies += "com.github.andyglow" %% "scala-jsonschema-core" % "0.7.6" classifier "javadoc"

Then you can use it the same as you tried:

/** Trait must be marked with [[json.schema.discriminator]] annotation. */

enter image description here

Then sbt doc works:

enter image description here

Tomer Shetah
  • 8,413
  • 7
  • 27
  • 35
  • And now it's more clear. Thank you. It appeared that I have -Xfatal-warnings scalac option enabled. Without it ScalaDoc is just a warning. – Denis Kokorin Nov 17 '21 at 13:15