Skip to content

Commit

Permalink
Merge pull request #449 from NDLANO/update-swagger-doc
Browse files Browse the repository at this point in the history
Add resourcetype list to swaggerdoc
  • Loading branch information
gunnarvelle authored Apr 12, 2024
2 parents 06101b2 + f5ad6b7 commit d4f73f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import com.scalatsi.TypescriptType.{TSLiteralString, TSUnion}
import com.scalatsi.{TSNamedType, TSType}
import enumeratum.*

sealed abstract class ResourceType(override val entryName: String) extends EnumEntry {}
sealed abstract class ResourceType(override val entryName: String) extends EnumEntry {
override def toString: String = entryName
}

object ResourceType extends Enum[ResourceType] with CirceEnum[ResourceType] {
override val values: IndexedSeq[ResourceType] = findValues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package no.ndla.myndlaapi.controller

import no.ndla.common.errors.NotFoundException
import no.ndla.common.model.api.SingleResourceStats
import no.ndla.common.model.domain.ResourceType
import no.ndla.myndlaapi.Eff
import no.ndla.myndlaapi.model.api.Stats
import no.ndla.myndlaapi.service.FolderReadService
Expand All @@ -17,8 +18,8 @@ import no.ndla.network.tapir.{Service, TapirErrorHelpers}
import no.ndla.network.tapir.TapirErrors.errorOutputsFor
import sttp.tapir.EndpointInput
import sttp.tapir.server.ServerEndpoint
import sttp.tapir._
import sttp.tapir.generic.auto._
import sttp.tapir.*
import sttp.tapir.generic.auto.*
import sttp.tapir.model.CommaSeparated

trait StatsController {
Expand All @@ -39,7 +40,11 @@ trait StatsController {
}
}
private val pathResourceType =
path[CommaSeparated[String]]("resourceType").description("The type of the resource to look up")
path[CommaSeparated[String]]("resourceType")
.description(
s"The type of the resource to look up. Comma separated list to support ${ResourceType.Multidisciplinary}. Possible values ${ResourceType.values
.mkString(", ")}"
)
private val pathResourceIds =
path[CommaSeparated[String]]("resourceIds").description("IDs of the resources to look up")

Expand Down

0 comments on commit d4f73f7

Please sign in to comment.