Skip to content

Commit deb8ae3

Browse files
authored
NODE-2541 Bumped swagger-ui to 4.15.5 (#3791)
1 parent 573c86c commit deb8ae3

File tree

29 files changed

+124
-182
lines changed

29 files changed

+124
-182
lines changed

benchmark/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ enablePlugins(JmhPlugin)
33
Jmh / version := "1.33"
44

55
libraryDependencies ++= Seq(
6-
"org.scodec" %% "scodec-core" % "1.11.9"
6+
"org.scodec" %% "scodec-core" % "1.11.10"
77
) ++ Dependencies.logDeps
88

99
// https://github.com/ktoso/sbt-jmh#adding-to-your-project

benchmark/src/main/scala/com/wavesplatform/state/bench/DataTestData.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import java.nio.charset.StandardCharsets
55
import com.wavesplatform.common.state.ByteStr
66
import com.wavesplatform.lang.v1.traits.DataType
77
import scodec.Codec
8-
import scodec.bits._
9-
import scodec.codecs._
8+
import scodec.bits.*
9+
import scodec.codecs.*
1010

1111
case class DataTestData(addr: ByteStr, key: String, dataType: DataType)
1212

1313
object DataTestData {
1414

1515
implicit val dt: Discriminated[DataType, Int] = Discriminated[DataType, Int](uint8)
1616
implicit val dtCodec: Codec[DataType] = mappedEnum(uint8, DataType.Boolean -> 0, DataType.ByteArray -> 1, DataType.Long -> 2, DataType.String -> 3)
17-
implicit val byteStrCodec: Codec[ByteStr] = bits.contramap[ByteStr](byteStr => BitVector(byteStr.arr)).asInstanceOf
17+
implicit val byteStrCodec: Codec[ByteStr] = bits.contramap[ByteStr](byteStr => BitVector(byteStr.arr)).encodeOnly
1818

1919
val codec: Codec[DataTestData] = {
2020
("addr" | variableSizeBytes(uint8, byteStrCodec)) ::

build.sbt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ lazy val `waves-node` = (project in file("."))
123123

124124
inScope(Global)(
125125
Seq(
126-
scalaVersion := "2.13.8",
126+
scalaVersion := "2.13.10",
127127
organization := "com.wavesplatform",
128128
organizationName := "Waves Platform",
129129
organizationHomepage := Some(url("https://wavesplatform.com")),
@@ -144,7 +144,6 @@ inScope(Global)(
144144
"-Wconf:cat=deprecation&site=com.wavesplatform.state.InvokeScriptResult.*:s"
145145
),
146146
crossPaths := false,
147-
dependencyOverrides ++= Dependencies.enforcedVersions.value,
148147
cancelable := true,
149148
parallelExecution := true,
150149
/* http://www.scalatest.org/user_guide/using_the_runner

lang/shared/src/main/scala/com/wavesplatform/lang/v1/task/TaskMTInstances.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.wavesplatform.lang.v1.task
22

3-
import cats.mtl.MonadState
3+
import cats.mtl.Stateful
44
import cats.{Monad, MonadError, StackSafeMonad}
55
import com.wavesplatform.lang.EvalF
66

77
trait TaskMTInstances {
88

99
object TF extends TaskMTFunctions
1010

11-
implicit def monadError[F[_] : Monad, S, E](implicit m: Monad[EvalF[F, *]]): MonadError[TaskMT[F, S, E, *], E] =
11+
implicit def monadError[F[_]: Monad, S, E](implicit m: Monad[EvalF[F, *]]): MonadError[TaskMT[F, S, E, *], E] =
1212
new MonadError[TaskMT[F, S, E, *], E] with StackSafeMonad[TaskMT[F, S, E, *]] {
1313
override def pure[A](x: A): TaskMT[F, S, E, A] =
1414
TF.pure(x)
@@ -23,8 +23,8 @@ trait TaskMTInstances {
2323
fa.handleErrorWith(f)
2424
}
2525

26-
implicit def monadState[F[_]: Monad, S, E](implicit m: Monad[EvalF[F, *]]): MonadState[TaskMT[F, S, E, *], S] =
27-
new MonadState[TaskMT[F, S, E, *], S] {
26+
implicit def monadState[F[_]: Monad, S, E](implicit m: Monad[EvalF[F, *]]): Stateful[TaskMT[F, S, E, *], S] =
27+
new Stateful[TaskMT[F, S, E, *], S] {
2828
override val monad: Monad[TaskMT[F, S, E, *]] = monadError[F, S, E]
2929

3030
override def get: TaskMT[F, S, E, S] = TF.get

lang/tests/src/test/scala/com/wavesplatform/lang/parser/ScriptParserTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class ScriptParserTest extends PropSpec with ScriptGenParser {
346346
List("then", "else", "true").foreach { keyword =>
347347
property(s"reserved keywords are invalid variable names in block: $keyword") {
348348
val script =
349-
s"""let ${keyword.padTo(4, " ").mkString} = 1
349+
s"""let ${keyword.padTo(4, ' ').mkString} = 1
350350
|true""".stripMargin
351351
parse(script) shouldBe BLOCK(
352352
AnyPos,
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<configuration>
3-
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
4-
<target>System.out</target>
5-
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
6-
<level>${logback.stdout.level:-DEBUG}</level>
7-
</filter>
8-
<encoder>
9-
<pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{26} - %msg%n</pattern>
10-
</encoder>
11-
</appender>
12-
133
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
144
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
155
<level>${logback.file.level:-TRACE}</level>
@@ -25,6 +15,6 @@
2515
<logger name="io.netty" level="INFO"/>
2616

2717
<root level="TRACE">
28-
<appender-ref ref="${waves.it.logging.appender:-STDOUT}"/>
18+
<appender-ref ref="FILE"/>
2919
</root>
3020
</configuration>

node-it/src/test/scala/com/wavesplatform/it/sync/smartcontract/InvokePaymentsAvailabilitySuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ class InvokePaymentsAvailabilitySuite extends BaseTransactionSuite {
9494
sender.assetBalance(callerAddress, assetId).balance shouldBe callerStartBalance - paymentAmount
9595

9696
val expectingProxyDAppBalance = 0
97-
List(
97+
List[Any](
9898
sender.assetBalance(proxyDAppAddress, assetId).balance,
9999
sender.getData(proxyDAppAddress, "balance_self").head.value
100100
).foreach(_ shouldBe proxyStartBalance + expectingProxyDAppBalance)
101101

102102
val expectingCallingDAppBalance = paymentAmount
103-
List(
103+
List[Any](
104104
sender.assetBalance(callingDAppAddress, assetId).balance,
105105
sender.getData(proxyDAppAddress, "balance_calling_dApp").head.value
106106
).foreach(_ shouldBe callingDAppStartBalance + expectingCallingDAppBalance)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
html {
2+
box-sizing: border-box;
3+
overflow: -moz-scrollbars-vertical;
4+
overflow-y: scroll;
5+
}
6+
7+
*,
8+
*:before,
9+
*:after {
10+
box-sizing: inherit;
11+
}
12+
13+
body {
14+
margin: 0;
15+
background: #fafafa;
16+
}
Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,19 @@
11
<!-- HTML for static distribution bundle build -->
22
<!DOCTYPE html>
33
<html lang="en">
4-
<head>
4+
<head>
55
<meta charset="UTF-8">
66
<title>Swagger UI</title>
7-
<link rel="stylesheet" type="text/css" href="./swagger-ui.css">
8-
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32"/>
9-
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16"/>
10-
<style>
11-
html
12-
{
13-
box-sizing: border-box;
14-
overflow: -moz-scrollbars-vertical;
15-
overflow-y: scroll;
16-
}
7+
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
8+
<link rel="stylesheet" type="text/css" href="index.css" />
9+
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
10+
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
11+
</head>
1712

18-
*,
19-
*:before,
20-
*:after
21-
{
22-
box-sizing: inherit;
23-
}
24-
25-
body
26-
{
27-
margin:0;
28-
background: #fafafa;
29-
}
30-
31-
</style>
32-
</head>
33-
34-
<body>
35-
<div id="swagger-ui"></div>
36-
37-
<script src="./swagger-ui-bundle.js"></script>
38-
<script src="./swagger-ui-standalone-preset.js"></script>
39-
<script>
40-
window.onload = function() {
41-
// Begin Swagger UI call region
42-
const ui = SwaggerUIBundle({
43-
url: "/api-docs/openapi.yaml",
44-
dom_id: '#swagger-ui',
45-
deepLinking: true,
46-
presets: [
47-
SwaggerUIBundle.presets.apis,
48-
SwaggerUIStandalonePreset
49-
],
50-
plugins: [
51-
SwaggerUIBundle.plugins.DownloadUrl
52-
],
53-
layout: "StandaloneLayout",
54-
tagsSorter: "alpha",
55-
operationsSorter: "alpha"
56-
})
57-
// End Swagger UI call region
58-
59-
window.ui = ui
60-
}
61-
62-
</script>
63-
</body>
13+
<body>
14+
<div id="swagger-ui"></div>
15+
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
16+
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
17+
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
18+
</body>
6419
</html>

node/src/main/resources/swagger-ui/oauth2-redirect.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
var isValid, qp, arr;
1414

1515
if (/code|token|error/.test(window.location.hash)) {
16-
qp = window.location.hash.substring(1);
16+
qp = window.location.hash.substring(1).replace('?', '&');
1717
} else {
1818
qp = location.search.substring(1);
1919
}
@@ -38,7 +38,7 @@
3838
authId: oauth2.auth.name,
3939
source: "auth",
4040
level: "warning",
41-
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
41+
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
4242
});
4343
}
4444

@@ -58,7 +58,7 @@
5858
authId: oauth2.auth.name,
5959
source: "auth",
6060
level: "error",
61-
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
61+
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
6262
});
6363
}
6464
} else {
@@ -67,10 +67,13 @@
6767
window.close();
6868
}
6969

70-
window.addEventListener('DOMContentLoaded', function () {
71-
run();
72-
});
73-
70+
if (document.readyState !== 'loading') {
71+
run();
72+
} else {
73+
document.addEventListener('DOMContentLoaded', function () {
74+
run();
75+
});
76+
}
7477
</script>
7578
</body>
7679
</html>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
window.onload = function() {
2+
//<editor-fold desc="Changeable Configuration Block">
3+
4+
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
5+
window.ui = SwaggerUIBundle({
6+
url: "/api-docs/openapi.yaml",
7+
dom_id: '#swagger-ui',
8+
deepLinking: true,
9+
presets: [
10+
SwaggerUIBundle.presets.apis,
11+
SwaggerUIStandalonePreset
12+
],
13+
plugins: [
14+
SwaggerUIBundle.plugins.DownloadUrl
15+
],
16+
layout: "StandaloneLayout",
17+
tagsSorter: "alpha",
18+
operationsSorter: "alpha"
19+
});
20+
21+
//</editor-fold>
22+
};

node/src/main/resources/swagger-ui/swagger-ui-bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/main/resources/swagger-ui/swagger-ui-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/main/resources/swagger-ui/swagger-ui-standalone-preset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/main/resources/swagger-ui/swagger-ui-standalone-preset.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/main/resources/swagger-ui/swagger-ui.css

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/main/resources/swagger-ui/swagger-ui.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/main/resources/swagger-ui/swagger-ui.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/main/resources/swagger-ui/swagger-ui.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/main/scala/com/wavesplatform/transaction/smart/WavesEnvironment.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,20 @@ class WavesEnvironment(
140140
}
141141

142142
override def accountWavesBalanceOf(addressOrAlias: Recipient): Either[String, Environment.BalanceDetails] = {
143-
(for {
144-
aoa <- addressOrAlias match {
145-
case Address(bytes) => AddressOrAlias.fromBytes(bytes.arr)
146-
case Alias(name) => com.wavesplatform.account.Alias.create(name)
147-
}
148-
address <- blockchain.resolveAlias(aoa)
143+
val addressE: Either[ValidationError, account.Address] = addressOrAlias match {
144+
case Address(bytes) => account.Address.fromBytes(bytes.arr)
145+
case Alias(name) => account.Alias.create(name).flatMap(a => blockchain.resolveAlias(a))
146+
}
147+
for {
148+
address <- addressE.leftMap(_.toString)
149149
portfolio = currentBlockchain().wavesPortfolio(address)
150150
effectiveBalance <- portfolio.effectiveBalance
151151
} yield Environment.BalanceDetails(
152152
portfolio.balance - portfolio.lease.out,
153153
portfolio.balance,
154154
blockchain.generatingBalance(address),
155155
effectiveBalance
156-
)).left.map(_.toString)
156+
)
157157
}
158158

159159
override def transactionHeightById(id: Array[Byte]): Option[Long] =

node/src/test/scala/com/wavesplatform/api/http/TraceResultJsonTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TraceResultJsonTest extends PropSpec with JsonMatchers {
2121
for {
2222
publicKey <- PublicKey.fromBase58String("9utotH1484Hb1WdAHuAKLjuGAmocPZg7jZDtnc35MuqT")
2323
address <- Address.fromString("3MydsP4UeQdGwBq7yDbMvf9MzfB2pxFoUKU")
24-
proof <- ByteStr.decodeBase58("4scXzk4WiKMXG8p7V6J2pmznNZCgMjADbbZPSDGg28YLMKgshBmNFNzgYg2TwfKN3wMtgLiNQB77iQQZkH3roUyJ").toEither
24+
proof = ByteStr.decodeBase58("4scXzk4WiKMXG8p7V6J2pmznNZCgMjADbbZPSDGg28YLMKgshBmNFNzgYg2TwfKN3wMtgLiNQB77iQQZkH3roUyJ").get
2525
tx <- InvokeScriptTransaction.create(
2626
1.toByte,
2727
sender = publicKey,

node/src/test/scala/com/wavesplatform/http/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ package object http {
6464
Base58
6565
.tryDecodeWithLimit(str)
6666
.toEither
67-
.flatMap(AddressOrAlias.fromBytes)
67+
.flatMap[Object, AddressOrAlias](AddressOrAlias.fromBytes)
6868
.map(JsSuccess(_))
6969
.getOrElse(JsError("Can't read PublicKey"))
7070

node/src/test/scala/com/wavesplatform/mining/BlockWithMaxBaseTargetTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class BlockWithMaxBaseTargetTest extends FreeSpec with WithDB with DBCacheSettin
9898
}
9999
})
100100

101-
val blockAppendTask = BlockAppender(bcu, ntpTime, utxPoolStub, pos, scheduler)(lastBlock).onErrorRecoverWith { case _: SecurityException =>
101+
val blockAppendTask = BlockAppender(bcu, ntpTime, utxPoolStub, pos, scheduler)(lastBlock).onErrorRecoverWith[Any] { case _: SecurityException =>
102102
Task.unit
103103
}
104104
Await.result(blockAppendTask.runToFuture(scheduler), Duration.Inf)

node/src/test/scala/com/wavesplatform/state/diffs/ci/InvokePaymentsAvailabilityTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ class InvokePaymentsAvailabilityTest extends PropSpec with Inside with DBCacheSe
101101
d.blockchain.balance(invoke.senderAddress, asset) shouldBe ENOUGH_AMT - paymentAmount
102102

103103
val expectingProxyDAppBalance = 0
104-
List(
104+
List[Any](
105105
d.blockchain.balance(proxyDApp, asset),
106106
d.blockchain.accountData(proxyDApp, "balance_self").get.value
107107
).foreach(_ shouldBe expectingProxyDAppBalance)
108108

109109
val expectingCallingDAppBalance = paymentAmount
110-
List(
110+
List[Any](
111111
d.blockchain.balance(callingDApp, asset),
112112
d.blockchain.accountData(proxyDApp, "balance_calling_dApp").get.value
113113
).foreach(_ shouldBe expectingCallingDAppBalance)

node/src/test/scala/com/wavesplatform/state/diffs/smart/eth/EthereumInvokeTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class EthereumInvokeTest extends PropSpec with WithDomain with EthHelpers {
9797

9898
private def hexData(script: Script, assets: Seq[IssuedAsset]) = {
9999
val signature = ABIConverter(script).funcByMethodId.collectFirst { case (_, f) if f.name == "default" => f }.get
100-
val args = new Tuple(passingArg, Array[Tuple](assets.map(a => new Tuple(a.id.arr, paymentAmount))*))
100+
val args = Tuple.of(passingArg, Array[Tuple](assets.map(a => Tuple.of(a.id.arr, paymentAmount))*))
101101
val call = new Function(signature.ethSignature).encodeCall(args).array()
102102
FastHex.encodeToString(call, 0, call.length)
103103
}

node/src/test/scala/com/wavesplatform/transaction/BlockchainUpdaterTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class BlockchainUpdaterTest extends FreeSpec with HistoryTest with WithDomain {
221221
b.processBlock(getNextTestBlockWithVotes(b, Seq(-1))) should beRight
222222
}
223223

224-
Try(b.processBlock(getNextTestBlockWithVotes(b, Seq(-1)))).recover { case _: SecurityException => // NOP
224+
Try(b.processBlock(getNextTestBlockWithVotes(b, Seq(-1)))).recover[Any] { case _: SecurityException => // NOP
225225
}
226226

227227
signal.tryAcquire(10, TimeUnit.SECONDS)

0 commit comments

Comments
 (0)