Skip to content

Commit

Permalink
Add changelog entry, fixes for website output
Browse files Browse the repository at this point in the history
  • Loading branch information
Grifs committed Dec 9, 2024
1 parent b9b2a90 commit e514e9c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ TODO add summary

* `RRequirements`: Allow single quotes to be used again in the `.script` field (PR #771).

* `scala`: Update Scala to Scala 3 (PR #759).
For most of the code, this was a minor update, so no breaking changes are expected.
The biggest change is how the exporting of the schema is done, but this has no impact on the user.
However, switching to Scala 3 allows for additional features and improvements in the future.

## BUG FIXES

* `config build`: Fix a bug where a missing main script would cause a stack trace instead of a proper error message (PR #776).
Expand Down
13 changes: 9 additions & 4 deletions src/main/scala/io/viash/helpers/SysEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@ package io.viash.helpers

import io.viash.schemas._

trait SysEnvTrait {
def viashHome: String
def viashVersion: Option[String]
}

@nameOverride("EnvironmentVariables")
@description("Viash checks several environment variables during operation.")
@documentFully
trait SysEnvTrait {
case class SysEnvCC(
@nameOverride("VIASH_HOME")
@description(
"""If `VIASH_HOME` is not defined, the fallback `HOME`/.viash is used.
|
|Location where specific downloaded versions of Viash will be cached and run from.
|""")
def viashHome: String
viashHome: String,

@nameOverride("VIASH_VERSION")
@description(
Expand All @@ -40,8 +45,8 @@ trait SysEnvTrait {
"""VIASH_VERSION=0.7.0 viash ns build""",
"sh"
)
def viashVersion: Option[String]
}
viashVersion: Option[String]
) extends SysEnvTrait


object SysEnv extends SysEnvTrait {
Expand Down
12 changes: 1 addition & 11 deletions src/main/scala/io/viash/schemas/CollectedSchemas.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object CollectedSchemas {
getMembers[Config](),
getMembers[PackageConfig](),
getMembers[BuildInfo](),
getMembers[SysEnvTrait](),
getMembers[SysEnvCC](),

getMembers[Functionality](),
getMembers[Author](),
Expand Down Expand Up @@ -144,16 +144,6 @@ object CollectedSchemas {
)
}

private def trimTypeName(s: String) = {
// first: io.viash.helpers.data_structures.OneOrMore[String] -> OneOrMore[String]
// second: List[io.viash.platforms.requirements.Requirements] -> List[Requirements]
// third: Either[String,io.viash.functionality.dependencies.Repository] -> Either[String,Repository]
s
.replaceAll("""^(\w*\.)*""", "")
.replaceAll("""(\w*)\[[\w\.]*?(\w*)(\[_\])?\]""", "$1[$2]")
.replaceAll("""(\w*)\[[\w\.]*?(\w*),[\w\.]*?(\w*)\]""", "$1[$2,$3]")
}

val fullData = memberData_part1.part ++ memberData_part2.part ++ memberData_part3.part

// Main call for documentation output
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/viash/schemas/ParameterSchema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ object ParameterSchema {
}

val description = annotations.collectFirst({case (name, value) if name.endsWith("description") => value.head})
val example = annotations.collect({case (name, value) if name.endsWith("example") => value}).map(ExampleSchema(_))
val exampleWithDescription = annotations.collect({case (name, value) if name.endsWith("exampleWithDescription") => value}).map(ExampleSchema(_))
val example = annotations.collect({case (name, value) if name.endsWith("example") => value}).map(ExampleSchema(_)).reverse
val exampleWithDescription = annotations.collect({case (name, value) if name.endsWith("exampleWithDescription") => value}).map(ExampleSchema(_)).reverse
val examples = example ::: exampleWithDescription match {
case l if l.length > 0 => Some(l)
case _ => None
Expand Down

0 comments on commit e514e9c

Please sign in to comment.