diff --git a/.gitignore b/.gitignore index 1fa814019e..fda1310d78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .idea/ target/ project/target/ -config.yaml arrow/target/ common/target/ diff --git a/arrow/src/test/scala-2.12/com/opticdev/arrow/changes/ChangesEvaluationSpec.scala b/arrow/src/test/scala-2.12/com/opticdev/arrow/changes/ChangesEvaluationSpec.scala index b9e8ccc04e..12e0832ae1 100644 --- a/arrow/src/test/scala-2.12/com/opticdev/arrow/changes/ChangesEvaluationSpec.scala +++ b/arrow/src/test/scala-2.12/com/opticdev/arrow/changes/ChangesEvaluationSpec.scala @@ -21,8 +21,6 @@ class ChangesEvaluationSpec extends TestBase with TestPackageProviders { assert(results.isSuccess) - println(results.stagedFiles.head._2.text) - assert(results.stagedFiles.head._2.text === expectedChange) } @@ -38,8 +36,6 @@ class ChangesEvaluationSpec extends TestBase with TestPackageProviders { val (changeGroup, sourcegear, expectedChange) = transformModelToRoute val results = changeGroup.evaluateAndWrite(sourcegear) - println(results.get.stagedFiles.head._2.text) - assert(results.get.stagedFiles.head._2.text == expectedChange) } diff --git a/arrow/src/test/scala-2.12/com/opticdev/arrow/changes/ExampleChanges.scala b/arrow/src/test/scala-2.12/com/opticdev/arrow/changes/ExampleChanges.scala index d073744fbc..849da292a1 100644 --- a/arrow/src/test/scala-2.12/com/opticdev/arrow/changes/ExampleChanges.scala +++ b/arrow/src/test/scala-2.12/com/opticdev/arrow/changes/ExampleChanges.scala @@ -63,7 +63,7 @@ object ExampleChanges extends TestBase with TestPackageProviders { | "url": "path/to/resource" | }, | "atLocation": { - | "file": "/Users/aidancunniffe/Developer/knack/optic-core/test-examples/resources/tmp/test_project/app.js", + | "file": "test-examples/resources/tmp/test_project/app.js", | "position": 93, | "_type":"com.opticdev.arrow.changes.location.AsChildOf" | }, @@ -133,7 +133,7 @@ object ExampleChanges extends TestBase with TestPackageProviders { | }, | "gearId": "aacee631", | "atLocation": { - | "file": "/Users/aidancunniffe/Developer/knack/optic-core/test-examples/resources/tmp/test_project/app.js", + | "file": "test-examples/resources/tmp/test_project/app.js", | "position": 38, | "_type":"com.opticdev.arrow.changes.location.AsChildOf" | }, @@ -192,16 +192,16 @@ object ExampleChanges extends TestBase with TestPackageProviders { | }], | "gearId": "aacee631", | "locationOptions": [{ - | "file": "/Users/aidancunniffe/Developer/knack/optic-core/test-examples/resources/tmp/test_project/nested/model.js", + | "file": "test-examples/resources/tmp/test_project/nested/model.js", | "position": 173, | "_type": "com.opticdev.arrow.changes.location.AsChildOf" | }], | "location": { - | "file": "/Users/aidancunniffe/Developer/knack/optic-core/test-examples/resources/tmp/test_project/nested/model.js", + | "file": "test-examples/resources/tmp/test_project/nested/model.js", | "position": 173, | "_type": "com.opticdev.arrow.changes.location.AsChildOf" | }, - | "inputValue": {"name": "user", "schema": { "firstName": { "type": "string"} }}, + | "inputValue": {"name": "user", "schema": { "firstName": { "type": "string"}, "lastName": { "type": "string"}, "email": { "type": "string"} }}, | "_type":"com.opticdev.arrow.changes.RunTransformation" | }] """.stripMargin @@ -214,7 +214,7 @@ object ExampleChanges extends TestBase with TestPackageProviders { val changeGroup = Json.fromJson[ChangeGroup](Json.parse(changesJSON)).get - (changeGroup, sourcegear, "import mongoose from 'mongoose'\n\nconst user = mongoose.model('user', new mongoose.Schema({\n 'firstName': 'string',\n 'lastName': 'string',\n 'email': 'string',\n}))\n\napp.post('/user', function (req, res) {\n req.body.firstName\n})") + (changeGroup, sourcegear, "import mongoose from 'mongoose'\n\nconst model = mongoose.model('user', new mongoose.Schema({\n 'firstName': 'string',\n 'lastName': 'string',\n 'email': 'string',\n}))\n\napp.post('/user', function (req, res) {\n req.body.firstName\n req.body.lastName\n req.body.email\n})") } diff --git a/config.yaml b/config.yaml index 5e3f3cc7de..3916f0aa79 100644 --- a/config.yaml +++ b/config.yaml @@ -1 +1 @@ -testParser: "/Users/aidancunniffe/Developer/knack/parsers/javascript-lang/target/scala-2.12/es7_2.12-0.1.0.jar" \ No newline at end of file +testParser: "server/src/main/resources/es7_2.12-0.1.0.jar" \ No newline at end of file diff --git a/core/src/main/scala-2.12/com/opticdev/core/cli/Installer.scala b/core/src/main/scala-2.12/com/opticdev/core/cli/Installer.scala deleted file mode 100644 index 4d552194d0..0000000000 --- a/core/src/main/scala-2.12/com/opticdev/core/cli/Installer.scala +++ /dev/null @@ -1,67 +0,0 @@ -//package com.opticdev.core.cli -// -//import java.io.FileNotFoundException -// -//import better.files.File -//import com.opticdev.core.compiler.Compiler -//import com.opticdev.core.sdk.SdkDescription -//import com.opticdev.core.sourcegear.gears.parsing.ParseAsModel -//import com.opticdev.common.storage.DataDirectory -//import com.opticdev.core.storage.stores.{ParserStorage} -//import com.opticdev.parsers.{ParserBase, SourceParserManager} -//import play.api.libs.json.Json -// -//import scala.util.{Failure, Success, Try} -// -//object Installer extends { -// -// SourceParserManager.installParser(System.getProperty("user.home")+"/Developer/knack/parsers/javascript-lang/out/artifacts/javascript_lang_jar/javascript-lang.jar") -// -// def installDescription(file: File) (implicit logToCli: Boolean = false) = Try { -// -// println("Starting...") -// val asDescription = Try { -// val contents = file.contentAsString -// SdkDescription.fromJson(Json.parse(contents)) -// } -// -// if (asDescription.isSuccess) { -// val compiler = Compiler.setup(asDescription.get) -// val output = compiler.execute -// if (logToCli) { -// Thread.sleep(80) -// println("Installed") -// println("Lenses:") -// output.gears.foreach(i => println(i.identifier)) -// println("Schemas:") -// output.schemas.foreach(i=> println(i.identifier)) -// } -// -// //write to disk -//// output.schemas.foreach(SchemaStorage.writeToStorage) -// -// } else { -// throw asDescription.failed.get -// } -// -// } -// -// def installParser(value: File)(implicit logToCli: Boolean = false): Try[ParserBase] = Try { -// val verifyTry = SourceParserManager.verifyParser(value.pathAsString) -// -// val writeToStorageTry = Try(ParserStorage.writeToStorage(value)) -// -// if (logToCli) { -// if (verifyTry.isSuccess && writeToStorageTry.isSuccess) println("Installed parser "+ verifyTry.get.languageName) -// else println("Unable to install parser from jar "+value.name) -// } -// -// if (verifyTry.isSuccess && writeToStorageTry.isSuccess) { -// verifyTry.get -// } else { -// throw new Error("Unable to install parser from jar "+value.name) -// } -// -// } -// -//} diff --git a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/SGConstructor.scala b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/SGConstructor.scala index 62f23f3044..a7ee312ae1 100644 --- a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/SGConstructor.scala +++ b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/SGConstructor.scala @@ -14,7 +14,10 @@ import scala.util.{Failure, Try} object SGConstructor { - def fromProjectFile(projectFile: ProjectFile) (implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths = ProjectKnowledgeSearchPaths()) : Future[SGConfig] = Future { + def fromProjectFile(projectFile: ProjectFile) : Future[SGConfig] = Future { + + implicit val projectKnowledgeSearchPaths = projectFile.projectKnowledgeSearchPaths + val dependencies = dependenciesForProjectFile(projectFile).get val compiled = compileDependencyTree(dependencies).get @@ -28,8 +31,11 @@ object SGConstructor { SGConfig(dependencies.hash, parsersRefs.get, gears, schemaSet, transformationSet) } - def dependenciesForProjectFile(projectFile: ProjectFile) : Try[DependencyTree] = { - val dependencies = projectFile.dependencies.getOrElse(Vector()) + def dependenciesForProjectFile(projectFile: ProjectFile): Try[DependencyTree] = { + + implicit val projectKnowledgeSearchPaths = projectFile.projectKnowledgeSearchPaths + + val dependencies: Seq[PackageRef] = projectFile.dependencies.getOrElse(Vector()) PackageManager.collectPackages(dependencies) } diff --git a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/SourceGear.scala b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/SourceGear.scala index 2cc850683e..2fee5627c7 100644 --- a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/SourceGear.scala +++ b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/SourceGear.scala @@ -42,18 +42,28 @@ abstract class SourceGear { val parsed = parsedOption.get val astGraph = parsed.graph - //@todo clean this up and have the parser return in the parse result. - val parser = parsers.find(_.languageName == parsed.language).get - implicit val sourceGearContext = SGContext(gearSet.fileAccumulator, astGraph, parser, fileContents) + //@todo clean this up and have the parser return in the parse result. right now it only supports the test one +// val parser = parsers.find(_.languageName == parsed.language).get + implicit val sourceGearContext = SGContext(gearSet.fileAccumulator, astGraph, SourceParserManager.installedParsers.head, fileContents) gearSet.parseFromGraph(fileContents, astGraph, sourceGearContext, project) } else { throw parsedOption.failed.get } } + def isLoaded : Boolean = true } +case object UnloadedSourceGear extends SourceGear { + override val parsers = Set() + override val gearSet = new GearSet() + override val schemas = Set() + override val transformations = Set() + + override def isLoaded = false +} + object SourceGear { def default: SourceGear = new SourceGear { override val parsers: Set[ParserBase] = Set() @@ -61,4 +71,6 @@ object SourceGear { override val schemas = Set() override val transformations = Set() } + + def unloaded = UnloadedSourceGear } \ No newline at end of file diff --git a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/OpticProject.scala b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/OpticProject.scala index 72214348b9..4cf55c2225 100644 --- a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/OpticProject.scala +++ b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/OpticProject.scala @@ -139,19 +139,4 @@ abstract class OpticProject(val name: String, val baseDirectory: File)(implicit } def filesToWatch : Set[File] = baseDirectory.listRecursively.toVector.filter(shouldWatchFile).toSet - - /* Output the search paths for MD in project */ - - def projectSearchPaths : ProjectKnowledgeSearchPaths = { - val searchPaths = projectFile.interface - .map(_.knowledgePaths.value.toVector) - .getOrElse(Vector()) - .collect { - case s: YamlString => File(s.value) - } - .filter(f=> f.exists && f.isDirectory) - - ProjectKnowledgeSearchPaths(searchPaths:_*) - } - } diff --git a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/Project.scala b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/Project.scala index d9a098adf5..645cce50c9 100644 --- a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/Project.scala +++ b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/Project.scala @@ -15,7 +15,7 @@ class Project(name: String, baseDirectory: File)(implicit logToCli: Boolean = fa private var sourceGear: SourceGear = { projectFileChanged(projectFile) - SourceGear.default + SourceGear.unloaded } //do this after sourcegear is initialized @@ -23,7 +23,7 @@ class Project(name: String, baseDirectory: File)(implicit logToCli: Boolean = fa override def projectFileChanged(newPf: ProjectFile): Unit = { super.projectFileChanged(newPf) if (newPf.interface.isSuccess) { - SGConstructor.fromProjectFile(newPf)(projectSearchPaths).onComplete(i => { + SGConstructor.fromProjectFile(newPf).onComplete(i => { if (i.isSuccess) { sourceGear = i.get.inflate //run all callbacks @@ -31,6 +31,7 @@ class Project(name: String, baseDirectory: File)(implicit logToCli: Boolean = fa projectStatusInstance.sourceGearStatus = Valid if (projectStatus.monitoringStatus == Watching) rereadAll } else { + println(i.failed.get.printStackTrace()) projectStatusInstance.sourceGearStatus = Invalid(i.failed.get.getMessage) } }) diff --git a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/config/ProjectFile.scala b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/config/ProjectFile.scala index 6c10b12986..e76be93703 100644 --- a/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/config/ProjectFile.scala +++ b/core/src/main/scala-2.12/com/opticdev/core/sourcegear/project/config/ProjectFile.scala @@ -5,6 +5,7 @@ import java.nio.file.NoSuchFileException import better.files.File import com.opticdev.common.PackageRef import com.opticdev.core.sourcegear.InvalidProjectFileException +import com.opticdev.opm.providers.ProjectKnowledgeSearchPaths import com.opticdev.parsers.utils.Crypto import org.yaml.snakeyaml.parser.ParserException @@ -109,4 +110,20 @@ class ProjectFile(val file: File, createIfDoesNotExist : Boolean = true, onChang } + def projectKnowledgeSearchPaths : ProjectKnowledgeSearchPaths = { + val searchPaths = interface + .map(_.knowledgePaths.value.toVector) + .getOrElse(Vector()) + .collect { + case s: YamlString => { + val b = new java.io.File(file.parent.pathAsString, s.value) + val absolute = b.getCanonicalPath + File(absolute) + } + } + .filter(f=> f.exists && f.isDirectory) + + ProjectKnowledgeSearchPaths(searchPaths:_*) + } + } \ No newline at end of file diff --git a/core/src/test/scala-2.12/com/opticdev/core/sourcegear/SGConfigSpec.scala b/core/src/test/scala-2.12/com/opticdev/core/sourcegear/SGConfigSpec.scala index d55b28bc59..121d995b72 100644 --- a/core/src/test/scala-2.12/com/opticdev/core/sourcegear/SGConfigSpec.scala +++ b/core/src/test/scala-2.12/com/opticdev/core/sourcegear/SGConfigSpec.scala @@ -35,7 +35,7 @@ class SGConfigSpec extends TestBase with TestPackageProviders { } it("can generate a hexadecimal from hash") { - assert(sgConfig.hashString == "74af44cb") + assert(sgConfig.hashString == "55ea873") } it("can inflate to a sourcegear instance") { diff --git a/core/src/test/scala-2.12/com/opticdev/core/sourcegear/SGConstructorSpec.scala b/core/src/test/scala-2.12/com/opticdev/core/sourcegear/SGConstructorSpec.scala index bcc6c48d66..a26c2d7104 100644 --- a/core/src/test/scala-2.12/com/opticdev/core/sourcegear/SGConstructorSpec.scala +++ b/core/src/test/scala-2.12/com/opticdev/core/sourcegear/SGConstructorSpec.scala @@ -15,7 +15,7 @@ class SGConstructorSpec extends TestBase with TestPackageProviders { lazy val projectFile = new ProjectFile(File("test-examples/resources/example_packages/express/optic.yaml")) it("can resolve all dependencies in a project file") { - assert(SGConstructor.dependenciesForProjectFile(projectFile).get.toString == """Tree(Vector(Leaf(OpticMDPackage({"metadata":{"name":"express-js","author":"optic","version":"0.1.0"},"dependencies":{"optic:rest":"0.1.0"},"lenses":[{"name":"Parameter","scope":"internal","schema":"optic:rest/parameter","snippet":{"name":"Parameter","language":"es7","version":"es6","block":"req.query.name"},"rules":[],"variables":[],"subcontainers":[],"components":[{"type":"code","finder":{"type":"stringFinder","rule":"entire","string":"query","occurrence":0},"propertyPath":["in"]},{"type":"code","finder":{"type":"stringFinder","rule":"entire","string":"name","occurrence":0},"propertyPath":["name"]}]},{"name":"Example Route","scope":"public","schema":"optic:rest/route","snippet":{"name":"Example Route","language":"es7","block":"app.get('url', function (req, res) {\n //:callback \n})"},"rules":[{"type":"children","finder":{"type":"stringFinder","rule":"starting","string":"{","occurrence":0},"ruleType":"any"}],"variables":[],"subcontainers":[{"name":"callback","subcontainer":true,"pulls":[],"childrenRule":"any","schemaComponents":[{"type":"schema","schema":"optic:rest/parameter","propertyPath":["parameters"],"mapUnique":true}]}],"components":[{"type":"code","finder":{"type":"stringFinder","rule":"entire","string":"get","occurrence":0},"propertyPath":["method"]},{"type":"code","finder":{"type":"stringFinder","rule":"containing","string":"url","occurrence":0},"propertyPath":["url"]},{"type":"schema","schema":"parameter","mapUnique":true,"propertyPath":["parameters"],"location":{"type":"InParent","finder":null},"options":{"lookupTable":null,"invariant":false,"parser":null,"mutator":null}}]}]},Map(PackageRef(optic:rest,0.1.0) -> PackageRef(optic:rest,0.1.0))),Tree(Vector(Leaf(OpticMDPackage({"metadata":{"name":"rest","author":"optic","version":"0.1.0"},"schemas":[{"id":"route","definition":{"title":"Route","version":"1.0.0","type":"object","required":["method","url"],"properties":{"method":{"type":"string"},"url":{"type":"string"},"parameters":{"type":"array","items":{"$ref":"#/definitions/parameter"}}},"definitions":{"parameter":{"title":"Parameter","version":"1.0.0","slug":"js-example-route-parameter","type":"object","required":["in","name"],"properties":{"in":{"type":"string"},"name":{"type":"string"}}}}}},{"id":"parameter","definition":{"title":"Parameter","version":"1.0.0","type":"object","required":["in","name"],"properties":{"in":{"type":"string"},"name":{"type":"string"}}}}]},Map()),Tree(Vector())))))))""") + assert(SGConstructor.dependenciesForProjectFile(projectFile).get.toString == """Tree(Vector(Leaf(OpticMDPackage({"metadata":{"name":"express-js","author":"optic","version":"0.1.0"},"dependencies":["optic:rest@0.1.0"],"lenses":[{"name":"Parameter","scope":"internal","schema":"optic:rest/parameter","snippet":{"name":"Parameter","language":"es7","version":"es6","block":"req.query.name"},"rules":[],"variables":[],"subcontainers":[],"components":[{"type":"code","finder":{"type":"stringFinder","rule":"entire","string":"query","occurrence":0},"propertyPath":["in"]},{"type":"code","finder":{"type":"stringFinder","rule":"entire","string":"name","occurrence":0},"propertyPath":["name"]}]},{"name":"Example Route","scope":"public","schema":"optic:rest/route","snippet":{"name":"Example Route","language":"es7","block":"app.get('url', function (req, res) {\n //:callback \n})"},"rules":[{"type":"children","finder":{"type":"stringFinder","rule":"starting","string":"{","occurrence":0},"ruleType":"any"}],"variables":[],"subcontainers":[{"name":"callback","subcontainer":true,"pulls":[],"childrenRule":"any","schemaComponents":[{"type":"schema","schema":"optic:rest/parameter","propertyPath":["parameters"],"mapUnique":true}]}],"components":[{"type":"code","finder":{"type":"stringFinder","rule":"entire","string":"get","occurrence":0},"propertyPath":["method"]},{"type":"code","finder":{"type":"stringFinder","rule":"containing","string":"url","occurrence":0},"propertyPath":["url"]},{"type":"schema","schema":"parameter","mapUnique":true,"propertyPath":["parameters"],"location":{"type":"InParent","finder":null},"options":{"lookupTable":null,"invariant":false,"parser":null,"mutator":null}}]}]},Map(PackageRef(optic:rest,0.1.0) -> PackageRef(optic:rest,0.1.0))),Tree(Vector(Leaf(OpticMDPackage({"metadata":{"name":"rest","author":"optic","version":"0.1.0"},"schemas":[{"id":"route","definition":{"title":"Route","version":"1.0.0","type":"object","required":["method","url"],"properties":{"method":{"type":"string"},"url":{"type":"string"},"parameters":{"type":"array","items":{"$ref":"#/definitions/parameter"}}},"definitions":{"parameter":{"title":"Parameter","version":"1.0.0","slug":"js-example-route-parameter","type":"object","required":["in","name"],"properties":{"in":{"type":"string"},"name":{"type":"string"}}}}}},{"id":"parameter","definition":{"title":"Parameter","version":"1.0.0","type":"object","required":["in","name"],"properties":{"in":{"type":"string"},"name":{"type":"string"}}}}]},Map()),Tree(Vector())))))))""") } it("can compile dependencies") { diff --git a/core/src/test/scala-2.12/com/opticdev/core/sourcegear/accumulators/FileAccumulatorSpec.scala b/core/src/test/scala-2.12/com/opticdev/core/sourcegear/accumulators/FileAccumulatorSpec.scala index 7e77c22d93..24dd7bde40 100644 --- a/core/src/test/scala-2.12/com/opticdev/core/sourcegear/accumulators/FileAccumulatorSpec.scala +++ b/core/src/test/scala-2.12/com/opticdev/core/sourcegear/accumulators/FileAccumulatorSpec.scala @@ -53,7 +53,7 @@ class FileAccumulatorSpec extends AkkaTestFixture("FileAccumulatorTest") with Ge it("map unique schemas finds valid + distinct instances") { - val sourceGear = sourceGearFromDescription("/Users/aidancunniffe/Developer/knack/optic-core/test-examples/resources/example_packages/optic:FlatExpress@0.1.0.json") + val sourceGear = sourceGearFromDescription("test-examples/resources/example_packages/optic:FlatExpress@0.1.0.json") val result = sourceGear.parseFile(File("test-examples/resources/example_source/ExampleExpress.js")) implicit val sourceGearContext = SGContext(sourceGear.fileAccumulator, result.get.astGraph, SourceParserManager.installedParsers.head, null) diff --git a/opm/src/main/scala-2.12/com/opticdev/opm/PackageManager.scala b/opm/src/main/scala-2.12/com/opticdev/opm/PackageManager.scala index 4eac310846..a0d3d7239c 100644 --- a/opm/src/main/scala-2.12/com/opticdev/opm/PackageManager.scala +++ b/opm/src/main/scala-2.12/com/opticdev/opm/PackageManager.scala @@ -3,12 +3,13 @@ package com.opticdev.opm import com.opticdev.common.PackageRef import com.opticdev.opm.context.{Leaf, Tree} import com.opticdev.opm.packages.StagedPackage -import com.opticdev.opm.providers.Provider +import com.opticdev.opm.providers.{ProjectKnowledgeSearchPaths, Provider} import com.opticdev.opm.storage.PackageStorage import com.opticdev.parsers.ParserRef import com.vdurmont.semver4j.Semver import com.vdurmont.semver4j.Semver.SemverType import com.opticdev.opm.packages.OpticPackage + import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.{Await, Future} import scala.util.Try @@ -21,11 +22,11 @@ object PackageManager { // def defaultProviders = - def installPackage(packageRef: PackageRef) : Try[Vector[String]] = { + def installPackage(packageRef: PackageRef)(implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths) : Try[Vector[String]] = { installPackages(packageRef) } - def installPackages(packages: PackageRef*) = Try { + def installPackages(packages: PackageRef*)(implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths) = Try { //name -> satisfied val flattenedDependencyTree = collection.mutable.Map[PackageRef, Boolean]() @@ -66,8 +67,7 @@ object PackageManager { foundPackages.map(_.packageRef.full).toVector.sorted } - def collectPackages(packages: Seq[PackageRef]) : Try[DependencyTree] = Try { - + def collectPackages(packages: Seq[PackageRef])(implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths) : Try[DependencyTree] = Try { var loaded = packages.map(p=> (p, PackageStorage.loadFromStorage(p))) val tryInstall = { @@ -104,7 +104,7 @@ object PackageManager { } //provider query - def resultsForRefs(packageRefs: PackageRef*) : BatchPackageResult= { + def resultsForRefs(packageRefs: PackageRef*)(implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths) : BatchPackageResult= { val lookupResults = providerStore.foldLeft(Seq(): Seq[BatchPackageResult]) { case (results, provider)=> { if (results.nonEmpty && results.last.foundAll) { @@ -113,7 +113,7 @@ object PackageManager { results } else { val future = provider.resolvePackages(packageRefs:_*) - val result = Await.result(future, 7 seconds) + val result = Await.result(future, 20 seconds) results :+ result } } @@ -132,7 +132,7 @@ object PackageManager { val future = Future.sequence(futures) - val result = Await.result(future, 7 seconds) + val result = Await.result(future, 20 seconds) import com.opticdev.opm.utils.FlattenBatchResultsImplicits._ diff --git a/opm/src/main/scala-2.12/com/opticdev/opm/packages/package.scala b/opm/src/main/scala-2.12/com/opticdev/opm/packages/package.scala index 0d71112e03..1f7a5da860 100644 --- a/opm/src/main/scala-2.12/com/opticdev/opm/packages/package.scala +++ b/opm/src/main/scala-2.12/com/opticdev/opm/packages/package.scala @@ -3,9 +3,9 @@ package com.opticdev.opm.packages import better.files.File import com.opticdev.common.PackageRef import com.opticdev.sdk.MarkdownParser -import play.api.libs.json.{JsObject, JsString, JsValue} +import play.api.libs.json.{JsArray, JsObject, JsString, JsValue} -import scala.util.Try +import scala.util.{Success, Try} trait OpticPackage { val description: JsObject @@ -19,10 +19,11 @@ trait OpticPackage { def packageRef: PackageRef = PackageRef(packageId, version) lazy val dependencies: Vector[PackageRef] = { - val asJsObject: JsObject = description.value.getOrElse("dependencies", JsObject.empty).as[JsObject] - asJsObject.value.map(i=> { - PackageRef(i._1, i._2.as[JsString].value) - }).toVector + val asJsObject: JsArray = description.value.getOrElse("dependencies", JsArray.empty).as[JsArray] + asJsObject.value + .collect { case s: JsString => PackageRef.fromString(s.value)} + .collect { case Success(i) => i } + .toVector } def resolved(map: Map[PackageRef, PackageRef] = Map()) = OpticMDPackage(description, map) diff --git a/opm/src/main/scala-2.12/com/opticdev/opm/providers/LocalProvider.scala b/opm/src/main/scala-2.12/com/opticdev/opm/providers/LocalProvider.scala index 2be2d95a21..31af9d9a59 100644 --- a/opm/src/main/scala-2.12/com/opticdev/opm/providers/LocalProvider.scala +++ b/opm/src/main/scala-2.12/com/opticdev/opm/providers/LocalProvider.scala @@ -3,7 +3,7 @@ import better.files.File import com.opticdev.common.PackageRef import com.opticdev.opm.packages.OpticPackage import com.opticdev.opm.{BatchPackageResult, BatchParserResult} -import com.opticdev.parsers.{ParserBase, ParserRef} +import com.opticdev.parsers.{ParserBase, ParserRef, SourceParserManager} import com.vdurmont.semver4j.Semver import com.vdurmont.semver4j.Semver.SemverType @@ -13,7 +13,7 @@ import scala.util.{Failure, Success, Try} class LocalProvider extends Provider { - override def resolvePackages(packageRefs: PackageRef*) (implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths = ProjectKnowledgeSearchPaths()) : Future[BatchPackageResult] = Future { + override def resolvePackages(packageRefs: PackageRef*) (implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths) : Future[BatchPackageResult] = Future { val foundPackages = listInstalledPackages.filter(i=> packageRefs.exists(_.packageId == i.packageId)) @@ -36,21 +36,47 @@ class LocalProvider extends Provider { BatchPackageResult(found.toSet, notFound.toSet) } - override def listInstalledPackages (implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths = ProjectKnowledgeSearchPaths()) : Vector[OpticPackage] = { + override def listInstalledPackages (implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths) : Vector[OpticPackage] = { val allFiles = projectKnowledgeSearchPaths.dirs.flatMap(_.listRecursively) - allFiles.filter(_.extension.orNull == ".md") + val allPackages = allFiles.filter(_.extension.orNull == ".md") .map(i => OpticPackage.fromMarkdown(i)) .toVector .collect { case Success(i) => i } + + allPackages } + override def resolveParsers(parsers: ParserRef*) : Future[BatchParserResult] = Future { - BatchParserResult(Set(), Set()) + + val installedParsers = listInstalledParsers + + val parserOptions = parsers.map(ref=> { + (ref, installedParsers + .get(ref.languageName).flatMap(versions => { + + val semversions = versions.map(i=> (new Semver(i.parserVersion, SemverType.NPM), i)) + .filter(sV=> sV._1.satisfies(ref.version) || ref.version == "latest") + + semversions.sortWith((a, b)=> { + a._1.isGreaterThan(b._1) + }).headOption.map(_._2) + })) + }) + + val found = parserOptions.filter(_._2.isDefined).map(_._2.get) + val notFound = parserOptions.filter(_._2.isEmpty).map(_._1) + + BatchParserResult(found.toSet, notFound.toSet) } - override def listInstalledParsers : Map[String, Vector[ParserBase]] = Map() + override def listInstalledParsers = { + import net.jcazevedo.moultingyaml._ + val installedParsers = SourceParserManager.installedParsers.map(i=> (i.languageName, Vector(i))).toMap + installedParsers + } } diff --git a/opm/src/main/scala-2.12/com/opticdev/opm/providers/package.scala b/opm/src/main/scala-2.12/com/opticdev/opm/providers/package.scala index 6ac90bacf5..c0741e4650 100644 --- a/opm/src/main/scala-2.12/com/opticdev/opm/providers/package.scala +++ b/opm/src/main/scala-2.12/com/opticdev/opm/providers/package.scala @@ -14,8 +14,8 @@ package object providers { case class ProjectKnowledgeSearchPaths(dirs: File*) trait Provider { - def resolvePackages(packageRefs: PackageRef*) (implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths = ProjectKnowledgeSearchPaths()) : Future[BatchPackageResult] - def listInstalledPackages (implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths = ProjectKnowledgeSearchPaths()) : Vector[OpticPackage] + def resolvePackages(packageRefs: PackageRef*) (implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths) : Future[BatchPackageResult] + def listInstalledPackages (implicit projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths) : Vector[OpticPackage] def resolveParsers(parsers: ParserRef*) : Future[BatchParserResult] def listInstalledParsers : Map[String, Vector[ParserBase]] diff --git a/opm/src/test/scala-2.12/com/opticdev/opm/PackageManagerSpec.scala b/opm/src/test/scala-2.12/com/opticdev/opm/PackageManagerSpec.scala index f544aa1daa..d1eb6952c7 100644 --- a/opm/src/test/scala-2.12/com/opticdev/opm/PackageManagerSpec.scala +++ b/opm/src/test/scala-2.12/com/opticdev/opm/PackageManagerSpec.scala @@ -3,6 +3,7 @@ package com.opticdev.opm import better.files.File import com.opticdev.common.PackageRef import com.opticdev.opm.context.{Leaf, Tree} +import com.opticdev.opm.providers.ProjectKnowledgeSearchPaths import com.opticdev.opm.storage.{PackageStorage, ParserStorage} import com.opticdev.parsers.ParserRef import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll, FunSpec} @@ -13,6 +14,8 @@ import scala.concurrent.duration._ class PackageManagerSpec extends FunSpec with TestPackageProviders { + implicit val projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths = ProjectKnowledgeSearchPaths() + describe("Package Manager") { it("can change providers") { @@ -94,7 +97,7 @@ class PackageManagerSpec extends FunSpec with TestPackageProviders { )) ) - assert(expectedTree.toString == "Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"a\",\"version\":\"1.1.1\",\"author\":\"optic\"},\"dependencies\":{\"optic:b\":\"1.0.0\"}},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"b\",\"version\":\"1.0.0\",\"author\":\"optic\"},\"dependencies\":{\"optic:c\":\"3.5.2\",\"optic:d\":\"2.0.0\"}},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"c\",\"version\":\"3.5.2\",\"author\":\"optic\"},\"dependencies\":{\"optic:d\":\"2.0.0\"}},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"d\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":{\"optic:e\":\"2.0.0\"}},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"e\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":{\"optic:c\":\"2.0.0\"}},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"c\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":{}},Map()),Tree(List()))))))))))), Leaf(OpticMDPackage({\"metadata\":{\"name\":\"d\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":{\"optic:e\":\"2.0.0\"}},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"e\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":{\"optic:c\":\"2.0.0\"}},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"c\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":{}},Map()),Tree(List())))))))))))))), Leaf(OpticMDPackage({\"metadata\":{\"name\":\"b\",\"version\":\"1.1.1\",\"author\":\"optic\"},\"dependencies\":{\"optic:c\":\"2.0.0\"}},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"c\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":{}},Map()),Tree(List())))))))") + assert(expectedTree.toString == "Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"a\",\"version\":\"1.1.1\",\"author\":\"optic\"},\"dependencies\":[\"optic:b@1.0.0\"]},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"b\",\"version\":\"1.0.0\",\"author\":\"optic\"},\"dependencies\":[\"optic:c@3.5.2\",\"optic:d@2.0.0\"]},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"c\",\"version\":\"3.5.2\",\"author\":\"optic\"},\"dependencies\":[\"optic:d@2.0.0\"]},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"d\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":[\"optic:e@2.0.0\"]},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"e\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":[\"optic:c@2.0.0\"]},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"c\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":[]},Map()),Tree(List()))))))))))), Leaf(OpticMDPackage({\"metadata\":{\"name\":\"d\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":[\"optic:e@2.0.0\"]},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"e\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":[\"optic:c@2.0.0\"]},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"c\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":[]},Map()),Tree(List())))))))))))))), Leaf(OpticMDPackage({\"metadata\":{\"name\":\"b\",\"version\":\"1.1.1\",\"author\":\"optic\"},\"dependencies\":[\"optic:c@2.0.0\"]},Map()),Tree(WrappedArray(Leaf(OpticMDPackage({\"metadata\":{\"name\":\"c\",\"version\":\"2.0.0\",\"author\":\"optic\"},\"dependencies\":[]},Map()),Tree(List())))))))") } it("fails if any can not be resolved") { diff --git a/opm/src/test/scala-2.12/com/opticdev/opm/TestProvider.scala b/opm/src/test/scala-2.12/com/opticdev/opm/TestProvider.scala index ba29e26cf6..b684e271c6 100644 --- a/opm/src/test/scala-2.12/com/opticdev/opm/TestProvider.scala +++ b/opm/src/test/scala-2.12/com/opticdev/opm/TestProvider.scala @@ -9,7 +9,7 @@ import com.opticdev.parsers.{ParserRef, SourceParserManager} import com.vdurmont.semver4j.Semver import com.vdurmont.semver4j.Semver.SemverType import net.jcazevedo.moultingyaml.YamlString -import play.api.libs.json.{JsObject, JsString, Json} +import play.api.libs.json.{JsArray, JsObject, JsString, Json} import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future @@ -17,7 +17,7 @@ import scala.util.Try class TestProvider extends Provider { - def mockPackage(name: String, author: String, version: String, dependencies: Seq[(String, String)]) = { + def mockPackage(name: String, author: String, version: String, dependencies: Seq[String]) = { StagedPackage(JsObject( Seq( "metadata" -> JsObject( @@ -26,22 +26,22 @@ class TestProvider extends Provider { "version"-> JsString(version), "author"-> JsString(author), )), - "dependencies" -> JsObject(dependencies.map(i=> i._1 -> JsString(i._2))) + "dependencies" -> JsArray(dependencies.map(JsString)) ) )) } - val a = mockPackage("a", "optic", "1.1.1", Seq("optic:b"-> "1.0.0")) + val a = mockPackage("a", "optic", "1.1.1", Seq("optic:b@1.0.0")) - val b = mockPackage("b", "optic", "1.0.0", Seq("optic:c"-> "3.5.2", "optic:d"-> "2.0.0")) - val b1 = mockPackage("b", "optic", "1.1.1", Seq("optic:c"-> "2.0.0")) + val b = mockPackage("b", "optic", "1.0.0", Seq("optic:c@3.5.2", "optic:d@2.0.0")) + val b1 = mockPackage("b", "optic", "1.1.1", Seq("optic:c@2.0.0")) - val c = mockPackage("c", "optic", "3.5.2", Seq("optic:d"-> "2.0.0")) + val c = mockPackage("c", "optic", "3.5.2", Seq("optic:d@2.0.0")) val c1 = mockPackage("c", "optic", "2.0.0", Seq()) - val d = mockPackage("d", "optic", "2.0.0", Seq("optic:e"-> "2.0.0")) + val d = mockPackage("d", "optic", "2.0.0", Seq("optic:e@2.0.0")) - val e = mockPackage("e", "optic", "2.0.0", Seq("optic:c"-> "2.0.0")) + val e = mockPackage("e", "optic", "2.0.0", Seq("optic:c@2.0.0")) val opticImport = OpticPackage.fromJson(Json.parse(File( diff --git a/opm/src/test/scala-2.12/com/opticdev/opm/context/PackageContextSpec.scala b/opm/src/test/scala-2.12/com/opticdev/opm/context/PackageContextSpec.scala index c73ab31f40..6029d6620c 100644 --- a/opm/src/test/scala-2.12/com/opticdev/opm/context/PackageContextSpec.scala +++ b/opm/src/test/scala-2.12/com/opticdev/opm/context/PackageContextSpec.scala @@ -1,6 +1,7 @@ package com.opticdev.opm.context import com.opticdev.common.PackageRef +import com.opticdev.opm.providers.ProjectKnowledgeSearchPaths import com.opticdev.opm.{PackageManager, TestPackageProviders, TestProvider} import com.opticdev.sdk.descriptions import com.opticdev.sdk.descriptions.Schema @@ -8,6 +9,9 @@ import org.scalatest.{BeforeAndAfter, FunSpec} class PackageContextSpec extends FunSpec with TestPackageProviders { + implicit val projectKnowledgeSearchPaths: ProjectKnowledgeSearchPaths = ProjectKnowledgeSearchPaths() + + describe("Package Context") { describe("within dependencies trees") { diff --git a/opm/src/test/scala-2.12/com/opticdev/opm/providers/LocalProviderSpec.scala b/opm/src/test/scala-2.12/com/opticdev/opm/providers/LocalProviderSpec.scala index c99af1f2f7..85c5f8ff6f 100644 --- a/opm/src/test/scala-2.12/com/opticdev/opm/providers/LocalProviderSpec.scala +++ b/opm/src/test/scala-2.12/com/opticdev/opm/providers/LocalProviderSpec.scala @@ -29,7 +29,7 @@ class LocalProviderSpec extends FunSpec { } it("does not work for parsers") { - assert(localProvider.listInstalledParsers.isEmpty) + assert(localProvider.listInstalledParsers.size == 1) } } diff --git a/server/src/main/resources/es7_2.12-0.1.0.jar b/server/src/main/resources/es7_2.12-0.1.0.jar new file mode 100644 index 0000000000..a002344a11 Binary files /dev/null and b/server/src/main/resources/es7_2.12-0.1.0.jar differ diff --git a/server/src/main/scala-2.12/com/opticdev/server/http/Lifecycle.scala b/server/src/main/scala-2.12/com/opticdev/server/http/Lifecycle.scala index 7b76dab273..c2e6700bfd 100644 --- a/server/src/main/scala-2.12/com/opticdev/server/http/Lifecycle.scala +++ b/server/src/main/scala-2.12/com/opticdev/server/http/Lifecycle.scala @@ -3,17 +3,28 @@ package com.opticdev.server.http import better.files.File import com.opticdev.core.sourcegear.project.Project import com.opticdev.core.sourcegear.project.config.ProjectFile +import com.opticdev.opm.PackageManager +import com.opticdev.opm.providers.LocalProvider +import com.opticdev.opm.storage.{PackageStorage, ParserStorage} import com.opticdev.parsers.SourceParserManager import com.opticdev.server.state.ProjectsManager object Lifecycle extends App { - SourceParserManager.installParser(System.getProperty("user.home")+"/Developer/knack/parsers/javascript-lang/target/scala-2.12/javascript-lang_2.12-1.0.jar") + PackageStorage.clearLocalPackages + + //set the local providers for the OPM + PackageManager.setProviders(new LocalProvider) + + //@todo load parsers dynamically. + val jar = this.getClass.getClassLoader.getResource("es7_2.12-0.1.0.jar").getPath + val defaultParserTry = SourceParserManager.installParser(jar) + ParserStorage.writeToStorage(File(jar)) implicit val projectsManager: ProjectsManager = new ProjectsManager() implicit val actorCluster = projectsManager.actorCluster //manually adding projects for testing - val project = Project.fromProjectFile(new ProjectFile(File("test-examples/resources/tmp/test_project/optic.yaml"))).get - projectsManager.loadProject(project) +// val project = Project.fromProjectFile(new ProjectFile(File("test-examples/resources/tmp/test_project/optic.yaml"))).get +// projectsManager.loadProject(project) startup def startup = { diff --git a/server/src/main/scala-2.12/com/opticdev/server/http/controllers/ContextQuery.scala b/server/src/main/scala-2.12/com/opticdev/server/http/controllers/ContextQuery.scala index 4899ea3b7b..c3542c44fc 100644 --- a/server/src/main/scala-2.12/com/opticdev/server/http/controllers/ContextQuery.scala +++ b/server/src/main/scala-2.12/com/opticdev/server/http/controllers/ContextQuery.scala @@ -43,7 +43,8 @@ class ContextQuery(file: File, range: Range, contentsOption: Option[String])(imp resolved.filter(node => (node.root.range intersect range.inclusive).nonEmpty) } else { - if (projectOption.get.shouldWatchFile(file)) { + val project = projectOption.get + if (project.projectSourcegear.isLoaded && project.shouldWatchFile(file)) { //wait for it to be processed Vector() } else { diff --git a/server/src/test/scala-2.12/com/opticdev/server/Scratch.scala b/server/src/test/scala-2.12/com/opticdev/server/Scratch.scala index 0414cfd334..708965a9d9 100644 --- a/server/src/test/scala-2.12/com/opticdev/server/Scratch.scala +++ b/server/src/test/scala-2.12/com/opticdev/server/Scratch.scala @@ -8,13 +8,23 @@ import com.opticdev.opm.{TestPackageProviders, TestProvider} import com.opticdev.parsers.SourceParserManager import com.opticdev.server.http.Server import com.opticdev.server.state.ProjectsManager +import net.jcazevedo.moultingyaml.YamlString +import net.jcazevedo.moultingyaml._ + +import scala.util.Try object Scratch extends TestBase with TestPackageProviders { installProviders super.beforeAll() - SourceParserManager.installParser(System.getProperty("user.home")+"/Developer/knack/parsers/javascript-lang/target/scala-2.12/javascript-lang_2.12-1.0.jar") + val parserPath = Try({ + val contents = File("config.yaml").contentAsString + contents.parseYaml.asYamlObject.fields(YamlString("testParser")).asInstanceOf[YamlString].value + }).getOrElse(throw new Error("No testParser found in config.yaml")) + + + SourceParserManager.installParser("parserPath") implicit val projectsManager: ProjectsManager = new ProjectsManager() implicit val actorCluster = projectsManager.actorCluster diff --git a/test-examples/resources/example_packages/express/optic:express-js@0.1.0.json b/test-examples/resources/example_packages/express/optic:express-js@0.1.0.json index 6761b1d406..3df18005ee 100644 --- a/test-examples/resources/example_packages/express/optic:express-js@0.1.0.json +++ b/test-examples/resources/example_packages/express/optic:express-js@0.1.0.json @@ -4,9 +4,7 @@ "author": "optic", "version": "0.1.0" }, - "dependencies": { - "optic:rest":"0.1.0" - }, + "dependencies": ["optic:rest@0.1.0"], "lenses": [ { "name": "Parameter", diff --git a/test-examples/resources/example_packages/optic:FlatExpress@0.1.0.json b/test-examples/resources/example_packages/optic:FlatExpress@0.1.0.json index 50e785059b..98adf914d5 100644 --- a/test-examples/resources/example_packages/optic:FlatExpress@0.1.0.json +++ b/test-examples/resources/example_packages/optic:FlatExpress@0.1.0.json @@ -4,9 +4,7 @@ "author": "optic", "version": "0.1.0" }, - "dependencies": { - "optic:rest":"0.1.0" - }, + "dependencies": ["optic:rest@0.1.0"], "lenses": [ { "name": "Parameter", diff --git a/test-examples/resources/example_packages/optic:FlatExpress_container_mapping@0.1.0.json b/test-examples/resources/example_packages/optic:FlatExpress_container_mapping@0.1.0.json index b8564924b9..5a57e29f1f 100644 --- a/test-examples/resources/example_packages/optic:FlatExpress_container_mapping@0.1.0.json +++ b/test-examples/resources/example_packages/optic:FlatExpress_container_mapping@0.1.0.json @@ -4,9 +4,7 @@ "author": "optic", "version": "0.1.0" }, - "dependencies": { - "optic:rest": "0.1.0" - }, + "dependencies": ["optic:rest@0.1.0"], "lenses": [ { "name": "Parameter", diff --git a/test-examples/resources/example_packages/optic:FlatExpress_non_distinct_params@0.1.0.json b/test-examples/resources/example_packages/optic:FlatExpress_non_distinct_params@0.1.0.json index 56b0d0cf80..5743373130 100644 --- a/test-examples/resources/example_packages/optic:FlatExpress_non_distinct_params@0.1.0.json +++ b/test-examples/resources/example_packages/optic:FlatExpress_non_distinct_params@0.1.0.json @@ -4,9 +4,7 @@ "author": "optic", "version": "0.1.0" }, - "dependencies": { - "optic:rest":"0.1.0" - }, + "dependencies": ["optic:rest@0.1.0"], "lenses": [ { "name": "Parameter", diff --git a/test-examples/resources/example_packages/optic:ShowConfirmAlert@0.1.0.json b/test-examples/resources/example_packages/optic:ShowConfirmAlert@0.1.0.json index ad9a927320..4f4214b5c3 100644 --- a/test-examples/resources/example_packages/optic:ShowConfirmAlert@0.1.0.json +++ b/test-examples/resources/example_packages/optic:ShowConfirmAlert@0.1.0.json @@ -4,9 +4,7 @@ "author": "optic", "version": "0.1.0" }, - "dependencies": { - "dependencySet": {} - }, + "dependencies": [], "schemas": [ { "id": "confirmAlert", diff --git a/test-examples/resources/example_packages/optic:mongoose@0.1.0.json b/test-examples/resources/example_packages/optic:mongoose@0.1.0.json index a4a2cfd1c1..c83944b3aa 100644 --- a/test-examples/resources/example_packages/optic:mongoose@0.1.0.json +++ b/test-examples/resources/example_packages/optic:mongoose@0.1.0.json @@ -4,9 +4,7 @@ "name": "mongoose", "version": "0.1.0" }, - "dependencies": { - "optic:rest":"0.1.0" - }, + "dependencies": ["optic:rest@0.1.0"], "schemas": [{ "id": "mongoose-schema", "definition": {