Skip to content

Commit

Permalink
Mitigate `spray.json.JsonParser$ParsingException: Unexpected end-of-i…
Browse files Browse the repository at this point in the history
…nput` at `PersistenceSchemaWriter`
  • Loading branch information
PawelLipski committed Apr 24, 2023
1 parent 53846ab commit 9e3b304
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.virtuslab.ash.writer

import scala.collection.mutable
import scala.util.Try

import better.files.File
import spray.json._
Expand All @@ -18,7 +19,7 @@ class PersistenceSchemaWriter(outputDirectory: File) extends DumpPersistenceSche
outputDirectory
.createDirectoryIfNotExists(createParents = true)
.list(_.extension.contains(".json"))
.map(_.contentAsString.parseJson.convertTo[TypeDefinition])
.flatMap(file => Try(file.contentAsString.parseJson.convertTo[TypeDefinition]).toOption)
.map(x => (x.name, x))
.toMap
}
Expand Down

0 comments on commit 9e3b304

Please sign in to comment.