From aafd25e93966661bf955732d63fd2cd1a21d907f Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Mon, 8 Jan 2024 12:39:33 -0300 Subject: [PATCH 01/33] Publish 5.5.0-SNAPSHOT --- amf-apicontract.versions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amf-apicontract.versions b/amf-apicontract.versions index 16bdf0a3b9..80d7504558 100644 --- a/amf-apicontract.versions +++ b/amf-apicontract.versions @@ -1,5 +1,5 @@ -amf.apicontract=5.4.7 -amf.aml=6.4.7 +amf.apicontract=5.5.0-SNAPSHOT +amf.aml=6.5.0-SNAPSHOT amf.model=3.8.2 antlr4Version=0.7.25 amf.validation.profile.dialect=1.6.0 From 8260d2957fbcba7c383b6f260af6ce26c06a897c Mon Sep 17 00:00:00 2001 From: Loose Date: Mon, 15 Jan 2024 11:31:53 -0300 Subject: [PATCH 02/33] W-14801880 - Excluding jackson-databind dependency due vulnerability (not used) --- build.sbt | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index 1c9bc5cef5..3fe18b171d 100644 --- a/build.sbt +++ b/build.sbt @@ -46,11 +46,11 @@ val amlVersion = versions("amf.aml") lazy val amlJVMRef = ProjectRef(Common.workspaceDirectory / "amf-aml", "amlJVM") lazy val amlJSRef = ProjectRef(Common.workspaceDirectory / "amf-aml", "amlJS") -lazy val amlLibJVM = "com.github.amlorg" %% "amf-aml" % amlVersion +lazy val amlLibJVM = "com.github.amlorg" %% "amf-aml" % amlVersion lazy val amlLibJS = "com.github.amlorg" %% "amf-aml_sjs1" % amlVersion lazy val rdfJVMRef = ProjectRef(Common.workspaceDirectory / "amf-aml", "rdfJVM") -lazy val rdfLibJVM = "com.github.amlorg" %% "amf-rdf" % amlVersion +lazy val rdfLibJVM = "com.github.amlorg" %% "amf-rdf" % amlVersion lazy val rdfJSRef = ProjectRef(Common.workspaceDirectory / "amf-aml", "rdfJS") lazy val rdfLibJS = "com.github.amlorg" %% "amf-rdf_sjs1" % amlVersion @@ -73,6 +73,7 @@ lazy val shapes = crossProject(JSPlatform, JVMPlatform) libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided", libraryDependencies += "com.github.everit-org.json-schema" % "org.everit.json.schema" % "1.12.2", libraryDependencies += "org.json" % "json" % "20231013", + excludeDependencies += "com.fasterxml.jackson.core" % "jackson-databind", // transitive from everit Compile / packageDoc / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-shapes-javadoc.jar" ) .jsSettings( @@ -114,8 +115,8 @@ lazy val apiContract = crossProject(JSPlatform, JVMPlatform) ) .dependsOn(shapes) .jvmSettings( - libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided", - libraryDependencies += "org.reflections" % "reflections" % "0.10.2" % Test, + libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided", + libraryDependencies += "org.reflections" % "reflections" % "0.10.2" % Test, Compile / packageDoc / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-api-contract-javadoc.jar", Compile / packageBin / mappings += file("amf-apicontract.versions") -> "amf-apicontract.versions" ) @@ -142,7 +143,7 @@ lazy val apiContractJS = lazy val antlrv4JVMRef = ProjectRef(Common.workspaceDirectory / "amf-antlr-ast", "antlrastJVM") lazy val antlrv4JSRef = ProjectRef(Common.workspaceDirectory / "amf-antlr-ast", "antlrastJS") val antlr4Version = versions("antlr4Version") -lazy val antlrv4LibJVM = "com.github.amlorg" %% "antlr-ast" % antlr4Version +lazy val antlrv4LibJVM = "com.github.amlorg" %% "antlr-ast" % antlr4Version lazy val antlrv4LibJS = "com.github.amlorg" %% "antlr-ast_sjs1" % antlr4Version lazy val antlr = crossProject(JSPlatform, JVMPlatform) @@ -201,7 +202,6 @@ lazy val grpc = crossProject(JSPlatform, JVMPlatform) .jsSettings( scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }, Compile / fullOptJS / artifactPath := baseDirectory.value / "target" / "artifact" / "amf-grpc.js", - npmDependencies ++= npmDeps ) .settings(AutomaticModuleName.settings("amf.grpc")) @@ -313,10 +313,14 @@ lazy val adhocCli = (project in file("adhoc-cli")) .settings( version := "0.1-SNAPSHOT", publishTo := Some(snapshots), - libraryDependencies += "com.github.amlorg" %% "amf-validation-profile-dialect" % versions("amf.validation.profile.dialect"), - libraryDependencies += "com.github.amlorg" %% "amf-validation-report-dialect" % versions("amf.validation.report.dialect"), - libraryDependencies += "commons-io" % "commons-io" % "2.11.0", - libraryDependencies += "org.mule.common" %%% "scala-common-test" % "0.1.13" % Test + libraryDependencies += "com.github.amlorg" %% "amf-validation-profile-dialect" % versions( + "amf.validation.profile.dialect" + ), + libraryDependencies += "com.github.amlorg" %% "amf-validation-report-dialect" % versions( + "amf.validation.report.dialect" + ), + libraryDependencies += "commons-io" % "commons-io" % "2.11.0", + libraryDependencies += "org.mule.common" %%% "scala-common-test" % "0.1.13" % Test ) .settings( assembly / aggregate := true, From d87b0356cd7ca053e1e0d68d792383de2c79cb1d Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Mon, 18 Dec 2023 17:13:19 -0300 Subject: [PATCH 03/33] W-14654096: Set annotation in element Builder --- .../parser/JsonLDArrayElementParser.scala | 7 ++++--- .../parser/JsonLDObjectElementParser.scala | 7 +++++-- .../parser/JsonLDScalarElementParser.scala | 10 ++++------ .../parser/JsonLDSchemaNodeParser.scala | 17 +++++++++-------- .../builder/JsonLDArrayElementBuilder.scala | 7 ++++--- .../parser/builder/JsonLDElementBuilder.scala | 4 ++-- .../parser/builder/JsonLDErrorBuilder.scala | 7 ++++--- .../builder/JsonLDObjectElementBuilder.scala | 10 ++++++---- .../builder/JsonLDScalarElementBuilder.scala | 12 +++++++----- .../parser/builder/ObjectPropertyMerge.scala | 4 ++-- 10 files changed, 47 insertions(+), 38 deletions(-) diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDArrayElementParser.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDArrayElementParser.scala index faf53cb537..dbc5f42986 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDArrayElementParser.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDArrayElementParser.scala @@ -1,8 +1,8 @@ package amf.shapes.internal.spec.jsonldschema.parser -import amf.core.client.scala.model.domain.Shape +import amf.core.client.scala.model.domain.{Annotation, Shape} +import amf.core.internal.parser.domain.Annotations import amf.shapes.client.scala.model.domain.{AnyShape, ArrayShape, MatrixShape, SemanticContext, TupleShape} -import amf.shapes.internal.domain.metamodel.AnyShapeModel import amf.shapes.internal.spec.jsonldschema.parser.builder.{JsonLDArrayElementBuilder, JsonLDElementBuilder} import amf.shapes.internal.spec.jsonldschema.validation.JsonLDSchemaValidations.UnsupportedShape import org.yaml.model.{YSequence, YType} @@ -35,7 +35,8 @@ case class JsonLDArrayElementParser(seq: YSequence, path: JsonPath)(implicit val } private def parseItems(items: Shape): JsonLDArrayElementBuilder = { - val builder = new JsonLDArrayElementBuilder(seq.location, path) + val annotation = Annotations(seq) + val builder = new JsonLDArrayElementBuilder(annotation, path) builder.withItems(seq.nodes.zipWithIndex.map({ case (node, index) => JsonLDSchemaNodeParser(items, node, index.toString, path.concat(index.toString)).parse() diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDObjectElementParser.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDObjectElementParser.scala index 2719f349da..bbe012a675 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDObjectElementParser.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDObjectElementParser.scala @@ -2,6 +2,7 @@ package amf.shapes.internal.spec.jsonldschema.parser import amf.core.client.scala.model.domain.Shape import amf.core.client.scala.model.domain.extensions.PropertyShape +import amf.core.internal.parser.domain.Annotations import amf.shapes.client.scala.model.domain.SemanticContext.baseIri import amf.shapes.client.scala.model.domain._ import amf.shapes.internal.spec.jsonldschema.parser.builder.JsonLDObjectElementBuilder @@ -62,8 +63,10 @@ case class JsonLDObjectElementParser( val propertyParser = JsonLDPropertyParser(properties, semanticContext, path) val propertyBuilders = propertyParser.parse(map.entries) - val objectBuilder = - new JsonLDObjectElementBuilder(map.location, key, semanticContext.map(_.computeBase).getOrElse(baseIri), path) + val objectBuilder = { + val annotation = Annotations(map) + new JsonLDObjectElementBuilder(annotation, key, semanticContext.map(_.computeBase).getOrElse(baseIri), path) + } setClassTerm(objectBuilder, semanticContext) objectBuilder ++ propertyBuilders diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDScalarElementParser.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDScalarElementParser.scala index 6b2ac89ee2..5ed704b8fa 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDScalarElementParser.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDScalarElementParser.scala @@ -2,14 +2,11 @@ package amf.shapes.internal.spec.jsonldschema.parser import amf.core.client.platform.model.DataTypes import amf.core.client.scala.model.domain.Shape +import amf.core.internal.parser.domain.Annotations import amf.shapes.client.scala.model.domain.{AnyShape, ScalarShape, SemanticContext} import amf.shapes.internal.domain.metamodel.AnyShapeModel import amf.shapes.internal.spec.jsonldschema.parser.builder.JsonLDScalarElementBuilder -import amf.shapes.internal.spec.jsonldschema.validation.JsonLDSchemaValidations.{ - IncompatibleScalarDataType, - UnsupportedScalarTagType, - UnsupportedShape -} +import amf.shapes.internal.spec.jsonldschema.validation.JsonLDSchemaValidations.{IncompatibleScalarDataType, UnsupportedScalarTagType, UnsupportedShape} import org.mulesoft.common.time.SimpleDateTime import org.mulesoft.common.time.SimpleDateTime.parseDate import org.yaml.model.{YScalar, YType} @@ -89,6 +86,7 @@ case class JsonLDScalarElementParser private (scalar: YScalar, tagType: YType, p SimpleDateTime.parse(value).map(value => (DataTypes.DateTime, value)).getOrElse((DataTypes.String, value)) case (_, _, value) => (dataType, value) } - new JsonLDScalarElementBuilder(finalDataType, value, location = scalar.location, path = path) + val annotation = Annotations(scalar) + new JsonLDScalarElementBuilder(finalDataType, value, annotation, path = path) } } diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDSchemaNodeParser.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDSchemaNodeParser.scala index 1da6f1ccde..4b5404fc85 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDSchemaNodeParser.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDSchemaNodeParser.scala @@ -2,11 +2,9 @@ package amf.shapes.internal.spec.jsonldschema.parser import amf.core.internal.parser.domain.Annotations import amf.core.client.scala.model.domain.Shape +import amf.core.internal.validation.core.ValidationSpecification import amf.shapes.internal.spec.jsonldschema.parser.builder.{JsonLDElementBuilder, JsonLDErrorBuilder} -import amf.shapes.internal.spec.jsonldschema.validation.JsonLDSchemaValidations.{ - UnsupportedRootLevel, - UnsupportedScalarRootLevel -} +import amf.shapes.internal.spec.jsonldschema.validation.JsonLDSchemaValidations.{UnsupportedRootLevel, UnsupportedScalarRootLevel} import org.yaml.model._ object JsonPath { @@ -32,13 +30,16 @@ case class JsonLDSchemaNodeParser(shape: Shape, node: YNode, key: String, path: case _ if isScalarNode && !isRoot => JsonLDScalarElementParser(node.as[YScalar], node.tagType, path).parse(shape) case _ if isScalarNode && isRoot => - ctx.eh.violation(UnsupportedScalarRootLevel, shape, UnsupportedScalarRootLevel.message, Annotations(node)) - JsonLDErrorBuilder(path) + generateErrorBuilder(UnsupportedScalarRootLevel) case _ => - ctx.eh.violation(UnsupportedRootLevel, shape, UnsupportedRootLevel.message, Annotations(node)) - JsonLDErrorBuilder(path) + generateErrorBuilder(UnsupportedRootLevel) } } + private def generateErrorBuilder(validation: ValidationSpecification): JsonLDErrorBuilder = { + ctx.eh.violation(validation, shape, validation.message, Annotations(node)) + val annotation = Annotations(node.value) + JsonLDErrorBuilder(annotation, path) + } private def isScalarNode = { node.value.isInstanceOf[YScalar] diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDArrayElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDArrayElementBuilder.scala index 17af78f533..d7f0b42e44 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDArrayElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDArrayElementBuilder.scala @@ -2,14 +2,15 @@ package amf.shapes.internal.spec.jsonldschema.parser.builder import amf.core.client.scala.model.domain.context.EntityContextBuilder import amf.core.internal.metamodel.Type +import amf.core.internal.parser.domain.Annotations import amf.shapes.client.scala.model.domain.jsonldinstance.{JsonLDArray, JsonLDElement} import amf.shapes.internal.domain.metamodel.jsonldschema.JsonLDElementModel import amf.shapes.internal.spec.jsonldschema.parser.builder.ArrayTypeComputation.computeType import amf.shapes.internal.spec.jsonldschema.parser.{JsonLDParserContext, JsonPath} import amf.shapes.internal.spec.jsonldschema.validation.JsonLDSchemaValidations.IncompatibleItemNodes -import org.mulesoft.common.client.lexical.SourceLocation -class JsonLDArrayElementBuilder(location: SourceLocation, path: JsonPath) extends JsonLDElementBuilder(location, path) { + +class JsonLDArrayElementBuilder(annotation: Annotations, path: JsonPath) extends JsonLDElementBuilder(annotation, path) { private var items: Seq[JsonLDElementBuilder] = Seq.empty override type THIS = JsonLDArrayElementBuilder @@ -32,7 +33,7 @@ class JsonLDArrayElementBuilder(location: SourceLocation, path: JsonPath) extend .map({ case (current, other) if (current.canEquals(other)) => mergeItem(current, other) case (_, other) => - ctx.violation(IncompatibleItemNodes, "", IncompatibleItemNodes.message, other.location) + ctx.violation(IncompatibleItemNodes, "", IncompatibleItemNodes.message, other.annotation.sourceLocation) other }) } diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDElementBuilder.scala index 3e3892f5dc..23962c78ce 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDElementBuilder.scala @@ -2,11 +2,11 @@ package amf.shapes.internal.spec.jsonldschema.parser.builder import amf.core.client.scala.model.domain.context.EntityContextBuilder import amf.core.internal.metamodel.Type +import amf.core.internal.parser.domain.Annotations import amf.shapes.client.scala.model.domain.jsonldinstance.JsonLDElement import amf.shapes.internal.spec.jsonldschema.parser.{JsonLDParserContext, JsonPath} -import org.mulesoft.common.client.lexical.SourceLocation -abstract class JsonLDElementBuilder(val location: SourceLocation, val path: JsonPath) { +abstract class JsonLDElementBuilder(val annotation: Annotations, val path: JsonPath) { private var overriddenTerm: Option[String] = None private var overriddenType: Option[Type] = None diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDErrorBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDErrorBuilder.scala index 818652690c..42e7b65a6b 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDErrorBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDErrorBuilder.scala @@ -2,11 +2,12 @@ package amf.shapes.internal.spec.jsonldschema.parser.builder import amf.core.client.scala.model.domain.context.EntityContextBuilder import amf.core.internal.metamodel.Type +import amf.core.internal.parser.domain.Annotations import amf.shapes.client.scala.model.domain.jsonldinstance.{JsonLDElement, JsonLDError} import amf.shapes.internal.spec.jsonldschema.parser.JsonPath -import org.mulesoft.common.client.lexical.SourceLocation +import org.mulesoft.common.client.lexical.{PositionRange, SourceLocation} -class JsonLDErrorBuilder(path: JsonPath) extends JsonLDElementBuilder(SourceLocation.Unknown, path) { +class JsonLDErrorBuilder(annotation: Annotations, path: JsonPath) extends JsonLDElementBuilder(annotation, path) { override type THIS = this.type override def build(ctxBuilder: EntityContextBuilder): (JsonLDElement, Type) = (JsonLDError(), Type.Null) @@ -15,5 +16,5 @@ class JsonLDErrorBuilder(path: JsonPath) extends JsonLDElementBuilder(SourceLoca } object JsonLDErrorBuilder { - def apply(path: JsonPath) = new JsonLDErrorBuilder(path) + def apply(annotation: Annotations, path: JsonPath) = new JsonLDErrorBuilder(annotation, path) } diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala index 72f61e62c9..0a8d6dbd28 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala @@ -4,6 +4,7 @@ import amf.core.client.scala.model.domain.context.EntityContextBuilder import amf.core.client.scala.vocabulary.ValueType import amf.core.internal.metamodel.domain.ModelDoc import amf.core.internal.metamodel.{Field, Type} +import amf.core.internal.parser.domain.Annotations import amf.shapes.client.scala.model.domain.SemanticContext import amf.shapes.client.scala.model.domain.jsonldinstance.{JsonLDArray, JsonLDElement, JsonLDObject} import amf.shapes.internal.domain.metamodel.jsonldschema.JsonLDEntityModel @@ -11,13 +12,14 @@ import amf.shapes.internal.spec.jsonldschema.parser.builder.ArrayTypeComputation import amf.shapes.internal.spec.jsonldschema.parser.builder.JsonLDObjectElementBuilder.{Key, Term, buildObj} import amf.shapes.internal.spec.jsonldschema.parser.builder.ObjectPropertyMerge.mergeProperties import amf.shapes.internal.spec.jsonldschema.parser.{JsonLDParserContext, JsonPath} -import org.mulesoft.common.client.lexical.SourceLocation +import org.mulesoft.common.client.lexical.{PositionRange, SourceLocation} + import scala.collection.mutable import scala.collection.mutable.ListBuffer -class JsonLDObjectElementBuilder(location: SourceLocation, key: String, base: String, path: JsonPath) - extends JsonLDElementBuilder(location, path) { +class JsonLDObjectElementBuilder(annotation: Annotations, key: String, base: String, path: JsonPath) + extends JsonLDElementBuilder(annotation, path) { override type THIS = JsonLDObjectElementBuilder private val termIndex: mutable.LinkedHashMap[Term, List[JsonLDPropertyBuilder]] = mutable.LinkedHashMap() @@ -96,7 +98,7 @@ object JsonLDObjectElementBuilder { type Key = String type Term = String def empty(key: String, path: JsonPath) = - new JsonLDObjectElementBuilder(SourceLocation.Unknown, key, SemanticContext.baseIri, path) + new JsonLDObjectElementBuilder(Annotations.virtual, key, SemanticContext.baseIri, path) protected def buildObj( termIndex: mutable.LinkedHashMap[Term, List[JsonLDPropertyBuilder]], diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala index bdca6d88ef..ec369f26ba 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala @@ -3,17 +3,19 @@ package amf.shapes.internal.spec.jsonldschema.parser.builder import amf.core.client.platform.model.DataTypes import amf.core.client.scala.model.domain.context.EntityContextBuilder import amf.core.internal.metamodel.Type +import amf.core.internal.parser.domain.Annotations import amf.shapes.client.scala.model.domain.jsonldinstance.{JsonLDElement, JsonLDScalar} import amf.shapes.internal.spec.jsonldschema.parser.{JsonLDParserContext, JsonPath} import amf.shapes.internal.spec.jsonldschema.validation.JsonLDSchemaValidations.IncompatibleScalarDataType -import org.mulesoft.common.client.lexical.SourceLocation +import org.mulesoft.common.client.lexical.{PositionRange, SourceLocation} +import org.yaml.model.YValue class JsonLDScalarElementBuilder( var dataType: String, var value: Any, - override val location: SourceLocation, + override val annotation: Annotations, path: JsonPath -) extends JsonLDElementBuilder(location, path) { +) extends JsonLDElementBuilder(annotation, path) { override type THIS = JsonLDScalarElementBuilder @@ -31,7 +33,7 @@ class JsonLDScalarElementBuilder( case DataTypes.Number if other.dataType == DataTypes.Integer => dataType = other.dataType case _ => - ctx.violation(IncompatibleScalarDataType, "", IncompatibleScalarDataType.message, location) + ctx.violation(IncompatibleScalarDataType, "", IncompatibleScalarDataType.message) dataType = other.dataType value = other.value } @@ -56,5 +58,5 @@ class JsonLDScalarElementBuilder( } object JsonLDScalarElementBuilder { - def empty(path: JsonPath) = new JsonLDScalarElementBuilder(DataTypes.Nil, null, SourceLocation.Unknown, path) + def empty(path: JsonPath) = new JsonLDScalarElementBuilder(DataTypes.Nil, null, Annotations.virtual(), path) } diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/ObjectPropertyMerge.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/ObjectPropertyMerge.scala index 33d2352381..719cb2e688 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/ObjectPropertyMerge.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/ObjectPropertyMerge.scala @@ -20,12 +20,12 @@ object ObjectPropertyMerge { case (currScalar: JsonLDScalarElementBuilder, otherScalar: JsonLDScalarElementBuilder) => currScalar.merge(otherScalar) case (_: JsonLDErrorBuilder, _: JsonLDErrorBuilder) => - ctx.violation(IncompatibleNodes, "", IncompatibleNodes.message, current.location) + ctx.violation(IncompatibleNodes, "", IncompatibleNodes.message, current.annotation.sourceLocation) other case (_: JsonLDErrorBuilder, _) => other case (_, _: JsonLDErrorBuilder) => current case _ => - ctx.violation(IncompatibleNodes, "", IncompatibleNodes.message, current.location) + ctx.violation(IncompatibleNodes, "", IncompatibleNodes.message, current.annotation.sourceLocation) other } } From 143edeef8382278f06921712c413bf5bc831c4c2 Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Tue, 19 Dec 2023 17:33:53 -0300 Subject: [PATCH 04/33] W-14654096: Add annotation in Property Builder and property Parser. Add test to parse properies --- .../domain/jsonldinstance/JsonLDArray.scala | 4 +- .../parser/JsonLDPropertyParser.scala | 4 +- .../builder/JsonLDObjectElementBuilder.scala | 15 +++++--- .../builder/JsonLDPropertyBuilder.scala | 3 +- .../properties/instance.json | 3 ++ .../properties/instance.jsonld | 38 +++++++++++++++++++ .../properties/schema.json | 10 +++++ ...chemaInstanceCycleWithSourceMapsTest.scala | 37 ++++++++++++++++++ 8 files changed, 104 insertions(+), 10 deletions(-) create mode 100644 amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json create mode 100644 amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.jsonld create mode 100644 amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/schema.json create mode 100644 amf-shapes/shared/src/test/scala/amf/shapes/client/jsonldschema/cycle/JsonLDSchemaInstanceCycleWithSourceMapsTest.scala diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala index f7d0eab55e..17795e37c2 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala @@ -18,10 +18,10 @@ object JsonLDArray { } } -class JsonLDArray extends AmfArray(Nil) with JsonLDElement { +class JsonLDArray extends AmfArray(Nil) with JsonLDElement { //pasar annotations como parametro /** Set of annotations for element. */ - override val annotations: Annotations = Annotations.virtual() + override val annotations: Annotations = Annotations.virtual() //volar esto, ya las pasamos por parametro def +=(value: JsonLDElement): Unit = { values = values :+ value diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDPropertyParser.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDPropertyParser.scala index 33033e593d..6dd4ed5b50 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDPropertyParser.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/JsonLDPropertyParser.scala @@ -3,6 +3,7 @@ package amf.shapes.internal.spec.jsonldschema.parser import amf.core.client.scala.model.domain.Shape import amf.core.client.scala.model.domain.extensions.PropertyShape import amf.core.internal.metamodel.Type +import amf.core.internal.parser.domain.Annotations import amf.core.internal.plugins.document.graph.JsonLdKeywords import amf.shapes.client.scala.model.domain._ import amf.shapes.internal.domain.metamodel.jsonldschema.JsonLDElementModel @@ -51,7 +52,8 @@ case class JsonLDPropertyParser( } private def generateBuilder(element: JsonLDElementBuilder, term: String, entry: YMapEntry) = { - JsonLDPropertyBuilder(term, entry.key, None, element, element.path, entry.location) + val annotation = Annotations(entry) + JsonLDPropertyBuilder(term, entry.key, None, element, element.path, annotation) } private def literalMatcher(property: PropertyShape, entryKey: String): Boolean = { diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala index 0a8d6dbd28..27ad4cfa2f 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala @@ -14,7 +14,6 @@ import amf.shapes.internal.spec.jsonldschema.parser.builder.ObjectPropertyMerge. import amf.shapes.internal.spec.jsonldschema.parser.{JsonLDParserContext, JsonPath} import org.mulesoft.common.client.lexical.{PositionRange, SourceLocation} - import scala.collection.mutable import scala.collection.mutable.ListBuffer @@ -109,22 +108,22 @@ object JsonLDObjectElementBuilder { val fields = termIndex.map { case (term, List(builder)) => val (element, elementType) = builder.element.build(ctxBuilder) - createField(builder, elementType) -> element + createField(builder, elementType) -> PropertyData(element, builder.annotation) case (term, builders) => val (elements, types) = TupleOps.reduce(builders.map(_.element.build(ctxBuilder))) - val element = JsonLDArray(elements) + val element = JsonLDArray(elements) // pasar Annotations.virtual() cuando se pase el annotation al JsonLDArray val arrayType = computeType(types) Field( Type.Array(arrayType), ValueType(term), ModelDoc(displayName = displayNameForMultipleValuedTerm(builders)) - ) -> element + ) -> PropertyData(element, Annotations.inferred()) } createObjectElement(fields, classTerms, path, ctxBuilder) } private def createObjectElement( - fields: mutable.LinkedHashMap[Field, JsonLDElement], + fields: mutable.LinkedHashMap[Field, PropertyData], classTerms: List[String], path: JsonPath, ctxBuilder: EntityContextBuilder @@ -132,7 +131,7 @@ object JsonLDObjectElementBuilder { val entityModel = new JsonLDEntityModel(asValueTerms(classTerms), fields.keys.toList, path) ctxBuilder + entityModel val dObject = JsonLDObject.empty(entityModel, path.last) - fields.foreach { case (field, value) => dObject.set(field, value) } + fields.foreach { case (field, prop) => dObject.set(field, prop.propertyElement, prop.propertyAnnotations) } dObject } @@ -147,3 +146,7 @@ object JsonLDObjectElementBuilder { } } + +case class PropertyData(propertyElement: JsonLDElement, propertyAnnotations: Annotations){ + +} diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDPropertyBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDPropertyBuilder.scala index ad575defe7..289422b9c0 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDPropertyBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDPropertyBuilder.scala @@ -1,5 +1,6 @@ package amf.shapes.internal.spec.jsonldschema.parser.builder +import amf.core.internal.parser.domain.Annotations import amf.shapes.client.scala.model.domain.SemanticContext import amf.shapes.internal.spec.jsonldschema.parser.JsonPath import org.mulesoft.common.client.lexical.SourceLocation @@ -10,7 +11,7 @@ case class JsonLDPropertyBuilder( father: Option[String], element: JsonLDElementBuilder, path: JsonPath, - location: SourceLocation + annotation: Annotations ) { def hasTermWithDefaultBase: Boolean = term.startsWith(SemanticContext.baseIri) def term: String = element.getOverriddenTerm.getOrElse(keyTerm) diff --git a/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json b/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json new file mode 100644 index 0000000000..fa521c0110 --- /dev/null +++ b/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json @@ -0,0 +1,3 @@ +{ + "prop1": "abcdefg" +} \ No newline at end of file diff --git a/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.jsonld b/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.jsonld new file mode 100644 index 0000000000..c284e1a20d --- /dev/null +++ b/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.jsonld @@ -0,0 +1,38 @@ +{ + "@graph": [ + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#BaseUnitProcessingData" + ], + "http://a.ml/vocabularies/document#transformed": false + }, + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/", + "@type": [ + "http://a.ml/vocabularies/core#encodes", + "http://a.ml/vocabularies/document#JsonLDObject" + ], + "http://a.ml/vocabularies/core#prop1": "abcdefg" + }, + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json", + "@type": [ + "http://a.ml/vocabularies/document#JsonLDInstanceDocument", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/" + } + ], + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/BaseUnitProcessingData" + } + } + ] +} diff --git a/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/schema.json b/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/schema.json new file mode 100644 index 0000000000..74a94e41c8 --- /dev/null +++ b/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/schema.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft/2019-09/schema#", + "type": "object", + "properties": { + "prop1": { + "type": "string" + } + }, + "required": [ "prop1" ] +} diff --git a/amf-shapes/shared/src/test/scala/amf/shapes/client/jsonldschema/cycle/JsonLDSchemaInstanceCycleWithSourceMapsTest.scala b/amf-shapes/shared/src/test/scala/amf/shapes/client/jsonldschema/cycle/JsonLDSchemaInstanceCycleWithSourceMapsTest.scala new file mode 100644 index 0000000000..dbbf76ddf3 --- /dev/null +++ b/amf-shapes/shared/src/test/scala/amf/shapes/client/jsonldschema/cycle/JsonLDSchemaInstanceCycleWithSourceMapsTest.scala @@ -0,0 +1,37 @@ +package amf.shapes.client.jsonldschema.cycle + +import amf.core.client.scala.config.RenderOptions +import amf.core.internal.remote.Mimes +import amf.io.FileAssertionTest +import amf.shapes.client.scala.config.{JsonLDSchemaConfiguration, JsonLDSchemaConfigurationClient} +import org.scalatest.Assertion +import org.scalatest.funsuite.AsyncFunSuite + +import scala.concurrent.{ExecutionContext, Future} + +class JsonLDSchemaInstanceCycleWithSourceMapsTest extends AsyncFunSuite with FileAssertionTest { + + override implicit def executionContext: ExecutionContext = ExecutionContext.Implicits.global + + private val basePath: String = "amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps" + + + val client: JsonLDSchemaConfigurationClient = + JsonLDSchemaConfiguration.JsonLDSchema().withRenderOptions(RenderOptions().withPrettyPrint.withSourceMaps).baseUnitClient() + + private def run(testFolder: String): Future[Assertion] = { + val testPath = s"$basePath/$testFolder" + for { + schema <- client.parseJsonLDSchema(s"file://$testPath/schema.json").map(_.jsonDocument) + instance <- client.parseJsonLDInstance(s"file://$testPath/instance.json", schema) + instanceLD <- Future.successful(client.render(instance.baseUnit, Mimes.`application/ld+json`)) + tmp <- writeTemporaryFile(s"/instance.jsonld")(instanceLD) + diff <- assertDifferences(tmp, s"$testPath/instance.jsonld") + } yield diff + } + + test("Test properties") { + run("properties") + } + +} From 1d7771f598b6b8590897068aa549d7be1b5be2f6 Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Fri, 29 Dec 2023 14:31:59 -0300 Subject: [PATCH 05/33] W-14654096: add annotation as paramater in JsonLDArray and JsonLDScalar --- .../model/domain/jsonldinstance/JsonLDScalar.scala | 3 ++- .../model/domain/jsonldinstance/JsonLDArray.scala | 8 +++----- .../model/domain/jsonldinstance/JsonLDObject.scala | 14 +++++++------- .../model/domain/jsonldinstance/JsonLDScalar.scala | 5 +---- .../parser/builder/JsonLDArrayElementBuilder.scala | 2 +- .../builder/JsonLDScalarElementBuilder.scala | 4 ++-- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/client/platform/model/domain/jsonldinstance/JsonLDScalar.scala b/amf-shapes/shared/src/main/scala/amf/shapes/client/platform/model/domain/jsonldinstance/JsonLDScalar.scala index e7d515558a..41525d8c3e 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/client/platform/model/domain/jsonldinstance/JsonLDScalar.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/client/platform/model/domain/jsonldinstance/JsonLDScalar.scala @@ -1,5 +1,6 @@ package amf.shapes.client.platform.model.domain.jsonldinstance import amf.core.client.platform.model +import amf.core.client.platform.model.Annotations import amf.shapes.client.scala.model.domain.jsonldinstance.{JsonLDScalar => InternalJsonLDScalar} import amf.shapes.internal.convert.ShapeClientConverters._ @@ -12,7 +13,7 @@ class JsonLDScalar(private[amf] val _internal: InternalJsonLDScalar) extends Jso val dataType: String = _internal.dataType @JSExportTopLevel("JsonLDScalar") - def this(value: Any, dataType: String) = this(new InternalJsonLDScalar(value, dataType)) + def this(value: Any, dataType: String, annotations: Annotations) = this(new InternalJsonLDScalar(value, dataType, annotations)) override def annotations(): model.Annotations = _internal.annotations } diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala index 17795e37c2..5ee3a7386d 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala @@ -12,16 +12,14 @@ import scala.collection.mutable object JsonLDArray { def apply(elements: Seq[JsonLDElement]): JsonLDArray = { - val result = new JsonLDArray + val annotations = new Annotations + val result = new JsonLDArray(annotations) elements.foreach(elem => result += elem) result } } -class JsonLDArray extends AmfArray(Nil) with JsonLDElement { //pasar annotations como parametro - - /** Set of annotations for element. */ - override val annotations: Annotations = Annotations.virtual() //volar esto, ya las pasamos por parametro +class JsonLDArray(annotations: Annotations) extends AmfArray(Nil, annotations) with JsonLDElement { def +=(value: JsonLDElement): Unit = { values = values :+ value diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDObject.scala b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDObject.scala index 186d027155..f62b2b0aaa 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDObject.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDObject.scala @@ -47,16 +47,16 @@ case class JsonLDObject( def toFloatListField: Field = Field(Type.Array(Type.Float), ValueType(property)) } - private def buildString(value: String) = new JsonLDScalar(value, DataTypes.String) + private def buildString(value: String) = new JsonLDScalar(value, DataTypes.String, annotations) - private def buildDateTime(value: SimpleDateTime) = new JsonLDScalar(value, DataTypes.DateTime) - private def buildDate(value: SimpleDateTime) = new JsonLDScalar(value, DataTypes.Date) + private def buildDateTime(value: SimpleDateTime) = new JsonLDScalar(value, DataTypes.DateTime, annotations) + private def buildDate(value: SimpleDateTime) = new JsonLDScalar(value, DataTypes.Date, annotations) - private def buildInteger(value: Int) = new JsonLDScalar(value, DataTypes.Integer) + private def buildInteger(value: Int) = new JsonLDScalar(value, DataTypes.Integer, annotations) - private def buildBoolean(value: Boolean) = new JsonLDScalar(value, DataTypes.Boolean) - private def buildFloat(value: Float) = new JsonLDScalar(value, DataTypes.Float) - private def buildDouble(value: Double) = new JsonLDScalar(value, DataTypes.Double) + private def buildBoolean(value: Boolean) = new JsonLDScalar(value, DataTypes.Boolean, annotations) + private def buildFloat(value: Float) = new JsonLDScalar(value, DataTypes.Float, annotations) + private def buildDouble(value: Double) = new JsonLDScalar(value, DataTypes.Double, annotations) private def buildArray(values: Seq[JsonLDElement]) = JsonLDArray(values) diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDScalar.scala b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDScalar.scala index a3b7266cdb..7f594e17ee 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDScalar.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDScalar.scala @@ -3,9 +3,6 @@ package amf.shapes.client.scala.model.domain.jsonldinstance import amf.core.client.scala.model.domain.AmfScalar import amf.core.internal.parser.domain.Annotations -class JsonLDScalar(override val value: Any, val dataType: String) extends AmfScalar(value) with JsonLDElement { - - /** Set of annotations for element. */ - override val annotations: Annotations = Annotations.virtual() +class JsonLDScalar(override val value: Any, val dataType: String, override val annotations: Annotations = new Annotations()) extends AmfScalar(value , annotations) with JsonLDElement { } diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDArrayElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDArrayElementBuilder.scala index d7f0b42e44..8e558472ea 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDArrayElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDArrayElementBuilder.scala @@ -54,7 +54,7 @@ class JsonLDArrayElementBuilder(annotation: Annotations, path: JsonPath) extends } override def build(ctxBuilder: EntityContextBuilder): (JsonLDElement, Type) = { - val starter = (new JsonLDArray, JsonLDElementModel) + val starter = (new JsonLDArray(annotation), JsonLDElementModel) val (result, meta) = items.foldLeft[(JsonLDArray, Type)](starter) { (tuple, builder) => val (array, meta) = tuple build(builder, array, meta, ctxBuilder) diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala index ec369f26ba..584c52860b 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala @@ -41,7 +41,7 @@ class JsonLDScalarElementBuilder( } override def build(ctxBuilder: EntityContextBuilder): (JsonLDElement, Type) = { - (new JsonLDScalar(value, dataType), getType) + (new JsonLDScalar(value, dataType, annotation), getType) } private def getType = { @@ -58,5 +58,5 @@ class JsonLDScalarElementBuilder( } object JsonLDScalarElementBuilder { - def empty(path: JsonPath) = new JsonLDScalarElementBuilder(DataTypes.Nil, null, Annotations.virtual(), path) + def empty(path: JsonPath) = new JsonLDScalarElementBuilder(DataTypes.Nil, null, Annotations.empty, path)// esta ok sacar annotation.virtual y dejarla como empty? } From c30c0e1a1768a4eea866b0ba295ad981f2fe393e Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Tue, 2 Jan 2024 15:14:38 -0300 Subject: [PATCH 06/33] W-14654096: add virtual annotation when is more that one builder --- .../platform/model/domain/jsonldinstance/JsonLDScalar.scala | 2 +- .../scala/model/domain/jsonldinstance/JsonLDArray.scala | 4 ++-- .../parser/builder/JsonLDObjectElementBuilder.scala | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/client/platform/model/domain/jsonldinstance/JsonLDScalar.scala b/amf-shapes/shared/src/main/scala/amf/shapes/client/platform/model/domain/jsonldinstance/JsonLDScalar.scala index 41525d8c3e..05a615da4f 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/client/platform/model/domain/jsonldinstance/JsonLDScalar.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/client/platform/model/domain/jsonldinstance/JsonLDScalar.scala @@ -13,7 +13,7 @@ class JsonLDScalar(private[amf] val _internal: InternalJsonLDScalar) extends Jso val dataType: String = _internal.dataType @JSExportTopLevel("JsonLDScalar") - def this(value: Any, dataType: String, annotations: Annotations) = this(new InternalJsonLDScalar(value, dataType, annotations)) + def this(value: Any, dataType: String) = this(new InternalJsonLDScalar(value, dataType)) override def annotations(): model.Annotations = _internal.annotations } diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala index 5ee3a7386d..9da2b9778c 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala @@ -5,14 +5,14 @@ import amf.core.client.scala.vocabulary.Namespace.Data import amf.core.client.scala.vocabulary.{Namespace, ValueType} import amf.core.internal.metamodel.{Field, Type} import amf.core.internal.metamodel.domain.{ModelDoc, ModelVocabularies} +import amf.core.internal.parser.domain import amf.core.internal.parser.domain.{Annotations, Fields} import amf.shapes.internal.spec.jsonldschema.parser.JsonPath import scala.collection.mutable object JsonLDArray { - def apply(elements: Seq[JsonLDElement]): JsonLDArray = { - val annotations = new Annotations + def apply(elements: Seq[JsonLDElement], annotations: Annotations = new Annotations): JsonLDArray = { val result = new JsonLDArray(annotations) elements.foreach(elem => result += elem) result diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala index 27ad4cfa2f..96c061bd5c 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala @@ -111,7 +111,7 @@ object JsonLDObjectElementBuilder { createField(builder, elementType) -> PropertyData(element, builder.annotation) case (term, builders) => val (elements, types) = TupleOps.reduce(builders.map(_.element.build(ctxBuilder))) - val element = JsonLDArray(elements) // pasar Annotations.virtual() cuando se pase el annotation al JsonLDArray + val element = JsonLDArray(elements, Annotations.virtual()) val arrayType = computeType(types) Field( Type.Array(arrayType), From bb0be139645d01738b06c05b494e925af6a4b0b7 Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Tue, 23 Jan 2024 14:48:48 -0300 Subject: [PATCH 07/33] W-14654096: Add test for annotations range and anotations clash --- .../domain/jsonldinstance/JsonLDArray.scala | 2 +- .../domain/jsonldinstance/JsonLDObject.scala | 4 +- .../builder/JsonLDObjectElementBuilder.scala | 28 ++++-- .../builder/JsonLDScalarElementBuilder.scala | 2 +- .../properties/instance.jsonld | 23 ++++- .../sourcemaps-annotations/instance.json | 7 ++ .../sourcemaps-annotations/instance.jsonld | 59 ++++++++++++ .../sourcemaps-annotations/schema.json | 10 ++ .../instance-term-with-same-iri-as-prop.json | 4 + .../schema-term-with-same-iri-as-prop.json | 16 ++++ ...chemaInstanceCycleWithSourceMapsTest.scala | 92 ++++++++++++++++--- 11 files changed, 218 insertions(+), 29 deletions(-) create mode 100644 amf-shapes/shared/src/test/resources/sourcemaps-annotations/instance.json create mode 100644 amf-shapes/shared/src/test/resources/sourcemaps-annotations/instance.jsonld create mode 100644 amf-shapes/shared/src/test/resources/sourcemaps-annotations/schema.json create mode 100644 amf-shapes/shared/src/test/resources/sourcemaps-clash-annotations/instance-term-with-same-iri-as-prop.json create mode 100644 amf-shapes/shared/src/test/resources/sourcemaps-clash-annotations/schema-term-with-same-iri-as-prop.json diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala index 9da2b9778c..eca1f0e583 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDArray.scala @@ -12,7 +12,7 @@ import amf.shapes.internal.spec.jsonldschema.parser.JsonPath import scala.collection.mutable object JsonLDArray { - def apply(elements: Seq[JsonLDElement], annotations: Annotations = new Annotations): JsonLDArray = { + def apply(elements: Seq[JsonLDElement], annotations: Annotations = Annotations()): JsonLDArray = { val result = new JsonLDArray(annotations) elements.foreach(elem => result += elem) result diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDObject.scala b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDObject.scala index f62b2b0aaa..998680c4d2 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDObject.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/client/scala/model/domain/jsonldinstance/JsonLDObject.scala @@ -10,8 +10,8 @@ import amf.shapes.internal.spec.jsonldschema.parser.JsonPath import org.mulesoft.common.time.SimpleDateTime object JsonLDObject { - def empty(model: JsonLDEntityModel, path: JsonPath): JsonLDObject = - new JsonLDObject(Fields(), Annotations(), model, path) + def empty(model: JsonLDEntityModel, path: JsonPath, annotations: Annotations = Annotations()): JsonLDObject = + new JsonLDObject(Fields(), annotations, model, path) } case class JsonLDObject( diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala index 96c061bd5c..601a55f5c2 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDObjectElementBuilder.scala @@ -55,7 +55,7 @@ class JsonLDObjectElementBuilder(annotation: Annotations, key: String, base: Str } override def build(ctxBuilder: EntityContextBuilder): (JsonLDElement, Type) = { - val obj = buildObj(termIndex, classTerms.toList, path, ctxBuilder) + val obj = buildObj(termIndex, classTerms.toList, path, ctxBuilder, annotation) (obj, obj.meta) } @@ -103,34 +103,42 @@ object JsonLDObjectElementBuilder { termIndex: mutable.LinkedHashMap[Term, List[JsonLDPropertyBuilder]], classTerms: List[String], path: JsonPath, - ctxBuilder: EntityContextBuilder + ctxBuilder: EntityContextBuilder, + annotations: Annotations ): JsonLDObject = { - val fields = termIndex.map { + val fields = termIndex.map(mapTermBuildersToField(ctxBuilder)) + createObjectElement(fields, classTerms, path, ctxBuilder, annotations) + } + + private def mapTermBuildersToField(ctxBuilder: EntityContextBuilder)(tuple:(Term, List[JsonLDPropertyBuilder])): (Field, PropertyData) = { + tuple match { case (term, List(builder)) => val (element, elementType) = builder.element.build(ctxBuilder) createField(builder, elementType) -> PropertyData(element, builder.annotation) case (term, builders) => val (elements, types) = TupleOps.reduce(builders.map(_.element.build(ctxBuilder))) - val element = JsonLDArray(elements, Annotations.virtual()) - val arrayType = computeType(types) + val element = JsonLDArray(elements, Annotations.virtual()) + val arrayType = computeType(types) Field( Type.Array(arrayType), ValueType(term), ModelDoc(displayName = displayNameForMultipleValuedTerm(builders)) ) -> PropertyData(element, Annotations.inferred()) } - createObjectElement(fields, classTerms, path, ctxBuilder) + + } private def createObjectElement( fields: mutable.LinkedHashMap[Field, PropertyData], classTerms: List[String], path: JsonPath, - ctxBuilder: EntityContextBuilder + ctxBuilder: EntityContextBuilder, + annotations: Annotations ) = { val entityModel = new JsonLDEntityModel(asValueTerms(classTerms), fields.keys.toList, path) ctxBuilder + entityModel - val dObject = JsonLDObject.empty(entityModel, path.last) + val dObject = JsonLDObject.empty(entityModel, path.last, annotations) fields.foreach { case (field, prop) => dObject.set(field, prop.propertyElement, prop.propertyAnnotations) } dObject } @@ -147,6 +155,6 @@ object JsonLDObjectElementBuilder { } -case class PropertyData(propertyElement: JsonLDElement, propertyAnnotations: Annotations){ +case class PropertyData(propertyElement: JsonLDElement, propertyAnnotations: Annotations) + -} diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala index 584c52860b..fe27c8d04c 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/jsonldschema/parser/builder/JsonLDScalarElementBuilder.scala @@ -58,5 +58,5 @@ class JsonLDScalarElementBuilder( } object JsonLDScalarElementBuilder { - def empty(path: JsonPath) = new JsonLDScalarElementBuilder(DataTypes.Nil, null, Annotations.empty, path)// esta ok sacar annotation.virtual y dejarla como empty? + def empty(path: JsonPath) = new JsonLDScalarElementBuilder(DataTypes.Nil, null, Annotations.empty, path) } diff --git a/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.jsonld b/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.jsonld index c284e1a20d..51ea59c3b4 100644 --- a/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.jsonld +++ b/amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.jsonld @@ -13,7 +13,28 @@ "http://a.ml/vocabularies/core#encodes", "http://a.ml/vocabularies/document#JsonLDObject" ], - "http://a.ml/vocabularies/core#prop1": "abcdefg" + "http://a.ml/vocabularies/core#prop1": "abcdefg", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#prop1", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,2)-(2,20)]" }, { "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json", diff --git a/amf-shapes/shared/src/test/resources/sourcemaps-annotations/instance.json b/amf-shapes/shared/src/test/resources/sourcemaps-annotations/instance.json new file mode 100644 index 0000000000..b8fc8bfa32 --- /dev/null +++ b/amf-shapes/shared/src/test/resources/sourcemaps-annotations/instance.json @@ -0,0 +1,7 @@ +{ + "prop1": "abcdefg", + "prop-array": ["asd","v23"], + "prop-obj": { + "key": 1 + } +} diff --git a/amf-shapes/shared/src/test/resources/sourcemaps-annotations/instance.jsonld b/amf-shapes/shared/src/test/resources/sourcemaps-annotations/instance.jsonld new file mode 100644 index 0000000000..51ea59c3b4 --- /dev/null +++ b/amf-shapes/shared/src/test/resources/sourcemaps-annotations/instance.jsonld @@ -0,0 +1,59 @@ +{ + "@graph": [ + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/BaseUnitProcessingData", + "@type": [ + "http://a.ml/vocabularies/document#BaseUnitProcessingData" + ], + "http://a.ml/vocabularies/document#transformed": false + }, + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/", + "@type": [ + "http://a.ml/vocabularies/core#encodes", + "http://a.ml/vocabularies/document#JsonLDObject" + ], + "http://a.ml/vocabularies/core#prop1": "abcdefg", + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/source-map" + } + ] + }, + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/source-map/lexical/element_0" + } + ] + }, + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/core#prop1", + "http://a.ml/vocabularies/document-source-maps#value": "[(2,2)-(2,20)]" + }, + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json", + "@type": [ + "http://a.ml/vocabularies/document#JsonLDInstanceDocument", + "http://a.ml/vocabularies/document#Document", + "http://a.ml/vocabularies/document#Fragment", + "http://a.ml/vocabularies/document#Module", + "http://a.ml/vocabularies/document#Unit" + ], + "http://a.ml/vocabularies/document#encodes": [ + { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/encodes/" + } + ], + "http://a.ml/vocabularies/document#root": true, + "http://a.ml/vocabularies/document#processingData": { + "@id": "file://amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps/properties/instance.json#/BaseUnitProcessingData" + } + } + ] +} diff --git a/amf-shapes/shared/src/test/resources/sourcemaps-annotations/schema.json b/amf-shapes/shared/src/test/resources/sourcemaps-annotations/schema.json new file mode 100644 index 0000000000..74a94e41c8 --- /dev/null +++ b/amf-shapes/shared/src/test/resources/sourcemaps-annotations/schema.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft/2019-09/schema#", + "type": "object", + "properties": { + "prop1": { + "type": "string" + } + }, + "required": [ "prop1" ] +} diff --git a/amf-shapes/shared/src/test/resources/sourcemaps-clash-annotations/instance-term-with-same-iri-as-prop.json b/amf-shapes/shared/src/test/resources/sourcemaps-clash-annotations/instance-term-with-same-iri-as-prop.json new file mode 100644 index 0000000000..1f8c63b2a9 --- /dev/null +++ b/amf-shapes/shared/src/test/resources/sourcemaps-clash-annotations/instance-term-with-same-iri-as-prop.json @@ -0,0 +1,4 @@ +{ + "prop1": true, + "prop2": "false" +} diff --git a/amf-shapes/shared/src/test/resources/sourcemaps-clash-annotations/schema-term-with-same-iri-as-prop.json b/amf-shapes/shared/src/test/resources/sourcemaps-clash-annotations/schema-term-with-same-iri-as-prop.json new file mode 100644 index 0000000000..5fca3d892d --- /dev/null +++ b/amf-shapes/shared/src/test/resources/sourcemaps-clash-annotations/schema-term-with-same-iri-as-prop.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft/2019-09/schema#", + "type": "object", + "@context": { + "alias": "http://a.ml/vocabularies/core#", + "prop1": "alias:prop2" + }, + "properties": { + "prop1": { + "type": "boolean" + }, + "prop2": { + "type": "string" + } + } +} diff --git a/amf-shapes/shared/src/test/scala/amf/shapes/client/jsonldschema/cycle/JsonLDSchemaInstanceCycleWithSourceMapsTest.scala b/amf-shapes/shared/src/test/scala/amf/shapes/client/jsonldschema/cycle/JsonLDSchemaInstanceCycleWithSourceMapsTest.scala index dbbf76ddf3..1885f60b52 100644 --- a/amf-shapes/shared/src/test/scala/amf/shapes/client/jsonldschema/cycle/JsonLDSchemaInstanceCycleWithSourceMapsTest.scala +++ b/amf-shapes/shared/src/test/scala/amf/shapes/client/jsonldschema/cycle/JsonLDSchemaInstanceCycleWithSourceMapsTest.scala @@ -1,37 +1,101 @@ package amf.shapes.client.jsonldschema.cycle import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.model.domain.{AmfArray, AmfObject} +import amf.core.client.scala.vocabulary.Namespace +import amf.core.internal.annotations.{LexicalInformation, SourceYPart} +import amf.core.internal.parser.domain.{Annotations, Value} import amf.core.internal.remote.Mimes +import amf.core.internal.utils.RangeOps import amf.io.FileAssertionTest +import amf.shapes.client.scala.JsonLDInstanceResult import amf.shapes.client.scala.config.{JsonLDSchemaConfiguration, JsonLDSchemaConfigurationClient} +import amf.shapes.client.scala.model.document.JsonLDInstanceDocument +import amf.shapes.client.scala.model.domain.jsonldinstance.JsonLDObject +import org.mulesoft.common.client.lexical.PositionRange import org.scalatest.Assertion import org.scalatest.funsuite.AsyncFunSuite import scala.concurrent.{ExecutionContext, Future} -class JsonLDSchemaInstanceCycleWithSourceMapsTest extends AsyncFunSuite with FileAssertionTest { - +class JsonLDSchemaInstanceCycleWithSourceMapsTest extends AsyncFunSuite with FileAssertionTest{ override implicit def executionContext: ExecutionContext = ExecutionContext.Implicits.global - private val basePath: String = "amf-shapes/shared/src/test/resources/jsonld-schema/cycle-jsonld-sourcemaps" + private val basePath: String = "amf-shapes/shared/src/test/resources" + val testPath = s"$basePath" val client: JsonLDSchemaConfigurationClient = JsonLDSchemaConfiguration.JsonLDSchema().withRenderOptions(RenderOptions().withPrettyPrint.withSourceMaps).baseUnitClient() - private def run(testFolder: String): Future[Assertion] = { - val testPath = s"$basePath/$testFolder" - for { - schema <- client.parseJsonLDSchema(s"file://$testPath/schema.json").map(_.jsonDocument) - instance <- client.parseJsonLDInstance(s"file://$testPath/instance.json", schema) - instanceLD <- Future.successful(client.render(instance.baseUnit, Mimes.`application/ld+json`)) - tmp <- writeTemporaryFile(s"/instance.jsonld")(instanceLD) - diff <- assertDifferences(tmp, s"$testPath/instance.jsonld") - } yield diff - } + +def assertAnnotationRange(actual: Any, expectedRange: PositionRange): Assertion = { + val annotation = actual.asInstanceOf[Annotations].lexical() + assertRange(annotation.range, expectedRange) +} + test("Test properties") { - run("properties") + val instanceLocation = s"file://$testPath/sourcemaps-annotations/instance.json" + val schemaLocation = s"file://$testPath/sourcemaps-annotations/schema.json" + val asserPropertyFunction: (JsonLDObject, String, PositionRange, PositionRange) => Assertion = assertPropertyAnnotation(instanceLocation) + parseJsonLSDSchemaAndInstance(schemaLocation, instanceLocation).flatMap(rootObject => { + // annotations del instance + assertAnnotations(instanceLocation, PositionRange((1, 0), (7, 1)), rootObject.annotations) + + asserPropertyFunction(rootObject, "http://a.ml/vocabularies/core#prop1", PositionRange((2, 2), (2, 20)), PositionRange((2, 11), (2, 20))) + asserPropertyFunction(rootObject, "http://a.ml/vocabularies/core#prop-array", PositionRange((3, 2), (3, 29)), PositionRange((3, 16), (3, 29))) + asserPropertyFunction(rootObject, "http://a.ml/vocabularies/core#prop-obj", PositionRange((4, 2), (6, 3)), PositionRange((4, 14), (6, 3))) + + //annotations de array + val propArrayValue = rootObject.fields.getValueAsOption("http://a.ml/vocabularies/core#prop-array").head + val array = propArrayValue.value.asInstanceOf[AmfArray] + assertRange(array.values(0).annotations.lexical().range, PositionRange((3, 17), (3, 22))) + assertRange(array.values(1).annotations.lexical().range, PositionRange((3, 23), (3, 28))) + + // Object Annotation + val propertyObject = rootObject.fields.getValueAsOption("http://a.ml/vocabularies/core#prop-obj").head + asserPropertyFunction(propertyObject.value.asInstanceOf[JsonLDObject], "http://a.ml/vocabularies/core#key", PositionRange((5, 4), (5, 12)), PositionRange((5, 11), (5, 12))) + + }) } + private def assertRange(actual: PositionRange, expected: PositionRange) = { + assert(actual.start.line == expected.start.line) + assert(actual.start.column == expected.start.column) + assert(actual.end.line == expected.end.line) + assert(actual.end.column == expected.end.column) + } + + def assertPropertyAnnotation(location: String)(obj: JsonLDObject, uri: String, propertyRange: PositionRange, valueRange: PositionRange): Assertion = { + val property = obj.fields.getValueAsOption(uri).head + assertAnnotations(location, propertyRange, property.annotations) + assertAnnotations(location, valueRange, property.value.annotations) + } + + test("Test properties clash") { + val schemaPath = s"file://$testPath/sourcemaps-clash-annotations/schema-term-with-same-iri-as-prop.json" + val instancePath = s"file://$testPath/sourcemaps-clash-annotations/instance-term-with-same-iri-as-prop.json" + parseJsonLSDSchemaAndInstance(schemaPath, instancePath).flatMap(rootObject => { + val propertyField = rootObject.fields.getValueAsOption("http://a.ml/vocabularies/core#prop2").get + assert(propertyField.isInferred) + assert(propertyField.value.annotations.isVirtual) + }) + } + + def parseJsonLSDSchemaAndInstance(schemaPath: String, instancePath: String): Future[JsonLDObject] = { + client.parseJsonLDSchema(schemaPath).map(_.jsonDocument).flatMap(schema => { + client.parseJsonLDInstance(instancePath, schema).map(result => { + result.baseUnit.asInstanceOf[JsonLDInstanceDocument].encodes.head.asInstanceOf[JsonLDObject] + + }) + }) + } + + private def assertAnnotations(location: String, propertyRange: PositionRange, annotations: Annotations) = { + val sourceLocation = annotations.sourceLocation + assertRange(sourceLocation.range, propertyRange) + assert(sourceLocation.sourceName == location) + assert(annotations.find(classOf[SourceYPart]).isDefined) + } } From 0356a98e74f3119ea779d694597067588b24daad Mon Sep 17 00:00:00 2001 From: arielmirra Date: Tue, 2 Jan 2024 17:09:22 -0300 Subject: [PATCH 08/33] W-14608042: create test that should conform --- .../not-fixed/recursion-with-query.report | 14 -------------- .../{not-fixed => }/recursion-with-query.graphql | 0 .../{not-fixed => }/recursion-with-query.jsonld | 2 +- .../corner-cases/recursion-with-query.report | 4 ++++ .../parser/GraphQLCornerCasesValidationTest.scala | 1 - 5 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.report rename amf-cli/shared/src/test/resources/graphql/corner-cases/{not-fixed => }/recursion-with-query.graphql (100%) rename amf-cli/shared/src/test/resources/graphql/corner-cases/{not-fixed => }/recursion-with-query.jsonld (98%) create mode 100644 amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.report diff --git a/amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.report b/amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.report deleted file mode 100644 index 9534de667e..0000000000 --- a/amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.report +++ /dev/null @@ -1,14 +0,0 @@ -ModelId: file://amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.graphql -Profile: GraphQL -Conforms: false -Number of results: 1 - -Level: Violation - -- Constraint: http://a.ml/vocabularies/amf/core#unresolved-reference - Message: Unresolved reference 'Query' - Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.graphql#/web-api/endpoint/%2Fquery%2Frelay/supportedOperation/query/Query.relay/returns/resp/default/payload/default/unresolved - Property: - Range: [(2,11)-(2,17)] - Location: file://amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.graphql diff --git a/amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.graphql b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.graphql similarity index 100% rename from amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.graphql rename to amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.graphql diff --git a/amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.jsonld b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.jsonld similarity index 98% rename from amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.jsonld rename to amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.jsonld index 15aed0e94b..f8721ca7f1 100644 --- a/amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.jsonld @@ -144,7 +144,7 @@ } ], "@context": { - "@base": "file://amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.graphql", + "@base": "file://amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.graphql", "shacl": "http://www.w3.org/ns/shacl#", "raml-shapes": "http://a.ml/vocabularies/shapes#", "doc": "http://a.ml/vocabularies/document#", diff --git a/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.report b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.report new file mode 100644 index 0000000000..4458506a43 --- /dev/null +++ b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.report @@ -0,0 +1,4 @@ +ModelId: file://amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.graphql +Profile: GraphQL +Conforms: true +Number of results: 0 \ No newline at end of file diff --git a/amf-cli/shared/src/test/scala/amf/parser/GraphQLCornerCasesValidationTest.scala b/amf-cli/shared/src/test/scala/amf/parser/GraphQLCornerCasesValidationTest.scala index 63eaf96521..ab64ce9571 100644 --- a/amf-cli/shared/src/test/scala/amf/parser/GraphQLCornerCasesValidationTest.scala +++ b/amf-cli/shared/src/test/scala/amf/parser/GraphQLCornerCasesValidationTest.scala @@ -8,7 +8,6 @@ import scala.concurrent.Future class GraphQLCornerCasesValidationTest extends GraphQLValidationTest { - // todo: fix Query recursion inside not-fixed folder override def basePath: String = "amf-cli/shared/src/test/resources/graphql/corner-cases" fs.syncFile(basePath) From 4749c3ae148b9426c6cfb7c08094588167b24618 Mon Sep 17 00:00:00 2001 From: arielmirra Date: Fri, 5 Jan 2024 12:37:53 -0300 Subject: [PATCH 09/33] W-14608042: parse root types as types --- .../shacl/APICustomShaclFunctions.scala | 11 +- .../GraphQLDirectiveLocationValidator.scala | 10 +- .../shacl/graphql/GraphQLUtils.scala | 8 +- .../shacl/graphql/GraphQLValidator.scala | 60 +- .../graphql/values/EnumValueValidator.scala | 22 +- .../graphql/values/ListValueValidator.scala | 15 +- .../values/NullableValueValidator.scala | 15 +- .../graphql/values/ObjectValueValidator.scala | 23 +- .../graphql/values/ScalarValueValidator.scala | 17 +- .../tck/apis/valid/graphql-directives.jsonld | 221 ++ .../tck/apis/valid/link.jsonld | 53 + .../apis/valid/root-field-directives.jsonld | 578 ++++ .../apis/valid/root-innacessible-arg.jsonld | 271 ++ .../corner-cases/recursion-with-query.jsonld | 75 +- .../corner-cases/recursion-with-query.report | 2 +- .../corner-cases/recursion-with-unions.jsonld | 53 + .../syntax-recovery/extraneous-!-token.jsonld | 15 + .../syntax-recovery/extraneous-!-token.report | 10 +- .../extraneous-\"-token.jsonld" | 19 + .../extraneous-\"-token.report" | 10 +- .../syntax-recovery/extraneous-&-token.jsonld | 15 + .../syntax-recovery/extraneous-&-token.report | 10 +- .../syntax-recovery/extraneous-*-token.jsonld | 53 + .../syntax-recovery/extraneous---token.jsonld | 15 + .../syntax-recovery/extraneous---token.report | 10 +- .../syntax-recovery/extraneous-:-token.jsonld | 15 + .../syntax-recovery/extraneous-:-token.report | 10 +- .../syntax-recovery/extraneous-;-token.jsonld | 53 + .../syntax-recovery/extraneous-@-token.jsonld | 15 + .../syntax-recovery/extraneous-@-token.report | 10 +- .../syntax-recovery/extraneous-tokens.jsonld | 15 + .../syntax-recovery/extraneous-tokens.report | 10 +- .../syntax-recovery/extraneous-|-token.jsonld | 15 + .../syntax-recovery/extraneous-|-token.report | 10 +- .../syntax-recovery/missing-colon.jsonld | 15 + .../syntax-recovery/missing-colon.report | 14 +- .../missing-field-type-0.jsonld | 47 + .../missing-field-type-1.jsonld | 47 + .../missing-field-type-2.jsonld | 83 + .../missing-field-type-3.jsonld | 53 + .../missing-field-type-4.jsonld | 53 + .../missing-field-type-5.jsonld | 53 + .../missing-field-type-6.jsonld | 161 + .../missing-field-type-7.jsonld | 107 + .../missing-field-type-8.jsonld | 53 + .../missing-lbracket-and-lparen.jsonld | 15 + .../missing-lbracket-and-lparen.report | 10 +- .../syntax-recovery/missing-lbracket.jsonld | 15 + .../syntax-recovery/missing-lbracket.report | 10 +- .../missing-rbracket-and-rparen.jsonld | 19 + .../missing-rbracket-and-rparen.report | 10 +- .../syntax-recovery/missing-rbracket.jsonld | 19 + .../syntax-recovery/missing-rbracket.report | 10 +- .../syntax-recovery/missing-rparen.jsonld | 15 + .../syntax-recovery/missing-rparen.report | 10 +- .../syntax-recovery/missing-slbracket.jsonld | 15 + .../syntax-recovery/missing-slbracket.report | 10 +- .../syntax-recovery/missing-srbracket.jsonld | 86 + .../missing-union-member-remixed.jsonld | 63 +- .../missing-union-member.jsonld | 83 +- .../syntax-recovery/misspelling-type.jsonld | 53 + .../syntax-recovery/replace-{-with-[.jsonld | 15 + .../syntax-recovery/replace-{-with-[.report | 10 +- .../syntax-recovery/scalar-inside-type.jsonld | 15 + .../syntax-recovery/scalar-inside-type.report | 14 +- .../syntax-recovery/type-inside-type.jsonld | 15 + .../syntax-recovery/type-inside-type.report | 14 +- .../valid/argument-enum-values.api.jsonld | 53 + .../argument-enum-values.api.resolved.jsonld | 53 + .../argument-input-object-values.api.jsonld | 53 + ...nt-input-object-values.api.resolved.jsonld | 53 + .../valid/argument-scalar-values.api.jsonld | 53 + ...argument-scalar-values.api.resolved.jsonld | 53 + .../tck/apis/valid/covariance.api.jsonld | 53 + .../apis/valid/covariance.api.resolved.jsonld | 53 + .../tck/apis/valid/custom-scalar.api.jsonld | 58 + .../valid/custom-scalar.api.resolved.jsonld | 58 + .../tck/apis/valid/deprecated.api.jsonld | 58 + .../apis/valid/deprecated.api.resolved.jsonld | 170 + .../apis/valid/descriptions-enum.api.jsonld | 53 + .../descriptions-enum.api.resolved.jsonld | 53 + .../tck/apis/valid/descriptions.api.jsonld | 160 + .../valid/descriptions.api.resolved.jsonld | 160 + .../valid/directive-applications.api.jsonld | 96 + ...directive-applications.api.resolved.jsonld | 96 + .../apis/valid/directive-arguments.api.jsonld | 53 + .../directive-arguments.api.resolved.jsonld | 53 + .../apis/valid/directive-locations.api.jsonld | 53 + .../directive-locations.api.resolved.jsonld | 53 + .../valid/directive-multitarget.api.jsonld | 71 + .../directive-multitarget.api.resolved.jsonld | 71 + .../apis/valid/directive-simple.api.jsonld | 53 + .../directive-simple.api.resolved.jsonld | 53 + .../tck/apis/valid/extension-enum.api.jsonld | 53 + .../valid/extension-enum.api.resolved.jsonld | 53 + .../valid/extension-input-type.api.jsonld | 53 + .../extension-input-type.api.resolved.jsonld | 53 + .../apis/valid/extension-interface.api.jsonld | 53 + .../extension-interface.api.resolved.jsonld | 53 + .../apis/valid/extension-objects.api.jsonld | 53 + .../extension-objects.api.resolved.jsonld | 53 + .../apis/valid/extension-scalars.api.jsonld | 53 + .../extension-scalars.api.resolved.jsonld | 53 + .../tck/apis/valid/extension-union.api.jsonld | 53 + .../valid/extension-union.api.resolved.jsonld | 53 + .../valid/interface-chain-covariant.jsonld | 53 + .../interface-chain-covariant.resolved.jsonld | 53 + .../apis/valid/interface-double.api.jsonld | 53 + .../interface-double.api.resolved.jsonld | 53 + .../apis/valid/interface-simple.api.jsonld | 53 + .../interface-simple.api.resolved.jsonld | 53 + .../interface-with-interface.dumped.graphql | 8 +- .../valid/interface-with-interface.jsonld | 169 +- .../interface-with-interface.resolved.jsonld | 169 +- .../is-input-type-directive-arguments.jsonld | 53 + ...t-type-directive-arguments.resolved.jsonld | 53 + .../apis/valid/is-input-type-fields.jsonld | 53 + ...ut-type-interface-arguments.dumped.graphql | 8 +- .../is-input-type-interface-arguments.jsonld | 169 +- ...t-type-interface-arguments.resolved.jsonld | 169 +- ...input-type-object-arguments.dumped.graphql | 18 +- .../is-input-type-object-arguments.jsonld | 361 ++- ...nput-type-object-arguments.resolved.jsonld | 361 ++- ...is-output-type-interface-fields.api.jsonld | 53 + ...-type-interface-fields.api.resolved.jsonld | 53 + .../is-output-type-object-fields.api.jsonld | 53 + ...put-type-object-fields.api.resolved.jsonld | 53 + .../apis/valid/nested-interfaces.api.jsonld | 53 + .../nested-interfaces.api.resolved.jsonld | 53 + .../tck/apis/valid/no-schema.api.jsonld | 205 ++ .../apis/valid/no-schema.api.resolved.jsonld | 205 ++ .../tck/apis/valid/recursion.api.jsonld | 53 + .../valid/root-types-in-schema-extends.jsonld | 161 + ...ot-types-in-schema-extends.resolved.jsonld | 161 + .../apis/valid/root-types-in-schema.jsonld | 161 + .../root-types-in-schema.resolved.jsonld | 161 + .../graphql/tck/apis/valid/root-types.jsonld | 161 + .../tck/apis/valid/root-types.resolved.jsonld | 161 + .../tck/apis/valid/types-arguments.api.jsonld | 53 + .../valid/types-arguments.api.resolved.jsonld | 53 + .../tck/apis/valid/types-enum.api.jsonld | 58 + .../apis/valid/types-enum.api.resolved.jsonld | 164 + .../apis/valid/types-input-type.api.jsonld | 213 ++ .../types-input-type.api.resolved.jsonld | 284 ++ .../tck/apis/valid/types-list.api.jsonld | 88 + .../apis/valid/types-list.api.resolved.jsonld | 88 + .../tck/apis/valid/types-matrix.api.jsonld | 53 + .../valid/types-matrix.api.resolved.jsonld | 53 + .../tck/apis/valid/types-non-null.api.jsonld | 172 + .../valid/types-non-null.api.resolved.jsonld | 172 + .../tck/apis/valid/types-object.api.jsonld | 58 + .../valid/types-object.api.resolved.jsonld | 91 + .../tck/apis/valid/types-scalars.api.jsonld | 204 ++ .../valid/types-scalars.api.resolved.jsonld | 204 ++ .../tck/apis/valid/types-union.api.jsonld | 58 + .../valid/types-union.api.resolved.jsonld | 233 ++ .../parser/annotations/graphql.graphql | 6 +- .../default-arguments.jsonld | 480 +++ .../invalid-default-arguments.jsonld | 480 +++ .../cycle/graphql/descriptions/block.jsonld | 470 +++ .../cycle/graphql/descriptions/simple.jsonld | 470 +++ .../cycle/graphql/directives/arguments.jsonld | 139 + .../cycle/graphql/directives/default.jsonld | 96 + .../cycle/graphql/directives/multiple.jsonld | 87 + .../cycle/graphql/directives/simple.jsonld | 71 + .../graphql/fragment-reserved-name/api.jsonld | 94 + .../graphql/keyword-enum-values/api.jsonld | 58 + .../cycle/graphql/keyword-names/api.jsonld | 58 + .../non-root-optional-array/api.jsonld | 327 ++ .../simple.resolved.jsonld | 152 + .../graphql/root-type/non-root-type.jsonld | 53 + .../cycle/graphql/root-type/root-type.jsonld | 96 + .../upanddown/cycle/graphql/simple/api.jsonld | 548 ++++ .../cycle/graphql/simple/dumped.graphql | 13 + .../upanddown/cycle/graphql/swapi/api.jsonld | 2876 +++++++++++++++++ .../raml10/inline-prop-inheritance.raml.raml | 2 +- .../reports/graphql/sudden-eof.report | 18 +- .../document/GraphQLBaseDocumentParser.scala | 16 +- .../spec/domain/GraphQLCommonTypeParser.scala | 4 +- .../domain/GraphQLOperationFieldParser.scala | 19 +- .../document/GraphQLDocumentEmitter.scala | 12 +- 181 files changed, 17351 insertions(+), 687 deletions(-) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/APICustomShaclFunctions.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/APICustomShaclFunctions.scala index bc231b75a9..012c058e7d 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/APICustomShaclFunctions.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/APICustomShaclFunctions.scala @@ -764,10 +764,15 @@ object APICustomShaclFunctions extends BaseCustomShaclFunctions { // Obtained from the BNF in: https://tools.ietf.org/html/rfc7230#section-3.2 private def isInvalidHttpHeaderName(name: String): Boolean = - !name.matches("^[!#$%&'*\\+\\-\\.^\\_\\`\\|\\~0-9a-zA-Z]+$") + !name.matches("^[!#$%&'*+\\-.^_`|~0-9a-zA-Z]+$") - private def hasIntrospectionName(element: NamedDomainElement): Boolean = - element.name.nonNull && element.name.value().startsWith("__") + private def hasIntrospectionName(element: NamedDomainElement): Boolean = { + element.name.value() match { + case null => false + case name: String => + name.startsWith("__") && !GraphQLUtils.isInsideRootType(element) + } + } def checkDuplicates( s: Seq[NamedDomainElement], diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLDirectiveLocationValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLDirectiveLocationValidator.scala index d3ddb097e3..883b71377c 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLDirectiveLocationValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLDirectiveLocationValidator.scala @@ -30,13 +30,19 @@ object GraphQLDirectiveLocationValidator { } yield { val expected = declaration.domain.map(_.value()) val isValidApplication = expected.contains(actual.iri.iri()) - (actual, isValidApplication) + (actual, isValidApplication || GraphQLUtils.isInsideRootType(element)) } result match { case Some((actual, false)) => val message = buildErrorMessage(directiveApplication, element, actual.name) - Some(ValidationInfo(DomainElementModel.CustomDomainProperties, Some(message), Some(directiveApplication.annotations))) + Some( + ValidationInfo( + DomainElementModel.CustomDomainProperties, + Some(message), + Some(directiveApplication.annotations) + ) + ) case _ => None } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLUtils.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLUtils.scala index b6166ae8b0..281ed37a4f 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLUtils.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLUtils.scala @@ -1,6 +1,6 @@ package amf.apicontract.internal.validation.shacl.graphql -import amf.core.client.scala.model.domain.Shape +import amf.core.client.scala.model.domain.{AmfObject, Shape} import amf.shapes.client.scala.model.domain._ import scala.annotation.tailrec @@ -34,4 +34,10 @@ object GraphQLUtils { case _ => true } } + + val rootTypes = Seq("Query", "Mutation", "Subscription") + + def isInsideRootType(obj: AmfObject): Boolean = { + obj.id.contains("declares/shape/") && rootTypes.map(root => obj.id.contains(root)).exists(b => b) + } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLValidator.scala index 08e55bbcff..3916b2e097 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLValidator.scala @@ -16,7 +16,7 @@ import scala.annotation.tailrec object GraphQLValidator { - def checkValidPath(path: Seq[PropertyShape], key: Key): Seq[ValidationInfo] = { + private def checkValidPath(path: Seq[PropertyShape], key: Key): Seq[ValidationInfo] = { path.flatMap { propertyShape => propertyShape.range match { case n: NodeShape => @@ -69,7 +69,7 @@ object GraphQLValidator { } } - case class RequiredField(interface: String, field: GraphQLField) + private case class RequiredField(interface: String, field: GraphQLField) def validateRequiredFields(obj: GraphQLObject): Seq[ValidationInfo] = { @@ -207,7 +207,7 @@ object GraphQLValidator { if (!obj.isInput) { // fields from an output type can return anything except an input type (`input Foo {...}) val propertiesValidations = fields.properties.flatMap { prop => - if (!prop.isValidOutputType) { + if (!prop.isValidOutputType && !GraphQLUtils.isInsideRootType(obj.node)) { validationInfo( NodeShapeModel.Properties, s"Type '${getShapeName(prop.range)}' from field '${prop.name}' must be an output type", @@ -216,15 +216,8 @@ object GraphQLValidator { } else None } - val operationValidations = obj.operations.flatMap { op => - if (!op.isValidOutputType) { - validationInfo( - NodeShapeModel.Properties, - s"Type '${getShapeName(op.payload.get.schema)}' from field '${op.name}' must be an output type", - op.annotations - ) - } else None - } + val operations = obj.operations + val operationValidations = validateOperations(operations) operationValidations ++ propertiesValidations } else { @@ -234,8 +227,13 @@ object GraphQLValidator { } def validateOutputTypes(endpoint: GraphQLEndpoint): Seq[ValidationInfo] = { - endpoint.operations.flatMap { op => - if (!op.isValidOutputType) { + val operations = endpoint.operations + validateOperations(operations) + } + + private def validateOperations(operations: Seq[GraphQLOperation]): Seq[ValidationInfo] = { + operations.flatMap { op => + if (!op.isValidOutputType && !GraphQLUtils.isInsideRootType(op.operation)) { validationInfo( NodeShapeModel.Properties, s"Type '${getShapeName(op.payload.get.schema)}' from field '${op.name}' must be an output type", @@ -247,21 +245,19 @@ object GraphQLValidator { def validateInputTypes(obj: GraphQLObject): Seq[ValidationInfo] = { // fields arguments cannot be output types - val operationValidations = obj.operations.flatMap { op => - op.parameters.flatMap { param => - if (!param.isValidInputType) { - validationInfo( - NodeShapeModel.Properties, - s"Type '${getShapeName(param.schema)}' from argument '${param.name}' must be an input type", - param.annotations - ) - } else None - } - } + val parameters: Seq[GraphQLParameter] = obj.operations.flatMap(_.parameters) + val operationValidations = validateParameters(parameters) // input type fields or directive arguments cannot be output types - val propertiesValidations = obj.properties.flatMap { prop => - if (!prop.isValidInputType && obj.isInput) { + val properties: Seq[GraphQLProperty] = obj.properties + val propertiesValidations = validateProperties(properties, obj) + + operationValidations ++ propertiesValidations + } + + private def validateProperties(properties: Seq[GraphQLProperty], obj: GraphQLObject): Seq[ValidationInfo] = { + properties.flatMap { prop => + if (!prop.isValidInputType && obj.isInput && !GraphQLUtils.isInsideRootType(obj.node)) { val message = s"Type '${getShapeName(prop.range)}' from field '${prop.name}' must be an input type" validationInfo( NodeShapeModel.Properties, @@ -270,13 +266,15 @@ object GraphQLValidator { ) } else None } - - operationValidations ++ propertiesValidations } def validateInputTypes(endpoint: GraphQLEndpoint): Seq[ValidationInfo] = { - endpoint.parameters.flatMap { param => - if (!param.isValidInputType) { + validateParameters(endpoint.parameters) + } + + private def validateParameters(parameters: Seq[GraphQLParameter]): Seq[ValidationInfo] = { + parameters.flatMap { param => + if (!param.isValidInputType && !GraphQLUtils.isInsideRootType(param.parameter)) { validationInfo( NodeShapeModel.Properties, s"Type '${getShapeName(param.schema)}' from argument '${param.name}' must be an input type", diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/EnumValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/EnumValueValidator.scala index e387f6a325..13f4721d45 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/EnumValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/EnumValueValidator.scala @@ -1,6 +1,7 @@ package amf.apicontract.internal.validation.shacl.graphql.values import amf.apicontract.internal.validation.shacl.graphql.GraphQLDataTypes.friendlyName +import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils import amf.core.client.platform.model.DataTypes import amf.core.client.scala.model.domain.{ArrayNode, DataNode, ObjectNode, ScalarNode} import amf.core.internal.metamodel.Field @@ -9,13 +10,16 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object EnumValueValidator extends ValueValidator[ScalarShape] { override def validate(shape: ScalarShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - value match { - case s: ScalarNode => - validateDataType(s) ++ validateValueIsMember(shape, s) - case a: ArrayNode => Seq(typeError("scalar", "list", a.annotations)) - case o: ObjectNode => Seq(typeError("scalar", "object", o.annotations)) - } + if (!GraphQLUtils.isInsideRootType(shape)) { + value match { + case s: ScalarNode => + validateDataType(s) ++ validateValueIsMember(shape, s) + case a: ArrayNode => Seq(typeError("scalar", "list", a.annotations)) + case o: ObjectNode => Seq(typeError("scalar", "object", o.annotations)) + } + } else Nil } + private def validateDataType(value: ScalarNode)(implicit targetField: Field): Seq[ValidationInfo] = { value.dataType.value() match { case DataTypes.Any => Nil // enum values are 'Any' explicitly @@ -23,7 +27,9 @@ object EnumValueValidator extends ValueValidator[ScalarShape] { } } - private def validateValueIsMember(shape: ScalarShape, value: ScalarNode)(implicit targetField: Field): Seq[ValidationInfo] = { + private def validateValueIsMember(shape: ScalarShape, value: ScalarNode)(implicit + targetField: Field + ): Seq[ValidationInfo] = { val acceptedValues = shape.values val actualValue = value.value.value() @@ -32,7 +38,7 @@ object EnumValueValidator extends ValueValidator[ScalarShape] { case _ => false } - if (isAccepted) { + if (isAccepted || GraphQLUtils.isInsideRootType(value)) { Nil } else { val enumName = shape.name.value() diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ListValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ListValueValidator.scala index 76524fde98..3c6f39b07c 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ListValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ListValueValidator.scala @@ -1,5 +1,6 @@ package amf.apicontract.internal.validation.shacl.graphql.values +import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils import amf.core.client.scala.model.domain.{ArrayNode, DataNode, ObjectNode, ScalarNode} import amf.core.internal.metamodel.Field import amf.shapes.client.scala.model.domain.ArrayShape @@ -7,12 +8,14 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object ListValueValidator extends ValueValidator[ArrayShape] { override def validate(shape: ArrayShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - value match { - case a: ArrayNode => validateItems(shape, a) - case s: ScalarNode if isNull(s) => Seq(typeError("list", "null", s.annotations)) - case s: ScalarNode => Seq(typeError("list", "scalar", s.annotations)) - case o: ObjectNode => Seq(typeError("list", "object", o.annotations)) - } + if (!GraphQLUtils.isInsideRootType(shape)) { + value match { + case a: ArrayNode => validateItems(shape, a) + case s: ScalarNode if isNull(s) => Seq(typeError("list", "null", s.annotations)) + case s: ScalarNode => Seq(typeError("list", "scalar", s.annotations)) + case o: ObjectNode => Seq(typeError("list", "object", o.annotations)) + } + } else Nil } private def validateItems(shape: ArrayShape, values: ArrayNode)(implicit targetField: Field): Seq[ValidationInfo] = { diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/NullableValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/NullableValueValidator.scala index 35bcb821f0..bb138ad1de 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/NullableValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/NullableValueValidator.scala @@ -1,5 +1,6 @@ package amf.apicontract.internal.validation.shacl.graphql.values +import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils import amf.core.client.scala.model.domain.{DataNode, ScalarNode} import amf.core.internal.metamodel.Field import amf.shapes.client.scala.model.domain.{NilShape, UnionShape} @@ -7,13 +8,17 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object NullableValueValidator extends ValueValidator[UnionShape] { override def validate(shape: UnionShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - value match { - case s: ScalarNode if isNull(s) => Nil - case value => validateNonNullValue(shape, value) - } + if (!GraphQLUtils.isInsideRootType(shape)) { + value match { + case s: ScalarNode if isNull(s) => Nil + case value => validateNonNullValue(shape, value) + } + } else Nil } - private def validateNonNullValue(shape: UnionShape, other: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { + private def validateNonNullValue(shape: UnionShape, other: DataNode)(implicit + targetField: Field + ): Seq[ValidationInfo] = { val concreteShape = shape.anyOf.filter(!_.isInstanceOf[NilShape]).head ValueValidator.validate(concreteShape, other) } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ObjectValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ObjectValueValidator.scala index e281fbb4d7..319e08db48 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ObjectValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ObjectValueValidator.scala @@ -1,6 +1,6 @@ package amf.apicontract.internal.validation.shacl.graphql.values -import amf.apicontract.internal.validation.shacl.graphql.GraphQLProperty +import amf.apicontract.internal.validation.shacl.graphql.{GraphQLProperty, GraphQLUtils} import amf.core.client.scala.model.domain.extensions.PropertyShape import amf.core.client.scala.model.domain.{ArrayNode, DataNode, ObjectNode, ScalarNode} import amf.core.internal.metamodel.Field @@ -10,17 +10,21 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object ObjectValueValidator extends ValueValidator[NodeShape] { override def validate(shape: NodeShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - value match { - case s: ScalarNode if isNull(s) => Seq(typeError("object", "null", s.annotations)) - case s: ScalarNode => Seq(typeError("object", "scalar", s.annotations)) - case a: ArrayNode => Seq(typeError("object", "list", a.annotations)) - case o: ObjectNode => validateProperties(shape, o) - } + if (!GraphQLUtils.isInsideRootType(shape)) { + value match { + case s: ScalarNode if isNull(s) => Seq(typeError("object", "null", s.annotations)) + case s: ScalarNode => Seq(typeError("object", "scalar", s.annotations)) + case a: ArrayNode => Seq(typeError("object", "list", a.annotations)) + case o: ObjectNode => validateProperties(shape, o) + } + } else Nil } sealed case class ReportingInfo(shapeName: String, annotations: Annotations) - private def validateProperties(shape: NodeShape, value: ObjectNode)(implicit targetField: Field): Seq[ValidationInfo] = { + private def validateProperties(shape: NodeShape, value: ObjectNode)(implicit + targetField: Field + ): Seq[ValidationInfo] = { val actual: Map[String, DataNode] = value.allPropertiesWithName() val expected = shape.properties implicit val info: ReportingInfo = ReportingInfo(shape.name.value(), value.annotations) @@ -29,7 +33,8 @@ object ObjectValueValidator extends ValueValidator[NodeShape] { } private def validateExpectedProperties(expected: Seq[PropertyShape], actual: Map[String, DataNode])(implicit - info: ReportingInfo, targetField: Field + info: ReportingInfo, + targetField: Field ): Seq[ValidationInfo] = { expected.flatMap { expectedProperty => validateExpectedProperty(expectedProperty, actual) } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ScalarValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ScalarValueValidator.scala index cc4d3c1c85..ea3d86b2c8 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ScalarValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ScalarValueValidator.scala @@ -1,6 +1,7 @@ package amf.apicontract.internal.validation.shacl.graphql.values import amf.apicontract.internal.validation.shacl.graphql.GraphQLDataTypes.friendlyName +import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils import amf.core.client.platform.model.DataTypes import amf.core.client.scala.model.domain.{ArrayNode, DataNode, ObjectNode, ScalarNode} import amf.core.internal.metamodel.Field @@ -9,14 +10,18 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object ScalarValueValidator extends ValueValidator[ScalarShape] { override def validate(shape: ScalarShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - value match { - case s: ScalarNode => validateDataType(shape, s) - case a: ArrayNode => Seq(typeError("scalar", "list", a.annotations)) - case o: ObjectNode => Seq(typeError("scalar", "object", o.annotations)) - } + if (!GraphQLUtils.isInsideRootType(shape)) { + value match { + case s: ScalarNode => validateDataType(shape, s) + case a: ArrayNode => Seq(typeError("scalar", "list", a.annotations)) + case o: ObjectNode => Seq(typeError("scalar", "object", o.annotations)) + } + } else Nil } - private def validateDataType(shape: ScalarShape, value: ScalarNode)(implicit targetField: Field): Seq[ValidationInfo] = { + private def validateDataType(shape: ScalarShape, value: ScalarNode)(implicit + targetField: Field + ): Seq[ValidationInfo] = { val shapeDT = shape.dataType.value() val valueDT = value.dataType.value() shapeDT match { diff --git a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.jsonld b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.jsonld index d012b92b9b..443d282119 100644 --- a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.jsonld +++ b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.jsonld @@ -642,6 +642,227 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/property/property/property", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/property/property/property/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "property" + } + ], + "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/Directive": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "Directive" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/property/property/property/customDomainProperties/Directive/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/Directive" + } + ] + } + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/supportedOperation/operation", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "operation" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/supportedOperation/operation/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "arg" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/Directive": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "Directive" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/customDomainProperties/Directive/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/Directive" + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/supportedOperation/operation/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/Directive": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "Directive" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/shape/Query/supportedOperation/operation/customDomainProperties/Directive/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/Directive" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/graphql-directives.graphql#/declares/scalar/Scalar", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/link.jsonld b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/link.jsonld index 84c39efb18..ed75cc1dc6 100644 --- a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/link.jsonld +++ b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/link.jsonld @@ -189,6 +189,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/link.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/link.graphql#/declares/shape/Query/property/property/text", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/link.graphql#/declares/shape/Query/property/property/text/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "text" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/link.graphql#/declares/MyDirective", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.jsonld b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.jsonld index d018fa0772..3507c96cad 100644 --- a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.jsonld +++ b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.jsonld @@ -916,6 +916,584 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors2", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors2/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors2/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors2/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors2/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "authors2" + } + ], + "http://a.ml/vocabularies/federation#federationMetadata": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors2/federation-metadata", + "@type": [ + "http://a.ml/vocabularies/federation#ShapeFederationMetadata", + "http://a.ml/vocabularies/federation#FederationMetadata", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/federation#overrideFrom": [ + { + "@value": "authors" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors3", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors3/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors3/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors3/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors3/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://a.ml/vocabularies/federation#requires": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors3/requires/property-shape-path", + "@type": [ + "http://a.ml/vocabularies/shapes#PropertyShapePath", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#path": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors3/requires/property-shape-path/list", + "@type": "http://www.w3.org/2000/01/rdf-schema#Seq", + "http://www.w3.org/2000/01/rdf-schema#_1": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors3/requires/property-shape-path/path/property/default-property", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors2" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "authors2" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "authors3" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors4", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors4/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors4/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors4/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors4/array/default-array/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Person" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Person" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://a.ml/vocabularies/federation#provides": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors4/provides/property-shape-path", + "@type": [ + "http://a.ml/vocabularies/shapes#PropertyShapePath", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#path": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors4/provides/property-shape-path/list", + "@type": "http://www.w3.org/2000/01/rdf-schema#Seq", + "http://www.w3.org/2000/01/rdf-schema#_1": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors4/provides/property-shape-path/path/property/error", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "error" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "authors4" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors5", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors5/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors5/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors5/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors5/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "authors5" + } + ], + "http://a.ml/vocabularies/federation#federationMetadata": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/property/property/authors5/federation-metadata", + "@type": [ + "http://a.ml/vocabularies/federation#ShapeFederationMetadata", + "http://a.ml/vocabularies/federation#FederationMetadata", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/federation#inaccessible": [ + { + "@value": true + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "books" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/expects/request/parameter/parameter/count", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "count" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/expects/request/parameter/parameter/count/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/federation#federationMetadata": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Query/supportedOperation/books/federation-metadata", + "@type": [ + "http://a.ml/vocabularies/federation#ShapeFederationMetadata", + "http://a.ml/vocabularies/federation#FederationMetadata", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/federation#shareable": [ + { + "@value": true + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-field-directives.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.jsonld b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.jsonld index d9cd9426c5..081f013adb 100644 --- a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.jsonld +++ b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.jsonld @@ -414,6 +414,277 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/property/property/authors", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/property/property/authors/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/property/property/authors/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/property/property/authors/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/property/property/authors/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "authors" + } + ] + } + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "books" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/expects/request/parameter/parameter/count", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "count" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/expects/request/parameter/parameter/count/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ], + "http://a.ml/vocabularies/federation#federationMetadata": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/expects/request/parameter/parameter/count/federation-metadata", + "@type": [ + "http://a.ml/vocabularies/federation#ShapeFederationMetadata", + "http://a.ml/vocabularies/federation#FederationMetadata", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/federation#inaccessible": [ + { + "@value": true + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/valid/root-innacessible-arg.graphql#/declares/shape/Query/supportedOperation/books/returns/response/default/union/default-union/anyOf/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.jsonld b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.jsonld index f8721ca7f1..d3a119af35 100644 --- a/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.jsonld @@ -96,12 +96,23 @@ ], "raml-shapes:schema": [ { - "@id": "#/web-api/endpoint/%2Fquery%2Frelay/supportedOperation/query/Query.relay/returns/resp/default/payload/default/unresolved", + "@id": "#/web-api/endpoint/%2Fquery%2Frelay/supportedOperation/query/Query.relay/returns/resp/default/payload/default/shape/default-node", "@type": [ + "shacl:NodeShape", "raml-shapes:AnyShape", "shacl:Shape", "raml-shapes:Shape", "doc:DomainElement" + ], + "doc:link-target": [ + { + "@id": "#/declares/shape/Query" + } + ], + "doc:link-label": [ + { + "@value": "Query" + } ] } ] @@ -143,8 +154,68 @@ ] } ], + "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/relay", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/relay/shape/default-node", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "doc:link-target": [ + { + "@id": "#/declares/shape/Query" + } + ], + "doc:link-label": [ + { + "@value": "Query" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "shacl:name": [ + { + "@value": "relay" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + } + ], "@context": { - "@base": "file://amf-cli/shared/src/test/resources/graphql/corner-cases/not-fixed/recursion-with-query.graphql", + "@base": "file://amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.graphql", "shacl": "http://www.w3.org/ns/shacl#", "raml-shapes": "http://a.ml/vocabularies/shapes#", "doc": "http://a.ml/vocabularies/document#", diff --git a/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.report b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.report index 4458506a43..88fd432468 100644 --- a/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.report +++ b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.report @@ -1,4 +1,4 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-query.graphql Profile: GraphQL Conforms: true -Number of results: 0 \ No newline at end of file +Number of results: 0 diff --git a/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-unions.jsonld b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-unions.jsonld index 26513ad6f9..a733d88c41 100644 --- a/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-unions.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/corner-cases/recursion-with-unions.jsonld @@ -325,6 +325,59 @@ } ] }, + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/relay", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/relay/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "relay" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/union/IssueTimelineItems", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.jsonld index 040111d763..e2e14076c1 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.report index 26cee53afa..673b27b382 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-!-token.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: '!' Severity: Violation diff --git "a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-\"-token.jsonld" "b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-\"-token.jsonld" index 99a9c55b18..2a2cbfe214 100644 --- "a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-\"-token.jsonld" +++ "b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-\"-token.jsonld" @@ -47,8 +47,27 @@ ] } ], + "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + } + ], "@context": { "@base": "file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-%22-token.graphql", + "raml-shapes": "http://a.ml/vocabularies/shapes#", + "shacl": "http://www.w3.org/ns/shacl#", "doc": "http://a.ml/vocabularies/document#", "apiContract": "http://a.ml/vocabularies/apiContract#", "core": "http://a.ml/vocabularies/core#" diff --git "a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-\"-token.report" "b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-\"-token.report" index 9654262973..c301956646 100644 --- "a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-\"-token.report" +++ "b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-\"-token.report" @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-"-token.graphql Profile: GraphQL Conforms: false -Number of results: 2 +Number of results: 3 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: Location: +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-%22-token.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error: Unexpected end of file Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.jsonld index b029128d6e..0b9217aea0 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.report index 9b77eb9bd1..02ca0ded09 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-&-token.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: '&' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-*-token.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-*-token.jsonld index 7d9764f449..997d31f22f 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-*-token.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-*-token.jsonld @@ -171,6 +171,59 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.jsonld index 5c9d64f0b2..36715162a1 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.report index 95968b35a1..0b42d1fcfe 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation @@ -12,3 +12,11 @@ Level: Violation Property: Range: Location: + +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous---token.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.jsonld index 936b728530..7908d3e7fb 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.report index 488b6063a8..16b2d536e4 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-:-token.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: ':' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-;-token.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-;-token.jsonld index 2d46c0dfc2..2dd0ef0c98 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-;-token.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-;-token.jsonld @@ -171,6 +171,59 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.jsonld index 4cfc571cea..bb6650a310 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.report index e19b6c9101..c2de8514d2 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-@-token.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: ':' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.jsonld index 27dc184cef..bb40cafaa5 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.report index 8406bab4a1..b8c242647f 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.graphql Profile: GraphQL Conforms: false -Number of results: 4 +Number of results: 5 Level: Violation @@ -29,6 +29,14 @@ Level: Violation Range: Location: +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-tokens.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: '!' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-|-token.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-|-token.jsonld index 0ffe990c10..92ac111ab7 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-|-token.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-|-token.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-|-token.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-|-token.report index fb060dc4ef..c1bb2c72c9 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-|-token.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-|-token.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-|-token.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/extraneous-%7C-token.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: '|' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.jsonld index b84b86eb6d..7e295d5151 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.report index 616b225673..c988b68ee5 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.report @@ -1,4 +1,14 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.graphql Profile: GraphQL -Conforms: true -Number of results: 0 +Conforms: false +Number of results: 1 + +Level: Violation + +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-colon.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-0.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-0.jsonld index 9f73ff660d..77ad1c2518 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-0.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-0.jsonld @@ -144,6 +144,53 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/any/default-any", + "@type": [ + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ] + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-1.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-1.jsonld index 985a74ff02..e2d3afd552 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-1.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-1.jsonld @@ -144,6 +144,53 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/any/default-any", + "@type": [ + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ] + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-2.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-2.jsonld index dfc9a8004d..83e8094169 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-2.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-2.jsonld @@ -266,6 +266,89 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/any/default-any", + "@type": [ + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ] + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + }, + { + "@id": "#/declares/shape/Query/property/property/another", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/another/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "another" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-3.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-3.jsonld index 412ea54712..9ad34d7d66 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-3.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-3.jsonld @@ -171,6 +171,59 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-4.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-4.jsonld index 1eeba3dcc9..7052df66b5 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-4.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-4.jsonld @@ -171,6 +171,59 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-5.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-5.jsonld index 14f5174e2f..dac53744e1 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-5.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-5.jsonld @@ -171,6 +171,59 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-6.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-6.jsonld index 8429bedf1e..b6fb9de7b6 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-6.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-6.jsonld @@ -308,6 +308,167 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "raml-shapes:supportedOperation": [ + { + "@id": "#/declares/shape/Query/supportedOperation/type", + "@type": [ + "raml-shapes:Operation", + "core:Operation", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "type" + } + ], + "raml-shapes:expects": [ + { + "@id": "#/declares/shape/Query/supportedOperation/type/expects/request", + "@type": [ + "raml-shapes:Request", + "core:Request", + "doc:DomainElement" + ], + "raml-shapes:parameter": [ + { + "@id": "#/declares/shape/Query/supportedOperation/type/expects/request/parameter/parameter/param", + "@type": [ + "raml-shapes:Parameter", + "core:Parameter", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "param" + } + ], + "raml-shapes:binding": [ + { + "@value": "query" + } + ], + "raml-shapes:required": [ + { + "@value": false + } + ], + "raml-shapes:schema": [ + { + "@id": "#/declares/shape/Query/supportedOperation/type/expects/request/parameter/parameter/param/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "raml-shapes:returns": [ + { + "@id": "#/declares/shape/Query/supportedOperation/type/returns/response", + "@type": [ + "raml-shapes:Response", + "core:Response", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "default" + } + ], + "raml-shapes:payload": [ + { + "@id": "#/declares/shape/Query/supportedOperation/type/returns/response/default", + "@type": [ + "raml-shapes:Payload", + "core:Payload", + "doc:DomainElement" + ], + "core:name": [ + { + "@value": "default" + } + ], + "raml-shapes:schema": [ + { + "@id": "#/declares/shape/Query/supportedOperation/type/returns/response/default/any/default-any", + "@type": [ + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ] + } + ] + } + ] + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-7.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-7.jsonld index 855fa673de..11d4fbccdb 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-7.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-7.jsonld @@ -334,6 +334,113 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name1", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name1/any/default-any", + "@type": [ + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ] + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "shacl:name": [ + { + "@value": "name1" + } + ] + }, + { + "@id": "#/declares/shape/Query/property/property/name2", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name2/any/default-any", + "@type": [ + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ] + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "shacl:name": [ + { + "@value": "name2" + } + ] + }, + { + "@id": "#/declares/shape/Query/property/property/name3", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name3/any/default-any", + "@type": [ + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ] + } + ], + "shacl:minCount": [ + { + "@value": 1 + } + ], + "shacl:name": [ + { + "@value": "name3" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-8.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-8.jsonld index 4beff2f468..9171b07d6b 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-8.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-field-type-8.jsonld @@ -171,6 +171,59 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.jsonld index c1a9011c1c..3bcb271b93 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.report index f93346c78e..fa0ce02068 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket-and-lparen.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: 'namea' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.jsonld index b95e230494..f5244637fa 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.report index c2baae8863..7195bd3159 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-lbracket.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: 'name' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.jsonld index 0ed941c475..a57ea0e495 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.jsonld @@ -47,8 +47,27 @@ ] } ], + "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + } + ], "@context": { "@base": "file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.graphql", + "raml-shapes": "http://a.ml/vocabularies/shapes#", + "shacl": "http://www.w3.org/ns/shacl#", "doc": "http://a.ml/vocabularies/document#", "apiContract": "http://a.ml/vocabularies/apiContract#", "core": "http://a.ml/vocabularies/core#" diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.report index ef131ec3dd..441d40c3e8 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.graphql Profile: GraphQL Conforms: false -Number of results: 4 +Number of results: 5 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket-and-rparen.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: ':' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.jsonld index 638878543f..4db73b82c5 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.jsonld @@ -47,8 +47,27 @@ ] } ], + "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + } + ], "@context": { "@base": "file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.graphql", + "raml-shapes": "http://a.ml/vocabularies/shapes#", + "shacl": "http://www.w3.org/ns/shacl#", "doc": "http://a.ml/vocabularies/document#", "apiContract": "http://a.ml/vocabularies/apiContract#", "core": "http://a.ml/vocabularies/core#" diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.report index 10f7cf2579..568e1fd1a1 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rbracket.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error: Unexpected end of file Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.jsonld index bc67d6385f..8c12dd92c4 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.report index 470769feea..83999d0804 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-rparen.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: ')' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.jsonld index 2e1ebcc58d..3db17ded64 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.report index 3339e30596..770b3b0014 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-slbracket.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: ']' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-srbracket.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-srbracket.jsonld index 3c9b42334c..7bdbb2d183 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-srbracket.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-srbracket.jsonld @@ -204,6 +204,92 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/names", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/names/array/default-array", + "@type": [ + "raml-shapes:ArrayShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:items": [ + { + "@id": "#/declares/shape/Query/property/property/names/array/default-array/union/default-union", + "@type": [ + "raml-shapes:UnionShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:anyOf": [ + { + "@id": "#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "raml-shapes:NilShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ] + }, + { + "@id": "#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "names" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-union-member-remixed.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-union-member-remixed.jsonld index 555d2ce67d..9d30928b28 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-union-member-remixed.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-union-member-remixed.jsonld @@ -278,7 +278,7 @@ ] }, { - "@id": "#/declares/shape/DType", + "@id": "#/declares/shape/Query", "@type": [ "shacl:NodeShape", "raml-shapes:AnyShape", @@ -288,7 +288,7 @@ ], "shacl:property": [ { - "@id": "#/declares/shape/DType/property/property/D", + "@id": "#/declares/shape/Query/property/property/name", "@type": [ "shacl:PropertyShape", "shacl:Shape", @@ -297,7 +297,7 @@ ], "raml-shapes:range": [ { - "@id": "#/declares/shape/DType/property/property/D/scalar/default-scalar", + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", "@type": [ "raml-shapes:ScalarShape", "raml-shapes:AnyShape", @@ -319,14 +319,14 @@ ], "shacl:name": [ { - "@value": "D" + "@value": "name" } ] } ], "shacl:name": [ { - "@value": "DType" + "@value": "Query" } ] }, @@ -380,6 +380,59 @@ "@value": "UnionType" } ] + }, + { + "@id": "#/declares/shape/DType", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/DType/property/property/D", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/DType/property/property/D/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "D" + } + ] + } + ], + "shacl:name": [ + { + "@value": "DType" + } + ] } ], "@context": { diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-union-member.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-union-member.jsonld index cc449550f7..644ca67f45 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-union-member.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/missing-union-member.jsonld @@ -172,7 +172,7 @@ ], "doc:declares": [ { - "@id": "#/declares/shape/AType", + "@id": "#/declares/shape/BType", "@type": [ "shacl:NodeShape", "raml-shapes:AnyShape", @@ -182,7 +182,7 @@ ], "shacl:property": [ { - "@id": "#/declares/shape/AType/property/property/a", + "@id": "#/declares/shape/BType/property/property/b", "@type": [ "shacl:PropertyShape", "shacl:Shape", @@ -191,7 +191,7 @@ ], "raml-shapes:range": [ { - "@id": "#/declares/shape/AType/property/property/a/scalar/default-scalar", + "@id": "#/declares/shape/BType/property/property/b/scalar/default-scalar", "@type": [ "raml-shapes:ScalarShape", "raml-shapes:AnyShape", @@ -213,19 +213,19 @@ ], "shacl:name": [ { - "@value": "a" + "@value": "b" } ] } ], "shacl:name": [ { - "@value": "AType" + "@value": "BType" } ] }, { - "@id": "#/declares/shape/BType", + "@id": "#/declares/shape/CType", "@type": [ "shacl:NodeShape", "raml-shapes:AnyShape", @@ -235,7 +235,7 @@ ], "shacl:property": [ { - "@id": "#/declares/shape/BType/property/property/b", + "@id": "#/declares/shape/CType/property/property/c", "@type": [ "shacl:PropertyShape", "shacl:Shape", @@ -244,7 +244,7 @@ ], "raml-shapes:range": [ { - "@id": "#/declares/shape/BType/property/property/b/scalar/default-scalar", + "@id": "#/declares/shape/CType/property/property/c/scalar/default-scalar", "@type": [ "raml-shapes:ScalarShape", "raml-shapes:AnyShape", @@ -266,19 +266,19 @@ ], "shacl:name": [ { - "@value": "b" + "@value": "c" } ] } ], "shacl:name": [ { - "@value": "BType" + "@value": "CType" } ] }, { - "@id": "#/declares/shape/CType", + "@id": "#/declares/shape/Query", "@type": [ "shacl:NodeShape", "raml-shapes:AnyShape", @@ -288,7 +288,7 @@ ], "shacl:property": [ { - "@id": "#/declares/shape/CType/property/property/c", + "@id": "#/declares/shape/Query/property/property/name", "@type": [ "shacl:PropertyShape", "shacl:Shape", @@ -297,7 +297,7 @@ ], "raml-shapes:range": [ { - "@id": "#/declares/shape/CType/property/property/c/scalar/default-scalar", + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", "@type": [ "raml-shapes:ScalarShape", "raml-shapes:AnyShape", @@ -319,14 +319,14 @@ ], "shacl:name": [ { - "@value": "c" + "@value": "name" } ] } ], "shacl:name": [ { - "@value": "CType" + "@value": "Query" } ] }, @@ -396,6 +396,59 @@ "@value": "UnionType" } ] + }, + { + "@id": "#/declares/shape/AType", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/AType/property/property/a", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/AType/property/property/a/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "a" + } + ] + } + ], + "shacl:name": [ + { + "@value": "AType" + } + ] } ], "@context": { diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/misspelling-type.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/misspelling-type.jsonld index 88e5ae7787..131036a657 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/misspelling-type.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/misspelling-type.jsonld @@ -171,6 +171,59 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:property": [ + { + "@id": "#/declares/shape/Query/property/property/name", + "@type": [ + "shacl:PropertyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "raml-shapes:range": [ + { + "@id": "#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "raml-shapes:ScalarShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "shacl:minCount": [ + { + "@value": 0 + } + ], + "shacl:name": [ + { + "@value": "name" + } + ] + } + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Dog", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-{-with-[.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-{-with-[.jsonld index 06f78e25c2..8547de1653 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-{-with-[.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-{-with-[.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-{-with-[.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-{-with-[.report index 396053da2c..ccd32a2d03 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-{-with-[.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-{-with-[.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-{-with-[.graphql Profile: GraphQL Conforms: false -Number of results: 1 +Number of results: 2 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/replace-%7B-with-%5B.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#antlr-error Message: Syntax error in the following text: '[' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.jsonld index 6138ca79ba..6a53916b30 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.report index f211b23937..c9227f12a1 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.report @@ -1,4 +1,14 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.graphql Profile: GraphQL -Conforms: true -Number of results: 0 +Conforms: false +Number of results: 1 + +Level: Violation + +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/scalar-inside-type.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.jsonld b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.jsonld index 69c8c4207b..600c094c3b 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.jsonld @@ -48,6 +48,21 @@ } ], "doc:declares": [ + { + "@id": "#/declares/shape/Query", + "@type": [ + "shacl:NodeShape", + "raml-shapes:AnyShape", + "shacl:Shape", + "raml-shapes:Shape", + "doc:DomainElement" + ], + "shacl:name": [ + { + "@value": "Query" + } + ] + }, { "@id": "#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.report b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.report index 50407c08d1..8f347f0014 100644 --- a/amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.report +++ b/amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.report @@ -1,4 +1,14 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.graphql Profile: GraphQL -Conforms: true -Number of results: 0 +Conforms: false +Number of results: 1 + +Level: Violation + +- Constraint: http://a.ml/vocabularies/amf/parser#empty-definition + Message: Type definitions must have at least one field + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/syntax-recovery/type-inside-type.graphql#/declares/shape/Query + Property: http://www.w3.org/ns/shacl#property + Range: [(1,0)-(1,10)] + Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.jsonld index f4a37abc04..19cb317d29 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.graphql#/declares/shape/MyObj", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.resolved.jsonld index 9a6d00db27..cdd701292b 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-enum-values.api.graphql#/declares/shape/MyObj", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.jsonld index cb9a4beeca..646fc2716f 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.jsonld @@ -1157,6 +1157,59 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.graphql#/declares/shape/MyNestedInputObj", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.resolved.jsonld index c99fc2ea5e..596c62d440 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.resolved.jsonld @@ -1674,6 +1674,59 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-input-object-values.api.graphql#/declares/shape/MyNestedInputObj", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.jsonld index 82820877b6..ab3c91cc4b 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.graphql#/declares/shape/MyObj", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.resolved.jsonld index 0dcb771ccd..6785ab1a78 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/argument-scalar-values.api.graphql#/declares/shape/MyObj", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.jsonld index f5e10cf434..33972a0d0f 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.jsonld @@ -359,6 +359,59 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.graphql#/declares/shape/Query/property/property/text", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.graphql#/declares/shape/Query/property/property/text/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "text" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.graphql#/declares/shape/CatOwner", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.resolved.jsonld index 657e55f42c..ebcb84103e 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.resolved.jsonld @@ -907,6 +907,59 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.graphql#/declares/shape/Query/property/property/text", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.graphql#/declares/shape/Query/property/property/text/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "text" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/covariance.api.graphql#/declares/shape/CatOwner", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.jsonld index 6aa1de1e75..6d85873afc 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.jsonld @@ -176,6 +176,64 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.graphql#/declares/shape/Query/property/property/date", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.graphql#/declares/shape/Query/property/property/date/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.graphql#/declares/scalar/Date" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Date" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "date" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.graphql#/declares/scalar/Date", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.resolved.jsonld index 001eb2ac81..eb2be95bcb 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.resolved.jsonld @@ -181,6 +181,64 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.graphql#/declares/shape/Query/property/property/date", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.graphql#/declares/scalar/Date", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Date" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "date" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/custom-scalar.api.graphql#/declares/scalar/Date", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.jsonld index edd0ec73bf..e0651510f1 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.jsonld @@ -176,6 +176,64 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Query/property/property/person", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Query/property/property/person/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.resolved.jsonld index c9af0b8542..9535aa1e1b 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.resolved.jsonld @@ -181,6 +181,176 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Query/property/property/person", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person/property/property/firstName", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person/property/property/firstName/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "firstName" + } + ], + "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/deprecated": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "deprecated" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person/property/property/firstName/customDomainProperties/deprecated/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#reason": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person/property/property/firstName/customDomainProperties/deprecated/data-node/reason", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "Use `name` instead" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "reason" + } + ] + } + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/deprecated" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/deprecated.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.jsonld index 728dfa9c14..2dafc6fb99 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.graphql#/declares/scalar/MyEnum", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.resolved.jsonld index 1a48414558..a545f46b35 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions-enum.api.graphql#/declares/scalar/MyEnum", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.jsonld index b71d538c91..4cc2434c0c 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.jsonld @@ -228,6 +228,166 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "translate" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Translates a string from a given language into a different language." + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/expects/request/parameter/parameter/fromLanguage", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "fromLanguage" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "The original language that `text` is provided in." + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/expects/request/parameter/parameter/fromLanguage/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response/default/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.resolved.jsonld index 9e109569e5..4982317243 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.resolved.jsonld @@ -233,6 +233,166 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "translate" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Translates a string from a given language into a different language." + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/expects/request/parameter/parameter/fromLanguage", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "fromLanguage" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "The original language that `text` is provided in." + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/expects/request/parameter/parameter/fromLanguage/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Query/supportedOperation/translate/returns/response/default/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/descriptions.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.jsonld index 3004dd8574..23784093a1 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.jsonld @@ -755,6 +755,102 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query/property/property/rootField", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query/property/property/rootField/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "rootField" + } + ], + "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/example": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "example" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query/property/property/rootField/customDomainProperties/example/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#text": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query/property/property/rootField/customDomainProperties/example/data-node/text", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "Jorge" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "text" + } + ] + } + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/example" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/MyObject", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.resolved.jsonld index f741989e2d..be91fcf689 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.resolved.jsonld @@ -760,6 +760,102 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query/property/property/rootField", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query/property/property/rootField/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "rootField" + } + ], + "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/example": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "example" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query/property/property/rootField/customDomainProperties/example/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#text": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/Query/property/property/rootField/customDomainProperties/example/data-node/text", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "Jorge" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "text" + } + ] + } + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/example" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-applications.api.graphql#/declares/shape/MyObject", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.jsonld index 3de1e063af..14be72dac6 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.jsonld @@ -214,6 +214,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.graphql#/declares/MyDirective", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.resolved.jsonld index d2d5fac77e..c83a84626d 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.resolved.jsonld @@ -219,6 +219,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-arguments.api.graphql#/declares/MyDirective", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.jsonld index 32678f8808..a267114bae 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.graphql#/declares/mutation", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.resolved.jsonld index 6d8beefc55..64cbdc25cc 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-locations.api.graphql#/declares/mutation", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.jsonld index 79e743b96e..e41404f8ea 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.jsonld @@ -189,6 +189,77 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ], + "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/MyDirective": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "MyDirective" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/shape/Query/customDomainProperties/MyDirective/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/MyDirective" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/MyDirective", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.resolved.jsonld index eb8d918841..5d098d50f6 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.resolved.jsonld @@ -194,6 +194,77 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ], + "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/MyDirective": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "MyDirective" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/shape/Query/customDomainProperties/MyDirective/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/MyDirective" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-multitarget.api.graphql#/declares/MyDirective", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.jsonld index 7b9c8eccb8..5f1ee4f26a 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.jsonld @@ -189,6 +189,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.graphql#/declares/MyDirective", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.resolved.jsonld index 966eaef73a..c17cb0bdc2 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.resolved.jsonld @@ -194,6 +194,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/directive-simple.api.graphql#/declares/MyDirective", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.jsonld index 97be6b0604..3316830e19 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.graphql#/declares/scalar/Planet", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.resolved.jsonld index 144faacb23..4a5c85511e 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-enum.api.graphql#/declares/scalar/Planet", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.jsonld index f052a3e5a9..a9f651bbd8 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.graphql#/declares/shape/InputType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.resolved.jsonld index d828d06ead..72c7dfa412 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-input-type.api.graphql#/declares/shape/InputType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.jsonld index 6adac88862..11b971e297 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.graphql#/declares/shape/HasName", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.resolved.jsonld index e6414d4bbc..9c3aedf5cd 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-interface.api.graphql#/declares/shape/HasName", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.jsonld index 9aedfdab5b..ad5231bc0b 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.graphql#/declares/shape/Location", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.resolved.jsonld index d5a7a809b8..1d08a6c06d 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-objects.api.graphql#/declares/shape/Location", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.jsonld index 6dc23b039f..73b60bf656 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.graphql#/declares/scalar/Date", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.resolved.jsonld index 3e3911b3ea..f2c3fbcd77 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-scalars.api.graphql#/declares/scalar/Date", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.jsonld index 7593f6e540..b8b79c3938 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.resolved.jsonld index c93a070048..3a1e9d68af 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/extension-union.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.jsonld index bb9fd9d5e0..9564ccd904 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.jsonld @@ -150,6 +150,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.graphql#/declares/shape/BaseType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.resolved.jsonld index facd013734..a39cc52cce 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.resolved.jsonld @@ -155,6 +155,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-chain-covariant.graphql#/declares/shape/BaseType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.jsonld index 63af3047e7..9685ab95d9 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.graphql#/declares/shape/Query/property/property/text", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.graphql#/declares/shape/Query/property/property/text/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "text" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.resolved.jsonld index 5dc4f7fabe..bed7eb383f 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.graphql#/declares/shape/Query/property/property/text", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.graphql#/declares/shape/Query/property/property/text/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "text" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-double.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.jsonld index dcbe12a330..80ae7b46cd 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.graphql#/declares/shape/Query/property/property/text", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.graphql#/declares/shape/Query/property/property/text/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "text" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.resolved.jsonld index dd1323220b..711a94e00a 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.graphql#/declares/shape/Query/property/property/text", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.graphql#/declares/shape/Query/property/property/text/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "text" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-simple.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.dumped.graphql b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.dumped.graphql index 13149da96f..3c06e9d583 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.dumped.graphql +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.dumped.graphql @@ -12,13 +12,13 @@ interface HasName { name: String! } -interface HasSurname { - surname: String! -} - interface HasFullName implements HasName & HasSurname { name: String! middleName: String! surname: String! } +interface HasSurname { + surname: String! +} + diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.jsonld index d1c1f2860d..a064166160 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/Query/property/property/text", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/Query/property/property/text/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "text" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/Person", "@type": [ @@ -376,64 +429,6 @@ } ] }, - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname", - "@type": [ - "http://www.w3.org/ns/shacl#NodeShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/shapes#isAbstract": [ - { - "@value": true - } - ], - "http://www.w3.org/ns/shacl#property": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname/property/property/surname", - "@type": [ - "http://www.w3.org/ns/shacl#PropertyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/shapes#range": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname/property/property/surname/scalar/default-scalar", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#string" - } - ] - } - ], - "http://www.w3.org/ns/shacl#minCount": [ - { - "@value": 1 - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "surname" - } - ] - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "HasSurname" - } - ] - }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasFullName", "@type": [ @@ -615,6 +610,64 @@ ] } ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#isAbstract": [ + { + "@value": true + } + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname/property/property/surname", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname/property/property/surname/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "surname" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "HasSurname" + } + ] } ] } diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.resolved.jsonld index c4507c2c18..4ed1dd8b7f 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/Query/property/property/text", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/Query/property/property/text/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "text" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/Person", "@type": [ @@ -609,64 +662,6 @@ } ] }, - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname", - "@type": [ - "http://www.w3.org/ns/shacl#NodeShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/shapes#isAbstract": [ - { - "@value": true - } - ], - "http://www.w3.org/ns/shacl#property": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname/property/property/surname", - "@type": [ - "http://www.w3.org/ns/shacl#PropertyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/shapes#range": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname/property/property/surname/scalar/default-scalar", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#string" - } - ] - } - ], - "http://www.w3.org/ns/shacl#minCount": [ - { - "@value": 1 - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "surname" - } - ] - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "HasSurname" - } - ] - }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasFullName", "@type": [ @@ -914,6 +909,64 @@ ] } ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#isAbstract": [ + { + "@value": true + } + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname/property/property/surname", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/interface-with-interface.graphql#/declares/shape/HasSurname/property/property/surname/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "surname" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "HasSurname" + } + ] } ] } diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.jsonld index 8297c98dc2..1d2b8a40fc 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.graphql#/declares/shape/Query/property/property/a", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.graphql#/declares/shape/Query/property/property/a/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "a" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.graphql#/declares/shape/InputType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.resolved.jsonld index a420ec9948..67382fa129 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.graphql#/declares/shape/Query/property/property/a", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.graphql#/declares/shape/Query/property/property/a/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "a" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-directive-arguments.graphql#/declares/shape/InputType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-fields.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-fields.jsonld index 941881cfcd..bf6099be66 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-fields.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-fields.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-fields.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-fields.graphql#/declares/shape/Query/property/property/a", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-fields.graphql#/declares/shape/Query/property/property/a/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "a" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-fields.graphql#/declares/shape/InputType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.dumped.graphql b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.dumped.graphql index cea502db16..53394359c4 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.dumped.graphql +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.dumped.graphql @@ -2,10 +2,6 @@ type Query { a: String } -input InputType { - name: String -} - interface Interface { queryInputType(input_: InputType): String queryEnum(input_: Enum): String @@ -19,3 +15,7 @@ enum Enum { } scalar Pepe +input InputType { + name: String +} + diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.jsonld index 48711feafc..db9813deb1 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.jsonld @@ -171,64 +171,6 @@ } ], "http://a.ml/vocabularies/document#declares": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType", - "@type": [ - "http://www.w3.org/ns/shacl#NodeShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#property": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType/property/property/name", - "@type": [ - "http://www.w3.org/ns/shacl#PropertyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/shapes#range": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType/property/property/name/scalar/default-scalar", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#string" - } - ] - } - ], - "http://www.w3.org/ns/shacl#minCount": [ - { - "@value": 0 - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "name" - } - ] - } - ], - "http://a.ml/vocabularies/shapes#inputOnly": [ - { - "@value": true - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "InputType" - } - ] - }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/Interface", "@type": [ @@ -898,6 +840,117 @@ "@value": "Pepe" } ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/Query/property/property/a", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/Query/property/property/a/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "a" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://a.ml/vocabularies/shapes#inputOnly": [ + { + "@value": true + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "InputType" + } + ] } ] } diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.resolved.jsonld index 58d1a63e60..facbd2e549 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.resolved.jsonld @@ -176,64 +176,6 @@ } ], "http://a.ml/vocabularies/document#declares": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType", - "@type": [ - "http://www.w3.org/ns/shacl#NodeShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#property": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType/property/property/name", - "@type": [ - "http://www.w3.org/ns/shacl#PropertyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/shapes#range": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType/property/property/name/scalar/default-scalar", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#string" - } - ] - } - ], - "http://www.w3.org/ns/shacl#minCount": [ - { - "@value": 0 - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "name" - } - ] - } - ], - "http://a.ml/vocabularies/shapes#inputOnly": [ - { - "@value": true - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "InputType" - } - ] - }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/Interface", "@type": [ @@ -992,6 +934,117 @@ "@value": "Pepe" } ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/Query/property/property/a", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/Query/property/property/a/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "a" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-interface-arguments.graphql#/declares/shape/InputType/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://a.ml/vocabularies/shapes#inputOnly": [ + { + "@value": true + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "InputType" + } + ] } ] } diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.dumped.graphql b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.dumped.graphql index 66c9bc1c0d..1750b4398c 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.dumped.graphql +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.dumped.graphql @@ -2,20 +2,20 @@ type Query { a: String } -type Object { - queryInputType(input_: InputType): String - queryEnum(input_: Enum): String - queryScalar(input_: String): String - queryCustomScalar(input_: Pepe): String +enum Enum { + A + B } +scalar Pepe input InputType { name: String } -enum Enum { - A - B +type Object { + queryInputType(input_: InputType): String + queryEnum(input_: Enum): String + queryScalar(input_: String): String + queryCustomScalar(input_: Pepe): String } -scalar Pepe diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.jsonld index 34063be392..c558c045da 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.jsonld @@ -171,6 +171,213 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Enum" + } + ], + "http://www.w3.org/ns/shacl#in": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/list", + "@type": "http://www.w3.org/2000/01/rdf-schema#Seq", + "http://www.w3.org/2000/01/rdf-schema#_1": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/in/A", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "A" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "A" + } + ] + } + ], + "http://www.w3.org/2000/01/rdf-schema#_2": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/in/B", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "B" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "B" + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Pepe", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Pepe" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/Query/property/property/a", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/Query/property/property/a/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "a" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://a.ml/vocabularies/shapes#inputOnly": [ + { + "@value": true + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "InputType" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/Object", "@type": [ @@ -734,160 +941,6 @@ "@value": "Object" } ] - }, - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType", - "@type": [ - "http://www.w3.org/ns/shacl#NodeShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#property": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType/property/property/name", - "@type": [ - "http://www.w3.org/ns/shacl#PropertyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/shapes#range": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType/property/property/name/scalar/default-scalar", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#string" - } - ] - } - ], - "http://www.w3.org/ns/shacl#minCount": [ - { - "@value": 0 - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "name" - } - ] - } - ], - "http://a.ml/vocabularies/shapes#inputOnly": [ - { - "@value": true - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "InputType" - } - ] - }, - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#anyType" - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "Enum" - } - ], - "http://www.w3.org/ns/shacl#in": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/list", - "@type": "http://www.w3.org/2000/01/rdf-schema#Seq", - "http://www.w3.org/2000/01/rdf-schema#_1": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/in/A", - "@type": [ - "http://a.ml/vocabularies/data#Scalar", - "http://a.ml/vocabularies/data#Node", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/data#value": [ - { - "@value": "A" - } - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#anyType" - } - ], - "http://a.ml/vocabularies/core#name": [ - { - "@value": "A" - } - ] - } - ], - "http://www.w3.org/2000/01/rdf-schema#_2": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/in/B", - "@type": [ - "http://a.ml/vocabularies/data#Scalar", - "http://a.ml/vocabularies/data#Node", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/data#value": [ - { - "@value": "B" - } - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#anyType" - } - ], - "http://a.ml/vocabularies/core#name": [ - { - "@value": "B" - } - ] - } - ] - } - ] - }, - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Pepe", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#anyType" - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "Pepe" - } - ] } ] } diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.resolved.jsonld index 84ba636fca..67e33a6396 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.resolved.jsonld @@ -176,6 +176,213 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Enum" + } + ], + "http://www.w3.org/ns/shacl#in": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/list", + "@type": "http://www.w3.org/2000/01/rdf-schema#Seq", + "http://www.w3.org/2000/01/rdf-schema#_1": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/in/A", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "A" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "A" + } + ] + } + ], + "http://www.w3.org/2000/01/rdf-schema#_2": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/in/B", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "B" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "B" + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Pepe", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Pepe" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/Query/property/property/a", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/Query/property/property/a/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "a" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://a.ml/vocabularies/shapes#inputOnly": [ + { + "@value": true + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "InputType" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/Object", "@type": [ @@ -833,160 +1040,6 @@ "@value": "Object" } ] - }, - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType", - "@type": [ - "http://www.w3.org/ns/shacl#NodeShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#property": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType/property/property/name", - "@type": [ - "http://www.w3.org/ns/shacl#PropertyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/shapes#range": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/shape/InputType/property/property/name/scalar/default-scalar", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#string" - } - ] - } - ], - "http://www.w3.org/ns/shacl#minCount": [ - { - "@value": 0 - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "name" - } - ] - } - ], - "http://a.ml/vocabularies/shapes#inputOnly": [ - { - "@value": true - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "InputType" - } - ] - }, - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#anyType" - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "Enum" - } - ], - "http://www.w3.org/ns/shacl#in": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/list", - "@type": "http://www.w3.org/2000/01/rdf-schema#Seq", - "http://www.w3.org/2000/01/rdf-schema#_1": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/in/A", - "@type": [ - "http://a.ml/vocabularies/data#Scalar", - "http://a.ml/vocabularies/data#Node", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/data#value": [ - { - "@value": "A" - } - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#anyType" - } - ], - "http://a.ml/vocabularies/core#name": [ - { - "@value": "A" - } - ] - } - ], - "http://www.w3.org/2000/01/rdf-schema#_2": [ - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Enum/in/B", - "@type": [ - "http://a.ml/vocabularies/data#Scalar", - "http://a.ml/vocabularies/data#Node", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://a.ml/vocabularies/data#value": [ - { - "@value": "B" - } - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#anyType" - } - ], - "http://a.ml/vocabularies/core#name": [ - { - "@value": "B" - } - ] - } - ] - } - ] - }, - { - "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-input-type-object-arguments.graphql#/declares/scalar/Pepe", - "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "http://a.ml/vocabularies/shapes#AnyShape", - "http://www.w3.org/ns/shacl#Shape", - "http://a.ml/vocabularies/shapes#Shape", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#datatype": [ - { - "@id": "http://www.w3.org/2001/XMLSchema#anyType" - } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "Pepe" - } - ] } ] } diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.jsonld index d139251bf8..3d017f4d14 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.jsonld @@ -537,6 +537,59 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.graphql#/declares/shape/Object1", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.resolved.jsonld index 019d24a98a..0959601413 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.resolved.jsonld @@ -767,6 +767,59 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-interface-fields.api.graphql#/declares/shape/Object1", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.jsonld index 7feb4b0780..541ed58b9a 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.jsonld @@ -305,6 +305,59 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.graphql#/declares/shape/RootObject", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.resolved.jsonld index 5c8c5f51d2..527757f26e 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.resolved.jsonld @@ -310,6 +310,59 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/is-output-type-object-fields.api.graphql#/declares/shape/RootObject", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.jsonld index dc346b178e..2e8664a4dc 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.resolved.jsonld index e2a04a3256..9f974478ae 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/nested-interfaces.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.jsonld index e3a173f4fc..db147f4788 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.jsonld @@ -333,6 +333,211 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "setMessage" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/expects/request/parameter/parameter/message", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "message" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/expects/request/parameter/parameter/message/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response/default/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Mutation" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Query/property/property/getMessage", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Query/property/property/getMessage/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "getMessage" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.resolved.jsonld index 00020efe13..7fa25816a2 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.resolved.jsonld @@ -338,6 +338,211 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "setMessage" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/expects/request/parameter/parameter/message", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "message" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/expects/request/parameter/parameter/message/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Mutation/supportedOperation/setMessage/returns/response/default/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Mutation" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Query/property/property/getMessage", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/no-schema.api.graphql#/declares/shape/Query/property/property/getMessage/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "getMessage" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/recursion.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/recursion.api.jsonld index 5bcfdff727..df43938e20 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/recursion.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/recursion.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/recursion.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/recursion.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/recursion.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/recursion.api.graphql#/declares/shape/Type", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.jsonld index 8d30a65089..9642ed2e97 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.jsonld @@ -413,6 +413,167 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyQuery", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyQuery/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyQuery/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MyQuery" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyMutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyMutation/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyMutation/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MyMutation" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MySubscription", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MySubscription/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MySubscription/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MySubscription" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.resolved.jsonld index 3a19efb777..a1782c71c5 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.resolved.jsonld @@ -418,6 +418,167 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyQuery", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyQuery/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyQuery/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MyQuery" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyMutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyMutation/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MyMutation/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MyMutation" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MySubscription", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MySubscription/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema-extends.graphql#/declares/shape/MySubscription/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MySubscription" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.jsonld index e60ea8ba77..fc3e3f7d2e 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.jsonld @@ -413,6 +413,167 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyQuery", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyQuery/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyQuery/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MyQuery" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyMutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyMutation/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyMutation/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MyMutation" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MySubscription", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MySubscription/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MySubscription/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MySubscription" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.resolved.jsonld index 0c8d66ef2a..11f33fe7f0 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.resolved.jsonld @@ -418,6 +418,167 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyQuery", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyQuery/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyQuery/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MyQuery" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyMutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyMutation/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MyMutation/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MyMutation" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MySubscription", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MySubscription/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types-in-schema.graphql#/declares/shape/MySubscription/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "MySubscription" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.jsonld index d954219a30..551f6b8033 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.jsonld @@ -413,6 +413,167 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Mutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Mutation/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Mutation/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Mutation" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Subscription", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Subscription/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Subscription/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Subscription" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.resolved.jsonld index e8b31301ee..02716090a6 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.resolved.jsonld @@ -418,6 +418,167 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Mutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Mutation/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Mutation/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Mutation" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Subscription", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Subscription/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/root-types.graphql#/declares/shape/Subscription/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Subscription" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.jsonld index 2b366d990f..0520409d84 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.graphql#/declares/shape/Starship", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.resolved.jsonld index 9745592ce0..832b2fe88d 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-arguments.api.graphql#/declares/shape/Starship", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.jsonld index dbefbe83f5..c1454ff833 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.jsonld @@ -176,6 +176,64 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/shape/Query/property/property/season", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/shape/Query/property/property/season/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/scalar/Season" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Season" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "season" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/scalar/Season", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.resolved.jsonld index ca058764c2..b355009b4d 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.resolved.jsonld @@ -181,6 +181,170 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/shape/Query/property/property/season", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/scalar/Season", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Season" + } + ], + "http://www.w3.org/ns/shacl#in": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/scalar/Season/list", + "@type": "http://www.w3.org/2000/01/rdf-schema#Seq", + "http://www.w3.org/2000/01/rdf-schema#_1": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/scalar/Season/in/SPRING", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "SPRING" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "SPRING" + } + ] + } + ], + "http://www.w3.org/2000/01/rdf-schema#_2": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/scalar/Season/in/AUTUMN", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "AUTUMN" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "AUTUMN" + } + ] + } + ], + "http://www.w3.org/2000/01/rdf-schema#_3": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/scalar/Season/in/SUMMER", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "SUMMER" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "SUMMER" + } + ] + } + ], + "http://www.w3.org/2000/01/rdf-schema#_4": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/scalar/Season/in/WINTER", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "WINTER" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "WINTER" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "season" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-enum.api.graphql#/declares/scalar/Season", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.jsonld index 3ae126a00b..2efbc8e449 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.jsonld @@ -345,6 +345,219 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "changeUserStatus" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/expects/request/parameter/parameter/input_", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "input_" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/expects/request/parameter/parameter/input_/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/InputType" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "InputType" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/returns/response/default/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/OutputType" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "OutputType" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Mutation" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/OutputType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.resolved.jsonld index 0138da13be..94a6062954 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.resolved.jsonld @@ -350,6 +350,290 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "changeUserStatus" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/expects/request/parameter/parameter/input_", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "input_" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/InputType", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/InputType/property/property/randomText", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/InputType/property/property/randomText/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "randomText" + } + ] + } + ], + "http://a.ml/vocabularies/shapes#inputOnly": [ + { + "@value": true + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "InputType" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/Mutation/supportedOperation/changeUserStatus/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/OutputType", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/OutputType/property/property/success", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/OutputType/property/property/success/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "success" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "OutputType" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Mutation" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-input-type.api.graphql#/declares/shape/OutputType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.jsonld index a8f96c1e52..193b03f16a 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.jsonld @@ -202,6 +202,94 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "names" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.resolved.jsonld index 79fa1fd8eb..c7d7b73eae 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.resolved.jsonld @@ -207,6 +207,94 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-list.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "names" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.jsonld index 5720a437d4..2535f35228 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.graphql#/declares/shape/ChessBoard", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.resolved.jsonld index 8e94d52dff..945a8d8c46 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.resolved.jsonld @@ -176,6 +176,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-matrix.api.graphql#/declares/shape/ChessBoard", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.jsonld index 1b17a23948..690730e9ef 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.jsonld @@ -395,6 +395,178 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "names" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names2", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names2/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names2/array/default-array/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "names2" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.resolved.jsonld index 79580c969a..1a95510b16 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.resolved.jsonld @@ -400,6 +400,178 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names/array/default-array/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "names" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names2", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names2/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-non-null.api.graphql#/declares/shape/Query/property/property/names2/array/default-array/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "names2" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.jsonld index 59316592db..8fb83f847c 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.jsonld @@ -176,6 +176,64 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Query/property/property/person", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Query/property/property/person/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Person" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.resolved.jsonld index 6245bf0b4d..b255da4187 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.resolved.jsonld @@ -181,6 +181,97 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Query/property/property/person", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Person", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Person/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Person/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-object.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.jsonld index 2cf357bdab..fd3c2de4fc 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.jsonld @@ -662,6 +662,210 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/id", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "id" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/string", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/string/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "string" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/boolean", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/boolean/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "boolean" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/int", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/int/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "int" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/float", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/float/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#float" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "float" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.resolved.jsonld index e501ec5665..f7adf164a2 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.resolved.jsonld @@ -667,6 +667,210 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/id", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "id" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/string", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/string/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "string" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/boolean", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/boolean/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "boolean" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/int", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/int/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "int" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/float", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-scalars.api.graphql#/declares/shape/Query/property/property/float/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#float" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "float" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.jsonld index c53335ffe4..f5124b9154 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.jsonld @@ -176,6 +176,64 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Query/property/property/searchResult", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Query/property/property/searchResult/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/union/SearchResult" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "SearchResult" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "searchResult" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.resolved.jsonld b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.resolved.jsonld index 0547030e44..fa9a4b415b 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.resolved.jsonld @@ -181,6 +181,239 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Query/property/property/searchResult", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/union/SearchResult", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Person", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Person/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Person/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Person/property/property/surname", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Person/property/property/surname/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "surname" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Person" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Dog", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Dog/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Dog/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Dog/property/property/breed", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Dog/property/property/breed/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "breed" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Dog" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "SearchResult" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "searchResult" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/graphql/tck/apis/valid/types-union.api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/parser/annotations/graphql.graphql b/amf-cli/shared/src/test/resources/parser/annotations/graphql.graphql index 59514575e2..84fbae3419 100644 --- a/amf-cli/shared/src/test/resources/parser/annotations/graphql.graphql +++ b/amf-cli/shared/src/test/resources/parser/annotations/graphql.graphql @@ -14,7 +14,7 @@ type Query { } type Mutation { - changeUserStatus(input_: InputType!): OutputType + changeUserStatus: OutputType } """ @@ -67,3 +67,7 @@ extend enum Planet { } scalar Date + +type OutputType { + success(input_: InputType!): Boolean +} \ No newline at end of file diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.jsonld index 5c69552a64..583a677cb2 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.jsonld @@ -543,6 +543,486 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "name" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultString", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultString" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultString/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultString/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "Darth Vader" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultInt", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultInt" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultInt/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultInt/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "7" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultFloat", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultFloat" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultFloat/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#float" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultFloat/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "6.9" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#float" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultBoolean", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultBoolean" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultBoolean/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultBoolean/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "false" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultID", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultID" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultID/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultID/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "123" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultEnum", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultEnum" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultEnum/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/scalar/Letter" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Letter" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultEnum/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "A" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response/default/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/default-arguments.graphql#/declares/shape/Spaceship", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.jsonld index 31a36c074a..338c727d72 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.jsonld @@ -543,6 +543,486 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "name" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultString", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultString" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultString/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultString/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "123" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultInt", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultInt" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultInt/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultInt/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "asdf" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultFloat", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultFloat" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultFloat/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#float" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultFloat/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "7" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultBoolean", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultBoolean" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultBoolean/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultBoolean/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "6.9" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#float" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultID", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultID" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultID/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultID/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "false" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#boolean" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultEnum", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testDefaultEnum" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultEnum/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/scalar/Letter" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Letter" + } + ] + } + ], + "http://a.ml/vocabularies/core#defaultValue": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/testDefaultEnum/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "123" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Query/supportedOperation/name/returns/response/default/union/default-union/anyOf/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/default-arguments/invalid-default-arguments.graphql#/declares/shape/Spaceship", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.jsonld index 2d1a3f5cda..df729eb582 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.jsonld @@ -1516,6 +1516,476 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/property/property/property", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/property/property/property/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/property/property/property/scalar/default-scalar/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/property/property/property/scalar/default-scalar/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/property/property/property/scalar/default-scalar" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(3,14)-(3,21)]" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "property" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Property description" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/property/property/property/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/property/property/property/source-map/synthesized-field/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#minCount" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/property/property/property/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/property/property/property" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,4)-(3,21)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "operation" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Operation description" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "arg" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Argument description" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/scalar/default-scalar/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/scalar/default-scalar/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/scalar/default-scalar" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,46)-(6,53)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/shapes#binding" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/source-map/synthesized-field/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/shapes#required" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,14)-(6,53)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/expects/request" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/scalar/default-scalar/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/scalar/default-scalar/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/scalar/default-scalar" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,56)-(6,63)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/returns/response" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/supportedOperation/operation" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(5,4)-(6,63)]" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#declared-element": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/source-map/declared-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/shape/Query" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(1,0)-(7,1)]" + } + ] + } + ] + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/block.graphql#/declares/scalar/Scalar", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.jsonld index 8cab3605e3..cbdbec6a4b 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.jsonld @@ -1516,6 +1516,476 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/property/property/property", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/property/property/property/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/property/property/property/scalar/default-scalar/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/property/property/property/scalar/default-scalar/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/property/property/property/scalar/default-scalar" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(3,14)-(3,21)]" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "property" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Property description" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/property/property/property/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/property/property/property/source-map/synthesized-field/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#minCount" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/property/property/property/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/property/property/property" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,4)-(3,21)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "operation" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Operation description" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "arg" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Argument description" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/scalar/default-scalar/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/scalar/default-scalar/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/scalar/default-scalar" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,42)-(6,49)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/shapes#binding" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/source-map/synthesized-field/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/shapes#required" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/parameter/parameter/arg" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,14)-(6,49)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/expects/request" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/scalar/default-scalar/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/scalar/default-scalar/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/scalar/default-scalar" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(6,52)-(6,59)]" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/default" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#virtual-element": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response/source-map/virtual-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/returns/response" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/supportedOperation/operation" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(5,4)-(6,59)]" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#declared-element": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/source-map/declared-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/shape/Query" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(1,0)-(7,1)]" + } + ] + } + ] + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/descriptions/simple.graphql#/declares/scalar/Scalar", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.jsonld index ab252730a2..8ac39c0351 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.jsonld @@ -257,6 +257,145 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ], + "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/MyDirective": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "MyDirective" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/shape/Query/property/property/name/customDomainProperties/MyDirective/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#testString": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/shape/Query/property/property/name/customDomainProperties/MyDirective/data-node/testString", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "custom" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testString" + } + ] + } + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/MyDirective" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ], + "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/MyDirective": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "MyDirective" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/shape/Query/customDomainProperties/MyDirective/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#testString": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/shape/Query/customDomainProperties/MyDirective/data-node/testString", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "custom" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "testString" + } + ] + } + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/MyDirective" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/arguments.graphql#/declares/shape/Spaceship", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.jsonld index 91e5e09640..24ba77b21b 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.jsonld @@ -214,6 +214,102 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ], + "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.graphql#/declares/deprecated": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "deprecated" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.graphql#/declares/shape/Query/property/property/name/customDomainProperties/deprecated/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#reason": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.graphql#/declares/shape/Query/property/property/name/customDomainProperties/deprecated/data-node/reason", + "@type": [ + "http://a.ml/vocabularies/data#Scalar", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/data#value": [ + { + "@value": "no reason" + } + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "reason" + } + ] + } + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.graphql#/declares/deprecated" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/default.graphql#/declares/scalar/ShipType", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.jsonld index 1fe7898338..3e736faeda 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.jsonld @@ -239,6 +239,93 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ], + "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/One": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "One" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/shape/Query/property/property/name/customDomainProperties/One/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/Two": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "Two" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/shape/Query/property/property/name/customDomainProperties/Two/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/One" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/Two" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/multiple.graphql#/declares/shape/Spaceship", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.jsonld index 89fb96b550..313449b638 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.jsonld @@ -207,6 +207,77 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ], + "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.graphql#/declares/MyDirective": { + "http://a.ml/vocabularies/core#extensionName": [ + { + "@value": "MyDirective" + } + ], + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.graphql#/declares/shape/Query/property/property/name/customDomainProperties/MyDirective/data-node", + "@type": [ + "http://a.ml/vocabularies/data#Object", + "http://a.ml/vocabularies/data#Node", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + "http://a.ml/vocabularies/document#customDomainProperties": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.graphql#/declares/MyDirective" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/directives/simple.graphql#/declares/shape/Spaceship", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.jsonld index 68c068f369..187dc2652a 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.jsonld @@ -298,6 +298,100 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.graphql#/declares/shape/Query/property/property/fragment", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.graphql#/declares/shape/Query/property/property/fragment/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "fragment" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.graphql#/declares/shape/Query/property/property/another", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.graphql#/declares/shape/Query/property/property/another/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.graphql#/declares/shape/Another" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Another" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "another" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/fragment-reserved-name/api.graphql#/declares/shape/Another", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-enum-values/api.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-enum-values/api.jsonld index 05f3dacb45..b3c8c2eb84 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-enum-values/api.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-enum-values/api.jsonld @@ -176,6 +176,64 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-enum-values/api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-enum-values/api.graphql#/declares/shape/Query/property/property/myEnum", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-enum-values/api.graphql#/declares/shape/Query/property/property/myEnum/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-enum-values/api.graphql#/declares/scalar/MyEnum" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "MyEnum" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "myEnum" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-enum-values/api.graphql#/declares/scalar/MyEnum", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-names/api.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-names/api.jsonld index 2e36c68c94..a713f85ef7 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-names/api.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-names/api.jsonld @@ -176,6 +176,64 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-names/api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-names/api.graphql#/declares/shape/Query/property/property/person", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-names/api.graphql#/declares/shape/Query/property/property/person/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-names/api.graphql#/declares/shape/Person" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/keyword-names/api.graphql#/declares/shape/Person", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.jsonld index 9fce6a76fb..9e3cfadc04 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.jsonld @@ -598,6 +598,333 @@ "@value": "Product" } ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "customers" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers/expects/request/parameter/parameter/count", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "count" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers/expects/request/parameter/parameter/count/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers/returns/response/default/union/default-union/anyOf/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/customers/returns/response/default/union/default-union/anyOf/array/default-array/shape/Customer", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Customer" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Customer" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Customer" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "products" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products/expects/request/parameter/parameter/count", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "count" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products/expects/request/parameter/parameter/count/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products/returns/response/default/union/default-union/anyOf/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Query/supportedOperation/products/returns/response/default/union/default-union/anyOf/array/default-array/shape/Product", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/non-root-optional-array/api.graphql#/declares/shape/Product" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Product" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Product" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] } ] } diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.resolved.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.resolved.jsonld index 88fd6120a6..7ddc9e26c0 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.resolved.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.resolved.jsonld @@ -477,6 +477,158 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,10)-(2,16)]" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/property/property/name/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/property/property/name/source-map/synthesized-field/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://www.w3.org/ns/shacl#minCount" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/property/property/name/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/property/property/name" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(2,4)-(2,16)]" + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ], + "http://a.ml/vocabularies/document-source-maps#sources": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/source-map", + "@type": [ + "http://a.ml/vocabularies/document-source-maps#SourceMap" + ], + "http://a.ml/vocabularies/document-source-maps#declared-element": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/source-map/declared-element/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "" + } + ] + } + ], + "http://a.ml/vocabularies/document-source-maps#lexical": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query/source-map/lexical/element_0", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/Query" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "[(1,0)-(3,1)]" + } + ] + } + ] + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/recursive-inheritance/simple.graphql#/declares/shape/A", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/non-root-type.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/non-root-type.jsonld index fdfcc938ea..0dc4a1dfdc 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/non-root-type.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/non-root-type.jsonld @@ -171,6 +171,59 @@ } ], "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/non-root-type.graphql#/declares/shape/Query", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/non-root-type.graphql#/declares/shape/Query/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/non-root-type.graphql#/declares/shape/Query/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Query" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/non-root-type.graphql#/declares/shape/Starship", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/root-type.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/root-type.jsonld index bc0f06b7aa..a5516eb788 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/root-type.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/root-type.jsonld @@ -254,6 +254,102 @@ } ] } + ], + "http://a.ml/vocabularies/document#declares": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/root-type.graphql#/declares/shape/Starship", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/root-type.graphql#/declares/shape/Starship/property/property/id", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/root-type.graphql#/declares/shape/Starship/property/property/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "id" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/root-type.graphql#/declares/shape/Starship/property/property/name", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/root-type/root-type.graphql#/declares/shape/Starship/property/property/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "name" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Starship" + } + ] + } ] } ] diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.jsonld index ac867f006f..8ba0291bf3 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.jsonld @@ -771,6 +771,317 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allPeople", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "allPeople" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Get all the people" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allPeople/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allPeople/expects/request/parameter/parameter/last", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "last" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Last parameter" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allPeople/expects/request/parameter/parameter/last/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allPeople/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allPeople/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allPeople/returns/response/default/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allPeople/returns/response/default/array/default-array/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Person" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Person" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "allAnimals" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals/expects/request/parameter/parameter/animalRequest", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "animalRequest" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals/expects/request/parameter/parameter/animalRequest/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/AnimalRequest" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "AnimalRequest" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals/returns/response/default/array/default-array", + "@type": [ + "http://a.ml/vocabularies/shapes#ArrayShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals/returns/response/default/array/default-array/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals/returns/response/default/array/default-array/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/CustomQuery/supportedOperation/allAnimals/returns/response/default/array/default-array/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Animal" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Animal" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "CustomQuery" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Person", "@type": [ @@ -1130,6 +1441,243 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Subscription", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#property": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Subscription/property/property/newPerson", + "@type": [ + "http://www.w3.org/ns/shacl#PropertyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#range": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Subscription/property/property/newPerson/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Person" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Person" + } + ] + } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 1 + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "newPerson" + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Subscription" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation/supportedOperation/createPerson", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "createPerson" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation/supportedOperation/createPerson/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation/supportedOperation/createPerson/expects/request/parameter/parameter/name", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "name" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation/supportedOperation/createPerson/expects/request/parameter/parameter/name/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation/supportedOperation/createPerson/expects/request/parameter/parameter/age", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "age" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation/supportedOperation/createPerson/expects/request/parameter/parameter/age/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation/supportedOperation/createPerson/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation/supportedOperation/createPerson/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Mutation/supportedOperation/createPerson/returns/response/default/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Person" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Person" + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Mutation" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "type documentation" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/api.graphql#/declares/shape/Animal", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/dumped.graphql b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/dumped.graphql index 0e4719b385..381c842814 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/dumped.graphql +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/dumped.graphql @@ -29,6 +29,19 @@ type Subscription { } union LivingThing = Person | Animal +type CustomQuery { + """ + Get all the people + """ + allPeople( + """ + Last parameter + """ + last: Int + ): [Person!]! + allAnimals(animalRequest: AnimalRequest): [Animal]! +} + type Person { name: String! age: Int! diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.jsonld b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.jsonld index f41b1eb3e9..4b447bc3e0 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.jsonld +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.jsonld @@ -5166,6 +5166,2882 @@ } ] }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#supportedOperation": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "allFilms" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/expects/request/parameter/parameter/after", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "after" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/expects/request/parameter/parameter/after/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/expects/request/parameter/parameter/first", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "first" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/expects/request/parameter/parameter/first/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/expects/request/parameter/parameter/before", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "before" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/expects/request/parameter/parameter/before/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/expects/request/parameter/parameter/last", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "last" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/expects/request/parameter/parameter/last/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allFilms/returns/response/default/union/default-union/anyOf/shape/FilmsConnection", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/FilmsConnection" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "FilmsConnection" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "FilmsConnection" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "film" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/expects/request/parameter/parameter/id", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "id" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/expects/request/parameter/parameter/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/expects/request/parameter/parameter/filmID", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "filmID" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/expects/request/parameter/parameter/filmID/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/film/returns/response/default/union/default-union/anyOf/shape/Film", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Film" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Film" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Film" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "allPeople" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/expects/request/parameter/parameter/after", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "after" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/expects/request/parameter/parameter/after/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/expects/request/parameter/parameter/first", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "first" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/expects/request/parameter/parameter/first/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/expects/request/parameter/parameter/before", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "before" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/expects/request/parameter/parameter/before/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/expects/request/parameter/parameter/last", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "last" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/expects/request/parameter/parameter/last/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPeople/returns/response/default/union/default-union/anyOf/shape/PeopleConnection", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/PeopleConnection" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "PeopleConnection" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "PeopleConnection" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "person" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/expects/request/parameter/parameter/id", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "id" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/expects/request/parameter/parameter/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/expects/request/parameter/parameter/personID", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "personID" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/expects/request/parameter/parameter/personID/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/person/returns/response/default/union/default-union/anyOf/shape/Person", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Person" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Person" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Person" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "allPlanets" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/expects/request/parameter/parameter/after", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "after" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/expects/request/parameter/parameter/after/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/expects/request/parameter/parameter/first", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "first" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/expects/request/parameter/parameter/first/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/expects/request/parameter/parameter/before", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "before" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/expects/request/parameter/parameter/before/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/expects/request/parameter/parameter/last", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "last" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/expects/request/parameter/parameter/last/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allPlanets/returns/response/default/union/default-union/anyOf/shape/PlanetsConnection", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/PlanetsConnection" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "PlanetsConnection" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "PlanetsConnection" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "planet" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/expects/request/parameter/parameter/id", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "id" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/expects/request/parameter/parameter/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/expects/request/parameter/parameter/planetID", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "planetID" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/expects/request/parameter/parameter/planetID/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/planet/returns/response/default/union/default-union/anyOf/shape/Planet", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Planet" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Planet" + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Planet" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "allSpecies" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/expects/request/parameter/parameter/after", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "after" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/expects/request/parameter/parameter/after/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/expects/request/parameter/parameter/first", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "first" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/expects/request/parameter/parameter/first/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/expects/request/parameter/parameter/before", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "before" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/expects/request/parameter/parameter/before/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/expects/request/parameter/parameter/last", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "last" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/expects/request/parameter/parameter/last/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allSpecies/returns/response/default/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/SpeciesConnection" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "SpeciesConnection" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "species" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/expects/request/parameter/parameter/id", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "id" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/expects/request/parameter/parameter/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/expects/request/parameter/parameter/speciesID", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "speciesID" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/expects/request/parameter/parameter/speciesID/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/species/returns/response/default/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Species" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Species" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "allStarships" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/expects/request/parameter/parameter/after", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "after" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/expects/request/parameter/parameter/after/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/expects/request/parameter/parameter/first", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "first" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/expects/request/parameter/parameter/first/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/expects/request/parameter/parameter/before", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "before" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/expects/request/parameter/parameter/before/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/expects/request/parameter/parameter/last", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "last" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/expects/request/parameter/parameter/last/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allStarships/returns/response/default/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/StarshipsConnection" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "StarshipsConnection" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "starship" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/expects/request/parameter/parameter/id", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "id" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/expects/request/parameter/parameter/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/expects/request/parameter/parameter/starshipID", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "starshipID" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/expects/request/parameter/parameter/starshipID/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/starship/returns/response/default/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Starship" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Starship" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "allVehicles" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/expects/request/parameter/parameter/after", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "after" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/expects/request/parameter/parameter/after/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/expects/request/parameter/parameter/first", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "first" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/expects/request/parameter/parameter/first/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/expects/request/parameter/parameter/before", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "before" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/expects/request/parameter/parameter/before/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#string" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/expects/request/parameter/parameter/last", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "last" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/expects/request/parameter/parameter/last/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#integer" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/allVehicles/returns/response/default/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/VehiclesConnection" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "VehiclesConnection" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "vehicle" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/expects/request/parameter/parameter/id", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "id" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/expects/request/parameter/parameter/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/expects/request/parameter/parameter/vehicleID", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "vehicleID" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": false + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/expects/request/parameter/parameter/vehicleID/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/vehicle/returns/response/default/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Vehicle" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Vehicle" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/node", + "@type": [ + "http://a.ml/vocabularies/shapes#Operation", + "http://a.ml/vocabularies/core#Operation", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "node" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "Fetches an object given its ID" + } + ], + "http://a.ml/vocabularies/shapes#expects": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/node/expects/request", + "@type": [ + "http://a.ml/vocabularies/shapes#Request", + "http://a.ml/vocabularies/core#Request", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#parameter": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/node/expects/request/parameter/parameter/id", + "@type": [ + "http://a.ml/vocabularies/shapes#Parameter", + "http://a.ml/vocabularies/core#Parameter", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "id" + } + ], + "http://a.ml/vocabularies/shapes#binding": [ + { + "@value": "query" + } + ], + "http://a.ml/vocabularies/core#description": [ + { + "@value": "The ID of an object" + } + ], + "http://a.ml/vocabularies/shapes#required": [ + { + "@value": true + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/node/expects/request/parameter/parameter/id/scalar/default-scalar", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://www.w3.org/ns/shacl#datatype": [ + { + "@id": "http://www.w3.org/2001/XMLSchema#anyType" + } + ], + "http://a.ml/vocabularies/shapes#format": [ + { + "@value": "ID" + } + ] + } + ] + } + ] + } + ], + "http://a.ml/vocabularies/shapes#returns": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/node/returns/response", + "@type": [ + "http://a.ml/vocabularies/shapes#Response", + "http://a.ml/vocabularies/core#Response", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#payload": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/node/returns/response/default", + "@type": [ + "http://a.ml/vocabularies/shapes#Payload", + "http://a.ml/vocabularies/core#Payload", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/core#name": [ + { + "@value": "default" + } + ], + "http://a.ml/vocabularies/shapes#schema": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/node/returns/response/default/union/default-union", + "@type": [ + "http://a.ml/vocabularies/shapes#UnionShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#anyOf": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/node/returns/response/default/union/default-union/anyOf/nil/default-nil", + "@type": [ + "http://a.ml/vocabularies/shapes#NilShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Root/supportedOperation/node/returns/response/default/union/default-union/anyOf/shape/default-node", + "@type": [ + "http://www.w3.org/ns/shacl#NodeShape", + "http://a.ml/vocabularies/shapes#AnyShape", + "http://www.w3.org/ns/shacl#Shape", + "http://a.ml/vocabularies/shapes#Shape", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/document#link-target": [ + { + "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/Node" + } + ], + "http://a.ml/vocabularies/document#link-label": [ + { + "@value": "Node" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "Root" + } + ] + }, { "@id": "file://amf-cli/shared/src/test/resources/upanddown/cycle/graphql/swapi/api.graphql#/declares/shape/FilmStarshipsEdge", "@type": [ diff --git a/amf-cli/shared/src/test/resources/upanddown/raml10/inline-prop-inheritance.raml.raml b/amf-cli/shared/src/test/resources/upanddown/raml10/inline-prop-inheritance.raml.raml index bb5b6d418b..e06c716eb4 100644 --- a/amf-cli/shared/src/test/resources/upanddown/raml10/inline-prop-inheritance.raml.raml +++ b/amf-cli/shared/src/test/resources/upanddown/raml10/inline-prop-inheritance.raml.raml @@ -36,4 +36,4 @@ types: a: type: string b: - type: string \ No newline at end of file + type: string diff --git a/amf-cli/shared/src/test/resources/validations/reports/graphql/sudden-eof.report b/amf-cli/shared/src/test/resources/validations/reports/graphql/sudden-eof.report index 9a3bd8a9f5..0dacf8b7c7 100644 --- a/amf-cli/shared/src/test/resources/validations/reports/graphql/sudden-eof.report +++ b/amf-cli/shared/src/test/resources/validations/reports/graphql/sudden-eof.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/validations/graphql/sudden-eof.graphql Profile: Conforms: false -Number of results: 3 +Number of results: 5 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-ast + Message: Missing name for field + Severity: Violation + Target: + Property: + Range: [(6,4)-(5,18)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-ast Message: Missing name for root type field Severity: Violation @@ -13,6 +21,14 @@ Level: Violation Range: [(6,4)-(5,18)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-ast + Message: Missing name for field + Severity: Violation + Target: + Property: + Range: [(6,4)-(6,38)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-ast Message: Missing name for root type field Severity: Violation diff --git a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/document/GraphQLBaseDocumentParser.scala b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/document/GraphQLBaseDocumentParser.scala index cc4071cde0..75aa9d3225 100644 --- a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/document/GraphQLBaseDocumentParser.scala +++ b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/document/GraphQLBaseDocumentParser.scala @@ -20,7 +20,7 @@ import amf.graphql.internal.spec.context.GraphQLBaseWebApiContext.RootTypes import amf.graphql.internal.spec.domain._ import amf.graphql.internal.spec.parser.syntax.GraphQLASTParserHelper import amf.graphql.internal.spec.parser.syntax.TokenTypes._ -import amf.shapes.client.scala.model.domain.{ScalarShape, UnionShape} +import amf.shapes.client.scala.model.domain.{NodeShape, ScalarShape, UnionShape} import org.mulesoft.antlrast.ast.{AST, ASTNode, Node, Terminal} case class GraphQLBaseDocumentParser(root: Root)(implicit val ctx: GraphQLBaseWebApiContext) @@ -89,8 +89,13 @@ case class GraphQLBaseDocumentParser(root: Root)(implicit val ctx: GraphQLBaseWe doc set root.location as BaseUnitModel.Location } - private def parseNestedType(objTypeDef: Node): Unit = { + private def makeVirtual(shape: NodeShape): Unit = { + val i = 5 + } + + private def parseNestedType(objTypeDef: Node, isVirtualRoot: Boolean = false): Unit = { val shape = new GraphQLNestedTypeParser(objTypeDef, isInterface = false).parse() + if (isVirtualRoot) makeVirtual(shape) addToDeclarations(shape) } @@ -164,8 +169,11 @@ case class GraphQLBaseDocumentParser(root: Root)(implicit val ctx: GraphQLBaseWe searchName(objTypeDef) match { case Some(typeName) => getRootType(typeName) match { - case Some(rootType) => parseTopLevelType(objTypeDef, rootType) - case None => parseNestedType(objTypeDef) + case Some(rootType) => + parseTopLevelType(objTypeDef, rootType) + // W-14608042: also parse root types as nested types for cyclic references inside root types + parseNestedType(objTypeDef, isVirtualRoot = true) + case None => parseNestedType(objTypeDef) } case _ => parseNestedType(objTypeDef) } diff --git a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/domain/GraphQLCommonTypeParser.scala b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/domain/GraphQLCommonTypeParser.scala index 669c99af53..9e7bd14dc4 100644 --- a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/domain/GraphQLCommonTypeParser.scala +++ b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/domain/GraphQLCommonTypeParser.scala @@ -19,11 +19,11 @@ trait GraphQLCommonTypeParser extends GraphQLASTParserHelper { collectNodes(objTypeNode, fieldsAstPath).foreach { fieldNode => GraphQLFieldParser(fieldNode, obj).parse { case Left(propertyShape: PropertyShape) => - val properties = obj.properties ++ Seq(propertyShape) + val properties = obj.properties :+ propertyShape obj set properties as NodeShapeModel.Properties case Right(shapeOperation: ShapeOperation) => - val operations = obj.operations ++ Seq(shapeOperation) + val operations = obj.operations :+ shapeOperation obj set operations as NodeShapeModel.Operations } } diff --git a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/domain/GraphQLOperationFieldParser.scala b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/domain/GraphQLOperationFieldParser.scala index d51570c0b0..d99eb44114 100644 --- a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/domain/GraphQLOperationFieldParser.scala +++ b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/domain/GraphQLOperationFieldParser.scala @@ -1,15 +1,24 @@ package amf.graphql.internal.spec.domain +import amf.core.client.scala.model.domain.AmfArray import amf.core.internal.parser.domain.Annotations.{synthesized, virtual} +import amf.core.internal.parser.domain.Fields import amf.graphql.internal.spec.context.GraphQLBaseWebApiContext import amf.graphql.internal.spec.document.GraphQLFieldSetter import amf.graphql.internal.spec.parser.syntax.TokenTypes._ import amf.graphql.internal.spec.parser.syntax.{GraphQLASTParserHelper, NullableShape} import amf.graphqlfederation.internal.spec.domain.{FederationMetadataParser, ShapeFederationMetadataFactory} import amf.shapes.client.scala.model.domain.AnyShape -import amf.shapes.client.scala.model.domain.operations.{ShapeOperation, ShapeParameter, ShapePayload} +import amf.shapes.client.scala.model.domain.operations.{ + ShapeOperation, + ShapeParameter, + ShapePayload, + ShapeRequest, + ShapeResponse +} import amf.shapes.internal.domain.metamodel.operations.{ AbstractPayloadModel, + ShapeOperationModel, ShapeParameterModel, ShapeRequestModel, ShapeResponseModel @@ -31,8 +40,8 @@ case class GraphQLOperationFieldParser(ast: Node)(implicit val ctx: GraphQLBaseW } private def parseArguments(): Unit = { - val request = operation.withRequest() - request.annotations ++= virtual() + val request = new ShapeRequest(Fields(), virtual()).withName("default") + operation set AmfArray(Seq(request), virtual()) as ShapeOperationModel.Request val arguments = collect(ast, Seq(ARGUMENTS_DEFINITION, INPUT_VALUE_DEFINITION)).map { case argument: Node => parseArgument(argument) @@ -70,8 +79,8 @@ case class GraphQLOperationFieldParser(ast: Node)(implicit val ctx: GraphQLBaseW } private def parseRange(): Unit = { - val response = operation.withResponse() - response.annotations ++= virtual() + val response = ShapeResponse(Fields(), virtual()).withName("default") + operation set AmfArray(Seq(response), virtual()) as ShapeOperationModel.Responses val payload = ShapePayload(virtual()).withName("default", synthesized()) payload set parseType(ast) as AbstractPayloadModel.Schema response set payload as ShapeResponseModel.Payload diff --git a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala index dd7408b46c..3f765d276f 100644 --- a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala +++ b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala @@ -1,7 +1,9 @@ package amf.graphql.internal.spec.emitter.document +import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils.rootTypes import amf.core.client.scala.model.document.{BaseUnit, Document} import amf.core.client.scala.model.domain.extensions.CustomDomainProperty +import amf.core.client.scala.parse.document.StringParsedDocument import amf.core.internal.plugins.syntax.StringDocBuilder import amf.graphql.internal.spec.emitter.context.GraphQLEmitterContext import amf.graphql.internal.spec.emitter.domain.{ @@ -62,9 +64,17 @@ class GraphQLDocumentEmitter(document: BaseUnit, builder: StringDocBuilder) exte } } + private def isRootType(shape: AnyShape, doc: StringDocBuilder): Boolean = { + val lines = doc.parsedDocument.asInstanceOf[StringParsedDocument].ast.lines.map(_._1) + if (lines.nonEmpty && lines.head.startsWith("schema")) { + lines.head.contains(shape.name.value()) + } else rootTypes.contains(shape.name.value()) + } + private def emitDeclarations(doc: StringDocBuilder): Unit = { document.asInstanceOf[Document].declares.foreach { - case shape: AnyShape => + // W-14608042: avoid rendering root types a second time, already emitted in emitTopLevelTypes() + case shape: AnyShape if !isRootType(shape, doc) => GraphQLTypeEmitter(shape, ctx, doc).emit() case directive: CustomDomainProperty if !isStandardDirective(directive) => GraphQLDirectiveDeclarationEmitter(directive, ctx, doc).emit() From fe772763c8de9bb6ba4f5c2b58dc6e07b8ae0261 Mon Sep 17 00:00:00 2001 From: arielmirra Date: Tue, 9 Jan 2024 15:10:06 -0300 Subject: [PATCH 10/33] W-14784356: simplify emission hack with ctx --- .../upanddown/cycle/graphql/simple/dumped.graphql | 13 ------------- .../emitter/document/GraphQLDocumentEmitter.scala | 11 +++++------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/dumped.graphql b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/dumped.graphql index 381c842814..0e4719b385 100644 --- a/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/dumped.graphql +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/graphql/simple/dumped.graphql @@ -29,19 +29,6 @@ type Subscription { } union LivingThing = Person | Animal -type CustomQuery { - """ - Get all the people - """ - allPeople( - """ - Last parameter - """ - last: Int - ): [Person!]! - allAnimals(animalRequest: AnimalRequest): [Animal]! -} - type Person { name: String! age: Int! diff --git a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala index 3f765d276f..4c25ce2b66 100644 --- a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala +++ b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala @@ -64,17 +64,16 @@ class GraphQLDocumentEmitter(document: BaseUnit, builder: StringDocBuilder) exte } } - private def isRootType(shape: AnyShape, doc: StringDocBuilder): Boolean = { - val lines = doc.parsedDocument.asInstanceOf[StringParsedDocument].ast.lines.map(_._1) - if (lines.nonEmpty && lines.head.startsWith("schema")) { - lines.head.contains(shape.name.value()) - } else rootTypes.contains(shape.name.value()) + private def isRootType(shape: AnyShape): Boolean = { + val shapeName = shape.name.value() + val rootNames = Seq(ctx.queryType, ctx.mutationType, ctx.subscriptionType).collect { case Some(root) => root.name } + rootNames.contains(shapeName) } private def emitDeclarations(doc: StringDocBuilder): Unit = { document.asInstanceOf[Document].declares.foreach { // W-14608042: avoid rendering root types a second time, already emitted in emitTopLevelTypes() - case shape: AnyShape if !isRootType(shape, doc) => + case shape: AnyShape if !isRootType(shape) => GraphQLTypeEmitter(shape, ctx, doc).emit() case directive: CustomDomainProperty if !isStandardDirective(directive) => GraphQLDirectiveDeclarationEmitter(directive, ctx, doc).emit() From b99c84e2c361bd19b4c182e1880bb10904c54e22 Mon Sep 17 00:00:00 2001 From: arielmirra Date: Tue, 23 Jan 2024 18:37:47 -0300 Subject: [PATCH 11/33] W-14784356: make validator pluggable in shacl validation --- .../validation/shacl/BaseShaclModelValidationPlugin.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/validation/shacl/BaseShaclModelValidationPlugin.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/validation/shacl/BaseShaclModelValidationPlugin.scala index b4b3aee329..54bb3620a5 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/validation/shacl/BaseShaclModelValidationPlugin.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/validation/shacl/BaseShaclModelValidationPlugin.scala @@ -23,7 +23,7 @@ trait BaseShaclModelValidationPlugin executionContext: ExecutionContext ): AMFValidationReport = { - val validator = new CustomShaclValidator(functions, profile.messageStyle) + val validator = getValidator val validations = withSemanticExtensionsConstraints(effectiveOrException(options.config, profile), options.config.constraints) @@ -31,6 +31,10 @@ trait BaseShaclModelValidationPlugin adaptToAmfReport(unit, profile, report, validations) } + protected def getValidator: CustomShaclValidator = { + new CustomShaclValidator(functions, profile.messageStyle) + } + protected val functions: CustomShaclFunctions } From deea4f40e1e57b60fc0843b28201f452adddaa5d Mon Sep 17 00:00:00 2001 From: arielmirra Date: Wed, 24 Jan 2024 10:51:44 -0300 Subject: [PATCH 12/33] W-14784356: remove isRootType (flaky check) --- .../validation/model/APIRawValidations.scala | 4 +- .../shacl/APICustomShaclFunctions.scala | 63 ++++++++++--------- .../GraphQLDirectiveLocationValidator.scala | 2 +- .../shacl/graphql/GraphQLUtils.scala | 7 +-- .../shacl/graphql/GraphQLValidator.scala | 8 +-- .../graphql/values/EnumValueValidator.scala | 17 +++-- .../graphql/values/ListValueValidator.scala | 15 ++--- .../values/NullableValueValidator.scala | 11 ++-- .../graphql/values/ObjectValueValidator.scala | 16 +++-- .../graphql/values/ScalarValueValidator.scala | 13 ++-- 10 files changed, 69 insertions(+), 87 deletions(-) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/model/APIRawValidations.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/model/APIRawValidations.scala index 7bdd9c7810..0561e3335d 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/model/APIRawValidations.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/model/APIRawValidations.scala @@ -1285,8 +1285,8 @@ object APIRawValidations extends CommonValidationDefinitions { ), AMFValidation( uri = amfParser("reserved-endpoints"), - owlClass = apiContract("EndPoint"), - owlProperty = apiContract("path"), + owlClass = apiContract("WebAPI"), + owlProperty = apiContract("EndPoints"), constraint = shape("reservedEndpoints"), message = "Endpoint is reserved by Federation" ) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/APICustomShaclFunctions.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/APICustomShaclFunctions.scala index 012c058e7d..11821bfc76 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/APICustomShaclFunctions.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/APICustomShaclFunctions.scala @@ -1,7 +1,7 @@ package amf.apicontract.internal.validation.shacl import amf.apicontract.client.scala.model.domain.{EndPoint, Request} -import amf.apicontract.client.scala.model.domain.api.Api +import amf.apicontract.client.scala.model.domain.api.{Api, WebApi} import amf.apicontract.client.scala.model.domain.security.{OAuth2Settings, OpenIdConnectSettings, SecurityScheme} import amf.apicontract.internal.metamodel.domain._ import amf.apicontract.internal.metamodel.domain.api.BaseApiModel @@ -88,28 +88,31 @@ object APICustomShaclFunctions extends BaseCustomShaclFunctions { new CustomShaclFunction { override val name: String = "reservedEndpoints" override def run(element: AmfObject, validate: Option[ValidationInfo] => Unit): Unit = { - val reserved = Set("_service", "_entities") - val endpoint = element.asInstanceOf[EndPoint] - endpoint.path - .option() - .map(_.stripPrefix("/query/").stripPrefix("/mutation/").stripPrefix("/subscription/")) - .flatMap { - case path if reserved.contains(path) => - val rootKind = { - val name = endpoint.name.value() - val end = name.indexOf(".") - name.substring(0, end) - } - Some( - ValidationInfo( - EndPointModel.Path, - Some(s"Cannot declare field '$path' in type $rootKind since it is reserved by Federation"), - Some(element.annotations) + val reserved = Set("_service", "_entities") + val api = element.asInstanceOf[WebApi] + val endpoints = api.endPoints + endpoints.foreach { endpoint => + endpoint.path + .option() + .map(_.stripPrefix("/query/").stripPrefix("/mutation/").stripPrefix("/subscription/")) + .flatMap { + case path if reserved.contains(path) => + val rootKind = { + val name = endpoint.name.value() + val end = name.indexOf(".") + name.substring(0, end) + } + Some( + ValidationInfo( + EndPointModel.Path, + Some(s"Cannot declare field '$path' in type $rootKind since it is reserved by Federation"), + Some(element.annotations) + ) ) - ) - case _ => None - } - .foreach(res => validate(Some(res))) + case _ => None + } + .foreach(res => validate(Some(res))) + } } }, new CustomShaclFunction { @@ -468,9 +471,12 @@ object APICustomShaclFunctions extends BaseCustomShaclFunctions { element match { case d: CustomDomainProperty => if (hasIntrospectionName(d)) validate(Some(ValidationInfo(CustomDomainPropertyModel.Name))) - case t: Shape => if (hasIntrospectionName(t)) validate(Some(ValidationInfo(AnyShapeModel.Name))) + case t: Shape => + if (hasIntrospectionName(t)) validate(Some(ValidationInfo(AnyShapeModel.Name))) case n: NamedDomainElement => - if (hasIntrospectionName(n)) validate(Some(ValidationInfo(NameFieldSchema.Name))) + if (hasIntrospectionName(n)) { + validate(Some(ValidationInfo(NameFieldSchema.Name))) + } case _ => // ignore } } @@ -766,13 +772,8 @@ object APICustomShaclFunctions extends BaseCustomShaclFunctions { private def isInvalidHttpHeaderName(name: String): Boolean = !name.matches("^[!#$%&'*+\\-.^_`|~0-9a-zA-Z]+$") - private def hasIntrospectionName(element: NamedDomainElement): Boolean = { - element.name.value() match { - case null => false - case name: String => - name.startsWith("__") && !GraphQLUtils.isInsideRootType(element) - } - } + private def hasIntrospectionName(element: NamedDomainElement): Boolean = + element.name.nonNull && element.name.value().startsWith("__") def checkDuplicates( s: Seq[NamedDomainElement], diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLDirectiveLocationValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLDirectiveLocationValidator.scala index 883b71377c..5702fbec40 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLDirectiveLocationValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLDirectiveLocationValidator.scala @@ -30,7 +30,7 @@ object GraphQLDirectiveLocationValidator { } yield { val expected = declaration.domain.map(_.value()) val isValidApplication = expected.contains(actual.iri.iri()) - (actual, isValidApplication || GraphQLUtils.isInsideRootType(element)) + (actual, isValidApplication) } result match { diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLUtils.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLUtils.scala index 281ed37a4f..81fbe4954e 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLUtils.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLUtils.scala @@ -16,6 +16,7 @@ object GraphQLUtils { } } + @tailrec def isValidInputType(schema: Shape): Boolean = { schema match { case a: ArrayShape => isValidInputType(a.items) @@ -34,10 +35,4 @@ object GraphQLUtils { case _ => true } } - - val rootTypes = Seq("Query", "Mutation", "Subscription") - - def isInsideRootType(obj: AmfObject): Boolean = { - obj.id.contains("declares/shape/") && rootTypes.map(root => obj.id.contains(root)).exists(b => b) - } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLValidator.scala index 3916b2e097..c25aa06952 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLValidator.scala @@ -207,7 +207,7 @@ object GraphQLValidator { if (!obj.isInput) { // fields from an output type can return anything except an input type (`input Foo {...}) val propertiesValidations = fields.properties.flatMap { prop => - if (!prop.isValidOutputType && !GraphQLUtils.isInsideRootType(obj.node)) { + if (!prop.isValidOutputType) { validationInfo( NodeShapeModel.Properties, s"Type '${getShapeName(prop.range)}' from field '${prop.name}' must be an output type", @@ -233,7 +233,7 @@ object GraphQLValidator { private def validateOperations(operations: Seq[GraphQLOperation]): Seq[ValidationInfo] = { operations.flatMap { op => - if (!op.isValidOutputType && !GraphQLUtils.isInsideRootType(op.operation)) { + if (!op.isValidOutputType) { validationInfo( NodeShapeModel.Properties, s"Type '${getShapeName(op.payload.get.schema)}' from field '${op.name}' must be an output type", @@ -257,7 +257,7 @@ object GraphQLValidator { private def validateProperties(properties: Seq[GraphQLProperty], obj: GraphQLObject): Seq[ValidationInfo] = { properties.flatMap { prop => - if (!prop.isValidInputType && obj.isInput && !GraphQLUtils.isInsideRootType(obj.node)) { + if (!prop.isValidInputType && obj.isInput) { val message = s"Type '${getShapeName(prop.range)}' from field '${prop.name}' must be an input type" validationInfo( NodeShapeModel.Properties, @@ -274,7 +274,7 @@ object GraphQLValidator { private def validateParameters(parameters: Seq[GraphQLParameter]): Seq[ValidationInfo] = { parameters.flatMap { param => - if (!param.isValidInputType && !GraphQLUtils.isInsideRootType(param.parameter)) { + if (!param.isValidInputType) { validationInfo( NodeShapeModel.Properties, s"Type '${getShapeName(param.schema)}' from argument '${param.name}' must be an input type", diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/EnumValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/EnumValueValidator.scala index 13f4721d45..3228560820 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/EnumValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/EnumValueValidator.scala @@ -1,7 +1,6 @@ package amf.apicontract.internal.validation.shacl.graphql.values import amf.apicontract.internal.validation.shacl.graphql.GraphQLDataTypes.friendlyName -import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils import amf.core.client.platform.model.DataTypes import amf.core.client.scala.model.domain.{ArrayNode, DataNode, ObjectNode, ScalarNode} import amf.core.internal.metamodel.Field @@ -10,14 +9,12 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object EnumValueValidator extends ValueValidator[ScalarShape] { override def validate(shape: ScalarShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - if (!GraphQLUtils.isInsideRootType(shape)) { - value match { - case s: ScalarNode => - validateDataType(s) ++ validateValueIsMember(shape, s) - case a: ArrayNode => Seq(typeError("scalar", "list", a.annotations)) - case o: ObjectNode => Seq(typeError("scalar", "object", o.annotations)) - } - } else Nil + value match { + case s: ScalarNode => + validateDataType(s) ++ validateValueIsMember(shape, s) + case a: ArrayNode => Seq(typeError("scalar", "list", a.annotations)) + case o: ObjectNode => Seq(typeError("scalar", "object", o.annotations)) + } } private def validateDataType(value: ScalarNode)(implicit targetField: Field): Seq[ValidationInfo] = { @@ -38,7 +35,7 @@ object EnumValueValidator extends ValueValidator[ScalarShape] { case _ => false } - if (isAccepted || GraphQLUtils.isInsideRootType(value)) { + if (isAccepted) { Nil } else { val enumName = shape.name.value() diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ListValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ListValueValidator.scala index 3c6f39b07c..76524fde98 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ListValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ListValueValidator.scala @@ -1,6 +1,5 @@ package amf.apicontract.internal.validation.shacl.graphql.values -import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils import amf.core.client.scala.model.domain.{ArrayNode, DataNode, ObjectNode, ScalarNode} import amf.core.internal.metamodel.Field import amf.shapes.client.scala.model.domain.ArrayShape @@ -8,14 +7,12 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object ListValueValidator extends ValueValidator[ArrayShape] { override def validate(shape: ArrayShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - if (!GraphQLUtils.isInsideRootType(shape)) { - value match { - case a: ArrayNode => validateItems(shape, a) - case s: ScalarNode if isNull(s) => Seq(typeError("list", "null", s.annotations)) - case s: ScalarNode => Seq(typeError("list", "scalar", s.annotations)) - case o: ObjectNode => Seq(typeError("list", "object", o.annotations)) - } - } else Nil + value match { + case a: ArrayNode => validateItems(shape, a) + case s: ScalarNode if isNull(s) => Seq(typeError("list", "null", s.annotations)) + case s: ScalarNode => Seq(typeError("list", "scalar", s.annotations)) + case o: ObjectNode => Seq(typeError("list", "object", o.annotations)) + } } private def validateItems(shape: ArrayShape, values: ArrayNode)(implicit targetField: Field): Seq[ValidationInfo] = { diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/NullableValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/NullableValueValidator.scala index bb138ad1de..3ce8f3a8ed 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/NullableValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/NullableValueValidator.scala @@ -1,6 +1,5 @@ package amf.apicontract.internal.validation.shacl.graphql.values -import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils import amf.core.client.scala.model.domain.{DataNode, ScalarNode} import amf.core.internal.metamodel.Field import amf.shapes.client.scala.model.domain.{NilShape, UnionShape} @@ -8,12 +7,10 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object NullableValueValidator extends ValueValidator[UnionShape] { override def validate(shape: UnionShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - if (!GraphQLUtils.isInsideRootType(shape)) { - value match { - case s: ScalarNode if isNull(s) => Nil - case value => validateNonNullValue(shape, value) - } - } else Nil + value match { + case s: ScalarNode if isNull(s) => Nil + case value => validateNonNullValue(shape, value) + } } private def validateNonNullValue(shape: UnionShape, other: DataNode)(implicit diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ObjectValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ObjectValueValidator.scala index 319e08db48..4eb41edc73 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ObjectValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ObjectValueValidator.scala @@ -1,6 +1,6 @@ package amf.apicontract.internal.validation.shacl.graphql.values -import amf.apicontract.internal.validation.shacl.graphql.{GraphQLProperty, GraphQLUtils} +import amf.apicontract.internal.validation.shacl.graphql.GraphQLProperty import amf.core.client.scala.model.domain.extensions.PropertyShape import amf.core.client.scala.model.domain.{ArrayNode, DataNode, ObjectNode, ScalarNode} import amf.core.internal.metamodel.Field @@ -10,14 +10,12 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object ObjectValueValidator extends ValueValidator[NodeShape] { override def validate(shape: NodeShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - if (!GraphQLUtils.isInsideRootType(shape)) { - value match { - case s: ScalarNode if isNull(s) => Seq(typeError("object", "null", s.annotations)) - case s: ScalarNode => Seq(typeError("object", "scalar", s.annotations)) - case a: ArrayNode => Seq(typeError("object", "list", a.annotations)) - case o: ObjectNode => validateProperties(shape, o) - } - } else Nil + value match { + case s: ScalarNode if isNull(s) => Seq(typeError("object", "null", s.annotations)) + case s: ScalarNode => Seq(typeError("object", "scalar", s.annotations)) + case a: ArrayNode => Seq(typeError("object", "list", a.annotations)) + case o: ObjectNode => validateProperties(shape, o) + } } sealed case class ReportingInfo(shapeName: String, annotations: Annotations) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ScalarValueValidator.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ScalarValueValidator.scala index ea3d86b2c8..325e27ec24 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ScalarValueValidator.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/values/ScalarValueValidator.scala @@ -1,7 +1,6 @@ package amf.apicontract.internal.validation.shacl.graphql.values import amf.apicontract.internal.validation.shacl.graphql.GraphQLDataTypes.friendlyName -import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils import amf.core.client.platform.model.DataTypes import amf.core.client.scala.model.domain.{ArrayNode, DataNode, ObjectNode, ScalarNode} import amf.core.internal.metamodel.Field @@ -10,13 +9,11 @@ import amf.validation.internal.shacl.custom.CustomShaclValidator.ValidationInfo object ScalarValueValidator extends ValueValidator[ScalarShape] { override def validate(shape: ScalarShape, value: DataNode)(implicit targetField: Field): Seq[ValidationInfo] = { - if (!GraphQLUtils.isInsideRootType(shape)) { - value match { - case s: ScalarNode => validateDataType(shape, s) - case a: ArrayNode => Seq(typeError("scalar", "list", a.annotations)) - case o: ObjectNode => Seq(typeError("scalar", "object", o.annotations)) - } - } else Nil + value match { + case s: ScalarNode => validateDataType(shape, s) + case a: ArrayNode => Seq(typeError("scalar", "list", a.annotations)) + case o: ObjectNode => Seq(typeError("scalar", "object", o.annotations)) + } } private def validateDataType(shape: ScalarShape, value: ScalarNode)(implicit From 9e6365623ede8cd86c291c97be1b3fa01608b8df Mon Sep 17 00:00:00 2001 From: arielmirra Date: Wed, 24 Jan 2024 10:57:32 -0300 Subject: [PATCH 13/33] W-14784356: add GraphQL iterator strategy - create a graphql shacl validation plugin - plug it to graphql & federation configurations --- .../shacl/graphql/GraphQLFieldsFilter.scala | 22 +++++++++++ .../graphql/GraphQLIteratorStrategy.scala | 15 ++++++++ .../GraphQLShaclModelValidationPlugin.scala | 37 +++++++++++++++++++ .../client/scala/GraphQLConfiguration.scala | 6 +-- .../document/GraphQLDocumentEmitter.scala | 2 - .../GraphQLFederationConfiguration.scala | 4 +- 6 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLFieldsFilter.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLIteratorStrategy.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLShaclModelValidationPlugin.scala diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLFieldsFilter.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLFieldsFilter.scala new file mode 100644 index 0000000000..4e76a5f8a4 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLFieldsFilter.scala @@ -0,0 +1,22 @@ +package amf.apicontract.internal.validation.shacl.graphql + +import amf.apicontract.internal.metamodel.domain.EndPointModel +import amf.apicontract.internal.metamodel.domain.api.WebApiModel +import amf.core.client.scala.model.document.FieldsFilter +import amf.core.client.scala.model.domain.AmfElement +import amf.core.internal.metamodel.document.DocumentModel +import amf.core.internal.parser.domain.{FieldEntry, Fields} + +/** Scope does not include external references (like FieldsFilter.Local) and also removes endpoints to avoid validating + * them twice in graphql (because they are also parsed as types) + */ +object GraphQLFieldsFilter extends FieldsFilter { + + override def filter(fields: Fields): List[AmfElement] = + fields + .fields() + .filter(_.field != DocumentModel.References) // remove external refs + .filter(_.field != WebApiModel.EndPoints) // remove endpoints + .map(_.element) + .toList +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLIteratorStrategy.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLIteratorStrategy.scala new file mode 100644 index 0000000000..527736cd8b --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLIteratorStrategy.scala @@ -0,0 +1,15 @@ +package amf.apicontract.internal.validation.shacl.graphql + +import amf.core.client.scala.model.domain.AmfElement +import amf.core.client.scala.traversal.iterator.{ + AmfIterator, + DomainElementIterator, + IdCollector, + IteratorStrategy, + VisitedCollector +} + +object GraphQLIteratorStrategy extends IteratorStrategy { + override def iterator(elements: List[AmfElement], visited: VisitedCollector = IdCollector()): AmfIterator = + DomainElementIterator.withFilter(elements, visited, GraphQLFieldsFilter) +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLShaclModelValidationPlugin.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLShaclModelValidationPlugin.scala new file mode 100644 index 0000000000..a125589b1f --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/validation/shacl/graphql/GraphQLShaclModelValidationPlugin.scala @@ -0,0 +1,37 @@ +package amf.apicontract.internal.validation.shacl.graphql + +import amf.apicontract.internal.validation.plugin.BaseApiValidationPlugin +import amf.apicontract.internal.validation.shacl.APICustomShaclFunctions +import amf.core.client.common.validation.{ProfileName, ProfileNames} +import amf.core.client.common.{HighPriority, PluginPriority} +import amf.core.client.scala.model.document.BaseUnit +import amf.core.client.scala.validation.AMFValidationReport +import amf.core.internal.plugins.validation.ValidationOptions +import amf.shapes.internal.validation.shacl.BaseShaclModelValidationPlugin +import amf.validation.internal.shacl.custom.CustomShaclValidator +import amf.validation.internal.shacl.custom.CustomShaclValidator.CustomShaclFunctions + +import scala.concurrent.{ExecutionContext, Future} + +case class GraphQLShaclModelValidationPlugin(override val profile: ProfileName = ProfileNames.GRAPHQL) + extends BaseShaclModelValidationPlugin + with BaseApiValidationPlugin { + + override val id: String = this.getClass.getSimpleName + + override def priority: PluginPriority = HighPriority + + override protected def getValidator: CustomShaclValidator = { + new CustomShaclValidator( + functions, + profile.messageStyle, + strategy = GraphQLIteratorStrategy + ) + } + + override protected def specificValidate(unit: BaseUnit, options: ValidationOptions)(implicit + executionContext: ExecutionContext + ): Future[AMFValidationReport] = Future(validateWithShacl(unit, options: ValidationOptions)) + + override protected val functions: CustomShaclFunctions = APICustomShaclFunctions.functions +} diff --git a/amf-graphql/shared/src/main/scala/amf/graphql/client/scala/GraphQLConfiguration.scala b/amf-graphql/shared/src/main/scala/amf/graphql/client/scala/GraphQLConfiguration.scala index 2bde9d7361..a85cf386c3 100644 --- a/amf-graphql/shared/src/main/scala/amf/graphql/client/scala/GraphQLConfiguration.scala +++ b/amf-graphql/shared/src/main/scala/amf/graphql/client/scala/GraphQLConfiguration.scala @@ -10,8 +10,8 @@ import amf.apicontract.client.scala.{AMFConfiguration, APIConfigurationBuilder} import amf.apicontract.internal.transformation.{GraphQLCachePipeline, GraphQLEditingPipeline} import amf.apicontract.internal.validation.model.ApiEffectiveValidations.GraphQLEffectiveValidations import amf.apicontract.internal.validation.model.ApiValidationProfiles.GraphQLValidationProfile -import amf.apicontract.internal.validation.shacl.APIShaclModelValidationPlugin -import amf.core.client.common.validation.{ProfileNames, SeverityLevels} +import amf.apicontract.internal.validation.shacl.graphql.GraphQLShaclModelValidationPlugin +import amf.core.client.common.validation.SeverityLevels import amf.core.internal.remote.Spec import amf.graphql.internal.spec.plugins.parse.GraphQLParsePlugin import amf.graphql.internal.spec.plugins.render.GraphQLRenderPlugin @@ -26,7 +26,7 @@ object GraphQLConfiguration extends APIConfigurationBuilder { GraphQLSyntaxParsePlugin, GraphQLRenderPlugin, AntlrSyntaxRenderPlugin, - APIShaclModelValidationPlugin(ProfileNames.GRAPHQL) + GraphQLShaclModelValidationPlugin() ) ) .withTransformationPipelines( diff --git a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala index 4c25ce2b66..6a3f9faf98 100644 --- a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala +++ b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/emitter/document/GraphQLDocumentEmitter.scala @@ -1,9 +1,7 @@ package amf.graphql.internal.spec.emitter.document -import amf.apicontract.internal.validation.shacl.graphql.GraphQLUtils.rootTypes import amf.core.client.scala.model.document.{BaseUnit, Document} import amf.core.client.scala.model.domain.extensions.CustomDomainProperty -import amf.core.client.scala.parse.document.StringParsedDocument import amf.core.internal.plugins.syntax.StringDocBuilder import amf.graphql.internal.spec.emitter.context.GraphQLEmitterContext import amf.graphql.internal.spec.emitter.domain.{ diff --git a/amf-graphql/shared/src/main/scala/amf/graphqlfederation/client/scala/GraphQLFederationConfiguration.scala b/amf-graphql/shared/src/main/scala/amf/graphqlfederation/client/scala/GraphQLFederationConfiguration.scala index 184b5e64a0..e92c808fe2 100644 --- a/amf-graphql/shared/src/main/scala/amf/graphqlfederation/client/scala/GraphQLFederationConfiguration.scala +++ b/amf-graphql/shared/src/main/scala/amf/graphqlfederation/client/scala/GraphQLFederationConfiguration.scala @@ -10,7 +10,7 @@ import amf.apicontract.client.scala.{AMFConfiguration, APIConfigurationBuilder} import amf.apicontract.internal.transformation.{GraphQLCachePipeline, GraphQLEditingPipeline} import amf.apicontract.internal.validation.model.ApiEffectiveValidations.GraphQLFederationEffectiveValidations import amf.apicontract.internal.validation.model.ApiValidationProfiles.GraphQLFederationValidationProfile -import amf.apicontract.internal.validation.shacl.APIShaclModelValidationPlugin +import amf.apicontract.internal.validation.shacl.graphql.GraphQLShaclModelValidationPlugin import amf.core.client.common.validation.{ProfileNames, SeverityLevels} import amf.core.internal.remote.Spec import amf.graphqlfederation.internal.plugins.GraphQLFederationParsePlugin @@ -27,7 +27,7 @@ object GraphQLFederationConfiguration extends APIConfigurationBuilder { GraphQLFederationSyntaxParsePlugin, // GraphQLRenderPlugin, AntlrSyntaxRenderPlugin, - APIShaclModelValidationPlugin(ProfileNames.GRAPHQL_FEDERATION) + GraphQLShaclModelValidationPlugin(ProfileNames.GRAPHQL_FEDERATION) ) ) .withTransformationPipelines( From 68870871f6a4c9bdfb184888c04efa791d9fe5d1 Mon Sep 17 00:00:00 2001 From: arielmirra Date: Wed, 24 Jan 2024 10:58:45 -0300 Subject: [PATCH 14/33] W-14784356: graphql validation: apply changes to reports - target changes from endpoint to shape - directives are validated better --- .../apis/invalid/federation-reserved.report | 32 +++++++++---------- .../introspection-root.api.federation.report | 10 +++--- .../invalid/introspection-root.api.report | 10 +++--- ...ype-object-arguments.api.federation.report | 12 +++---- ...not-input-type-object-arguments.api.report | 12 +++---- ...ut-type-query-fields.api.federation.report | 12 +++---- ...is-not-output-type-query-fields.api.report | 12 +++---- ...ve-location-argument.api.federation.report | 10 +++++- ...ong-directive-location-argument.api.report | 2 +- ...-location-enum-value.api.federation.report | 10 +++++- ...g-directive-location-enum-value.api.report | 2 +- ...ective-location-enum.api.federation.report | 10 +++++- .../wrong-directive-location-enum.api.report | 2 +- ...ocation-input-fields.api.federation.report | 10 +++++- ...directive-location-input-fields.api.report | 2 +- ...ctive-location-input.api.federation.report | 10 +++++- .../wrong-directive-location-input.api.report | 2 +- ...e-location-interface.api.federation.report | 10 +++++- ...ng-directive-location-interface.api.report | 2 +- ...tive-location-object.api.federation.report | 10 +++++- ...wrong-directive-location-object.api.report | 2 +- ...tive-location-scalar.api.federation.report | 10 +++++- ...wrong-directive-location-scalar.api.report | 2 +- ...tive-location-schema.api.federation.report | 10 +++++- ...wrong-directive-location-schema.api.report | 2 +- ...ctive-location-union.api.federation.report | 10 +++++- .../wrong-directive-location-union.api.report | 2 +- .../graphql/invalid-default-value-enum.report | 2 +- .../invalid-default-value-parameters.report | 2 +- 29 files changed, 152 insertions(+), 72 deletions(-) diff --git a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/invalid/federation-reserved.report b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/invalid/federation-reserved.report index d45ccee100..670427c5bf 100644 --- a/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/invalid/federation-reserved.report +++ b/amf-cli/shared/src/test/resources/graphql-federation/tck/apis/invalid/federation-reserved.report @@ -5,6 +5,22 @@ Number of results: 9 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#reserved-endpoints + Message: Cannot declare field '_entities' in type Query since it is reserved by Federation + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/invalid/federation-reserved.graphql#/web-api + Property: http://a.ml/vocabularies/apiContract#path + Range: + Location: + +- Constraint: http://a.ml/vocabularies/amf/parser#reserved-endpoints + Message: Cannot declare field '_service' in type Query since it is reserved by Federation + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/invalid/federation-reserved.graphql#/web-api + Property: http://a.ml/vocabularies/apiContract#path + Range: + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#reserved-type-names Message: Cannot declare scalar with name '_Any' since it is reserved by Federation Severity: Violation @@ -60,19 +76,3 @@ Level: Violation Property: http://www.w3.org/ns/shacl#name Range: [(12,0)-(14,1)] Location: - -- Constraint: http://a.ml/vocabularies/amf/parser#reserved-endpoints - Message: Cannot declare field '_entities' in type Query since it is reserved by Federation - Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/invalid/federation-reserved.graphql#/web-api/endpoint/%2Fquery%2F_entities - Property: http://a.ml/vocabularies/apiContract#path - Range: [(17,4)-(17,52)] - Location: - -- Constraint: http://a.ml/vocabularies/amf/parser#reserved-endpoints - Message: Cannot declare field '_service' in type Query since it is reserved by Federation - Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql-federation/tck/apis/invalid/federation-reserved.graphql#/web-api/endpoint/%2Fquery%2F_service - Property: http://a.ml/vocabularies/apiContract#path - Range: [(18,4)-(18,23)] - Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.federation.report index fb328e57d4..33c6a48043 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.federation.report @@ -8,15 +8,15 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#DomainElement-name-invalidIntrospectionName Message: Name must not begin with '__' as this is used exclusively by GraphQL’s introspection system Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/web-api/endpoint/%2Fquery%2F__string - Property: http://a.ml/vocabularies/core#name - Range: [(6,4)-(6,12)] + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/declares/shape/__Query + Property: http://www.w3.org/ns/shacl#name + Range: [(5,5)-(5,12)] Location: - Constraint: http://a.ml/vocabularies/amf/parser#DomainElement-name-invalidIntrospectionName Message: Name must not begin with '__' as this is used exclusively by GraphQL’s introspection system Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/web-api/endpoint/%2Fquery%2F__string/supportedOperation/query/__Query.__string + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/declares/shape/__Query/supportedOperation/__string Property: http://a.ml/vocabularies/core#name Range: [(6,4)-(6,12)] Location: @@ -24,7 +24,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#DomainElement-name-invalidIntrospectionName Message: Name must not begin with '__' as this is used exclusively by GraphQL’s introspection system Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/web-api/endpoint/%2Fquery%2F__string/supportedOperation/query/__Query.__string/expects/request/parameter/parameter/query/__arg + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/declares/shape/__Query/supportedOperation/__string/expects/request/parameter/parameter/__arg Property: http://a.ml/vocabularies/core#name Range: [(6,13)-(6,18)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.report index fb328e57d4..33c6a48043 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.report @@ -8,15 +8,15 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#DomainElement-name-invalidIntrospectionName Message: Name must not begin with '__' as this is used exclusively by GraphQL’s introspection system Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/web-api/endpoint/%2Fquery%2F__string - Property: http://a.ml/vocabularies/core#name - Range: [(6,4)-(6,12)] + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/declares/shape/__Query + Property: http://www.w3.org/ns/shacl#name + Range: [(5,5)-(5,12)] Location: - Constraint: http://a.ml/vocabularies/amf/parser#DomainElement-name-invalidIntrospectionName Message: Name must not begin with '__' as this is used exclusively by GraphQL’s introspection system Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/web-api/endpoint/%2Fquery%2F__string/supportedOperation/query/__Query.__string + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/declares/shape/__Query/supportedOperation/__string Property: http://a.ml/vocabularies/core#name Range: [(6,4)-(6,12)] Location: @@ -24,7 +24,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#DomainElement-name-invalidIntrospectionName Message: Name must not begin with '__' as this is used exclusively by GraphQL’s introspection system Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/web-api/endpoint/%2Fquery%2F__string/supportedOperation/query/__Query.__string/expects/request/parameter/parameter/query/__arg + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/introspection-root.api.graphql#/declares/shape/__Query/supportedOperation/__string/expects/request/parameter/parameter/__arg Property: http://a.ml/vocabularies/core#name Range: [(6,13)-(6,18)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.federation.report index 05705eee7d..649132bfb4 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.federation.report @@ -5,26 +5,26 @@ Number of results: 3 Level: Violation -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type-in-endpoint +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type Message: Type 'Object1' from argument 'input_' must be an input type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/web-api/endpoint/%2Fquery%2FobjectArgument + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(7,19)-(7,34)] Location: -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type-in-endpoint +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type Message: Type 'Interface' from argument 'input_' must be an input type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/web-api/endpoint/%2Fquery%2FinterfaceArgument + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(8,22)-(8,39)] Location: -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type-in-endpoint +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type Message: Type 'Union' from argument 'input_' must be an input type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/web-api/endpoint/%2Fquery%2FunionArgument + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(9,18)-(9,31)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.report index 05705eee7d..649132bfb4 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.report @@ -5,26 +5,26 @@ Number of results: 3 Level: Violation -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type-in-endpoint +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type Message: Type 'Object1' from argument 'input_' must be an input type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/web-api/endpoint/%2Fquery%2FobjectArgument + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(7,19)-(7,34)] Location: -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type-in-endpoint +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type Message: Type 'Interface' from argument 'input_' must be an input type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/web-api/endpoint/%2Fquery%2FinterfaceArgument + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(8,22)-(8,39)] Location: -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type-in-endpoint +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-input-type Message: Type 'Union' from argument 'input_' must be an input type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/web-api/endpoint/%2Fquery%2FunionArgument + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-input-type-object-arguments.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(9,18)-(9,31)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.federation.report index 1c234e5ad9..75402c1375 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.federation.report @@ -5,18 +5,18 @@ Number of results: 2 Level: Violation -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-output-type-in-endpoint - Message: Type 'InputType' from field 'Query.inputReturnField' must be an output type +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-output-type + Message: Type 'InputType' from field 'inputReturnField' must be an output type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.graphql#/web-api/endpoint/%2Fquery%2FinputReturnField + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(6,4)-(6,31)] Location: -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-output-type-in-endpoint - Message: Type '[InputType]' from field 'Query.inputReturnFieldArray' must be an output type +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-output-type + Message: Type '[InputType]' from field 'inputReturnFieldArray' must be an output type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.graphql#/web-api/endpoint/%2Fquery%2FinputReturnFieldArray + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(7,4)-(7,38)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.report index 1c234e5ad9..75402c1375 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.report @@ -5,18 +5,18 @@ Number of results: 2 Level: Violation -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-output-type-in-endpoint - Message: Type 'InputType' from field 'Query.inputReturnField' must be an output type +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-output-type + Message: Type 'InputType' from field 'inputReturnField' must be an output type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.graphql#/web-api/endpoint/%2Fquery%2FinputReturnField + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(6,4)-(6,31)] Location: -- Constraint: http://a.ml/vocabularies/amf/parser#invalid-output-type-in-endpoint - Message: Type '[InputType]' from field 'Query.inputReturnFieldArray' must be an output type +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-output-type + Message: Type '[InputType]' from field 'inputReturnFieldArray' must be an output type Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.graphql#/web-api/endpoint/%2Fquery%2FinputReturnFieldArray + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/is-not-output-type-query-fields.api.graphql#/declares/shape/Query Property: http://www.w3.org/ns/shacl#property Range: [(7,4)-(7,38)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.federation.report index ae0ce1ae47..164c212116 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.federation.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.graphql Profile: GraphQL Conforms: false -Number of results: 11 +Number of results: 12 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: [(1,7)-(1,19)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to SCALAR 'MyScalar' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.report index 63dc355e92..164c212116 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.report @@ -16,7 +16,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-argument.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.federation.report index ca33a3f940..10b21533f9 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.federation.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.graphql Profile: GraphQL Conforms: false -Number of results: 12 +Number of results: 13 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: [(1,7)-(1,19)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to SCALAR 'MyScalar' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.report index a5b4797c22..10b21533f9 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.report @@ -16,7 +16,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum-value.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.federation.report index 977b707516..8e0f2b5bc5 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.federation.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.graphql Profile: GraphQL Conforms: false -Number of results: 12 +Number of results: 13 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: [(1,7)-(1,19)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to SCALAR 'MyScalar' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.report index d4bfc99d9b..8e0f2b5bc5 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.report @@ -16,7 +16,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-enum.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.federation.report index 8df8d6f0c8..afff9be926 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.federation.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.graphql Profile: GraphQL Conforms: false -Number of results: 12 +Number of results: 13 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: [(1,7)-(1,19)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to SCALAR 'MyScalar' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.report index ba4823acfa..afff9be926 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.report @@ -16,7 +16,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input-fields.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.federation.report index ae9461b160..dde6a482e5 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.federation.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.graphql Profile: GraphQL Conforms: false -Number of results: 12 +Number of results: 13 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: [(1,7)-(1,19)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to SCALAR 'MyScalar' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.report index 1087b901ec..dde6a482e5 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.report @@ -16,7 +16,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-input.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.federation.report index 6c01e0be10..ce5b72c4a6 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.federation.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.graphql Profile: GraphQL Conforms: false -Number of results: 12 +Number of results: 13 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: [(1,7)-(1,19)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to SCALAR 'MyScalar' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.report index 941c9eb3e2..ce5b72c4a6 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.report @@ -16,7 +16,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-interface.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.federation.report index d1ae8e56eb..8bc337f49b 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.federation.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.graphql Profile: GraphQL Conforms: false -Number of results: 12 +Number of results: 13 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: [(1,7)-(1,19)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to SCALAR 'MyScalar' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.report index f6665678f6..8bc337f49b 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.report @@ -16,7 +16,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-object.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.federation.report index 541e8dd6dc..2938d577ea 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.federation.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.graphql Profile: GraphQL Conforms: false -Number of results: 12 +Number of results: 13 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: [(1,7)-(1,19)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to OBJECT 'MyObject' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.report index deff633412..2938d577ea 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.report @@ -16,7 +16,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-scalar.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.federation.report index 9aac0471b5..549dc3a4c2 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.federation.report @@ -1,10 +1,18 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.graphql Profile: GraphQL Conforms: false -Number of results: 12 +Number of results: 13 Level: Violation +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to SCALAR 'MyScalar' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.report index f565a4c5f3..549dc3a4c2 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.report @@ -8,7 +8,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-schema.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.federation.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.federation.report index 77ae1a63d8..5f52468d26 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.federation.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.federation.report @@ -1,7 +1,7 @@ ModelId: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.graphql Profile: GraphQL Conforms: false -Number of results: 12 +Number of results: 13 Level: Violation @@ -13,6 +13,14 @@ Level: Violation Range: [(1,7)-(1,19)] Location: +- Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application + Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' + Severity: Violation + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.graphql#/declares/shape/Query/property/property/name + Property: http://a.ml/vocabularies/document#customDomainProperties + Range: [(6,17)-(6,29)] + Location: + - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to SCALAR 'MyScalar' Severity: Violation diff --git a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.report b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.report index 95cfddba26..5f52468d26 100644 --- a/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.report +++ b/amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.report @@ -16,7 +16,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-directive-application Message: Directive 'MyDirective' cannot be applied to FIELD_DEFINITION 'name' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.graphql#/web-api/endpoint/%2Fquery%2Fname + Target: file://amf-cli/shared/src/test/resources/graphql/tck/apis/invalid/wrong-directive-location-union.api.graphql#/declares/shape/Query/property/property/name Property: http://a.ml/vocabularies/document#customDomainProperties Range: [(6,17)-(6,29)] Location: diff --git a/amf-cli/shared/src/test/resources/validations/reports/graphql/invalid-default-value-enum.report b/amf-cli/shared/src/test/resources/validations/reports/graphql/invalid-default-value-enum.report index 2522bd54c9..6f8b548918 100644 --- a/amf-cli/shared/src/test/resources/validations/reports/graphql/invalid-default-value-enum.report +++ b/amf-cli/shared/src/test/resources/validations/reports/graphql/invalid-default-value-enum.report @@ -8,7 +8,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-default-value-type-parameter Message: Value 'C' is not a member of enum 'Alternative' Severity: Violation - Target: file://amf-cli/shared/src/test/resources/validations/graphql/invalid-default-value-enum.graphql#/web-api/endpoint/%2Fquery%2Fname/supportedOperation/query/Query.name/expects/request/parameter/parameter/query/myQueryParam + Target: file://amf-cli/shared/src/test/resources/validations/graphql/invalid-default-value-enum.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/myQueryParam Property: http://a.ml/vocabularies/core#defaultValue Range: [(6,37)-(6,38)] Location: diff --git a/amf-cli/shared/src/test/resources/validations/reports/graphql/invalid-default-value-parameters.report b/amf-cli/shared/src/test/resources/validations/reports/graphql/invalid-default-value-parameters.report index c33d23d270..b5a7b43b1d 100644 --- a/amf-cli/shared/src/test/resources/validations/reports/graphql/invalid-default-value-parameters.report +++ b/amf-cli/shared/src/test/resources/validations/reports/graphql/invalid-default-value-parameters.report @@ -8,7 +8,7 @@ Level: Violation - Constraint: http://a.ml/vocabularies/amf/parser#invalid-default-value-type-parameter Message: Expecting 'Boolean' value but got 'String' value instead Severity: Violation - Target: file://amf-cli/shared/src/test/resources/validations/graphql/invalid-default-value-parameters.graphql#/web-api/endpoint/%2Fquery%2Fname/supportedOperation/query/Query.name/expects/request/parameter/parameter/query/myQueryParam + Target: file://amf-cli/shared/src/test/resources/validations/graphql/invalid-default-value-parameters.graphql#/declares/shape/Query/supportedOperation/name/expects/request/parameter/parameter/myQueryParam Property: http://a.ml/vocabularies/core#defaultValue Range: [(6,31)-(6,40)] Location: From 354426946279f66a3b39d525e0e30cafd4fc53ae Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 29 Jan 2024 09:33:37 -0300 Subject: [PATCH 15/33] W-14875628 (refactor): extracted async declaration parsing to separate class --- .../document/AsyncApiDeclarationParser.scala | 217 ++++++++++++++++++ .../document/AsyncApiDocumentParser.scala | 191 +-------------- 2 files changed, 227 insertions(+), 181 deletions(-) create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala new file mode 100644 index 0000000000..12a736cb0c --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala @@ -0,0 +1,217 @@ +package amf.apicontract.internal.spec.async.parser.document + +import amf.aml.internal.parse.common.{DeclarationKey, DeclarationKeyCollector} +import amf.apicontract.client.scala.model.domain.{Operation, Parameter} +import amf.apicontract.client.scala.model.domain.bindings.{ + ChannelBindings, + MessageBindings, + OperationBindings, + ServerBindings +} +import amf.apicontract.internal.metamodel.domain.bindings.{ + ChannelBindingsModel, + MessageBindingsModel, + OperationBindingsModel, + ServerBindingsModel +} +import amf.apicontract.internal.metamodel.domain.security.SecuritySchemeModel +import amf.apicontract.internal.spec.async.parser.bindings.{ + AsyncChannelBindingsParser, + AsyncMessageBindingsParser, + AsyncOperationBindingsParser, + AsyncServerBindingsParser +} +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.async.parser.domain.{ + AsyncCorrelationIdParser, + AsyncMessageParser, + AsyncOperationParser, + AsyncParametersParser +} +import amf.apicontract.internal.spec.oas.parser.document.OasLikeDeclarationsHelper +import amf.core.client.scala.model.domain.{AmfObject, AmfScalar, DomainElement} +import amf.core.internal.annotations.DeclaredElement +import amf.core.internal.metamodel.domain.DomainElementModel +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import amf.shapes.internal.spec.common.parser.YMapEntryLike +import org.yaml.model.{YMap, YMapEntry} + +case class AsyncApiDeclarationParser(override val definitionsKey: String) + extends DeclarationKeyCollector + with OasLikeDeclarationsHelper { + + def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + parseSecuritySchemeDeclarations(map, parent + "/securitySchemes") + parseCorrelationIdDeclarations(map, parent + "/correlationIds") + super.parseTypeDeclarations(map, Some(this)) + parseParameterDeclarations(map, parent + "/parameters") + + parseMessageBindingsDeclarations(map, parent + "/messageBindings") + parseServerBindingsDeclarations(map, parent + "/serverBindings") + parseOperationBindingsDeclarations(map, parent + "/operationBindings") + parseChannelBindingsDeclarations(map, parent + "/channelBindings") + parseOperationTraits(map, parent + "/operationTraits") + parseMessageTraits(map, parent + "/messageTraits") + + parseMessageDeclarations(map, parent + "/messages") + } + + def parseMessageDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = + componentsMap.key( + "messages", + e => { + addDeclarationKey(DeclarationKey(e)) + e.value.as[YMap].entries.foreach { entry => + val message = AsyncMessageParser(YMapEntryLike(entry), parent, None).parse() + message.add(DeclaredElement()) + ctx.declarations += message + } + } + ) + + def parseOperationTraits(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = + componentsMap.key( + "operationTraits", + entry => { + addDeclarationKey(DeclarationKey(entry, isAbstract = true)) + entry.value.as[YMap].entries.foreach { entry => + val adopt = (o: Operation) => o + val operation = AsyncOperationParser(entry, adopt, isTrait = true).parse() + operation.add(DeclaredElement()) + ctx.declarations += operation + } + } + ) + + def parseMessageTraits(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = + componentsMap.key( + "messageTraits", + entry => { + addDeclarationKey(DeclarationKey(entry, isAbstract = true)) + entry.value.as[YMap].entries.foreach { entry => + val message = AsyncMessageParser(YMapEntryLike(entry), parent, None, isTrait = true).parse() + message.add(DeclaredElement()) + ctx.declarations += message + } + } + ) + + protected def parseSecuritySchemeDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + map.key( + "securitySchemes", + e => { + addDeclarationKey(DeclarationKey(e)) + e.value.as[YMap].entries.foreach { entry => + ctx.declarations += ctx.factory + .securitySchemeParser( + entry, + (scheme) => { + val name = entry.key.as[String] + scheme.setWithoutId( + SecuritySchemeModel.Name, + AmfScalar(name, Annotations(entry.key.value)), + Annotations(entry.key) + ) + scheme + } + ) + .parse() + .add(DeclaredElement()) + } + } + ) + } + + def parseParameterDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + componentsMap.key( + "parameters", + paramsMap => { + addDeclarationKey(DeclarationKey(paramsMap)) + val parameters: Seq[Parameter] = AsyncParametersParser(parent, paramsMap.value.as[YMap]).parse() + parameters map { param => + param.add(DeclaredElement()) + ctx.declarations += param + } + } + ) + } + + def parseCorrelationIdDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + componentsMap.key( + "correlationIds", + e => { + addDeclarationKey(DeclarationKey(e)) + e.value.as[YMap].entries.foreach { entry => + val correlationId = AsyncCorrelationIdParser(YMapEntryLike(entry), parent).parse() + ctx.declarations += correlationId.add(DeclaredElement()) + } + } + ) + } + + def parseMessageBindingsDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + parseBindingsDeclarations[MessageBindings]( + "messageBindings", + componentsMap, + entry => { + AsyncMessageBindingsParser(YMapEntryLike(entry)).parse() + }, + MessageBindingsModel + ) + } + + def parseServerBindingsDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + parseBindingsDeclarations[ServerBindings]( + "serverBindings", + componentsMap, + entry => { + AsyncServerBindingsParser(YMapEntryLike(entry)).parse() + }, + ServerBindingsModel + ) + } + + def parseOperationBindingsDeclarations(componentsMap: YMap, parent: String)(implicit + ctx: AsyncWebApiContext + ): Unit = { + parseBindingsDeclarations[OperationBindings]( + "operationBindings", + componentsMap, + entry => { + AsyncOperationBindingsParser(YMapEntryLike(entry)).parse() + }, + OperationBindingsModel + ) + } + + def parseChannelBindingsDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + parseBindingsDeclarations[ChannelBindings]( + "channelBindings", + componentsMap, + entry => { + AsyncChannelBindingsParser(YMapEntryLike(entry)).parse() + }, + ChannelBindingsModel + ) + } + + def parseBindingsDeclarations[T <: DomainElement]( + keyword: String, + componentsMap: YMap, + parse: YMapEntry => T, + model: DomainElementModel + )(implicit ctx: AsyncWebApiContext): Unit = { + componentsMap.key( + keyword, + e => { + addDeclarationKey(DeclarationKey(e)) + e.value.as[YMap].entries.foreach { entry => + val bindings: T = parse(entry) + bindings.add(DeclaredElement()) + ctx.declarations += bindings + } + } + ) + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala index 14ad3a9852..9729337291 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala @@ -71,6 +71,16 @@ abstract class AsyncApiDocumentParser(root: Root)(implicit val ctx: AsyncWebApiC document } + private def parseDeclarations(map: YMap, parentObj: AmfObject) = { + map.key("components").foreach { components => + val parent = root.location + "#/declarations" + val componentsMap = components.value.as[YMap] + AsyncApiDeclarationParser(definitionsKey).parseDeclarations(componentsMap, parent) + ctx.closedShape(parentObj, componentsMap, "components") + validateNames() + } + } + def parseApi(map: YMap): AsyncApi = { YamlTagValidator.validate(root) val api = AsyncApi(root.parsed.asInstanceOf[SyamlParsedDocument].document.node) @@ -134,187 +144,6 @@ abstract class AsyncApiDocumentParser(root: Root)(implicit val ctx: AsyncWebApiC } override protected val definitionsKey: String = "schemas" - - def parseDeclarations(map: YMap, parentObj: AmfObject): Unit = { - map.key("components").foreach { components => - val parent = root.location + "#/declarations" - val componentsMap = components.value.as[YMap] - - parseSecuritySchemeDeclarations(componentsMap, parent + "/securitySchemes") - parseCorrelationIdDeclarations(componentsMap, parent + "/correlationIds") - super.parseTypeDeclarations(componentsMap, Some(this)) - parseParameterDeclarations(componentsMap, parent + "/parameters") - - parseMessageBindingsDeclarations(componentsMap, parent + "/messageBindings") - parseServerBindingsDeclarations(componentsMap, parent + "/serverBindings") - parseOperationBindingsDeclarations(componentsMap, parent + "/operationBindings") - parseChannelBindingsDeclarations(componentsMap, parent + "/channelBindings") - parseOperationTraits(componentsMap, parent + "/operationTraits") - parseMessageTraits(componentsMap, parent + "/messageTraits") - - parseMessageDeclarations(componentsMap, parent + "/messages") - - ctx.closedShape(parentObj, componentsMap, "components") - validateNames() - } - } - - def parseMessageDeclarations(componentsMap: YMap, parent: String): Unit = - componentsMap.key( - "messages", - e => { - addDeclarationKey(DeclarationKey(e)) - e.value.as[YMap].entries.foreach { entry => - val message = AsyncMessageParser(YMapEntryLike(entry), parent, None).parse() - message.add(DeclaredElement()) - ctx.declarations += message - } - } - ) - - def parseOperationTraits(componentsMap: YMap, parent: String): Unit = - componentsMap.key( - "operationTraits", - entry => { - addDeclarationKey(DeclarationKey(entry, isAbstract = true)) - entry.value.as[YMap].entries.foreach { entry => - val adopt = (o: Operation) => o - val operation = AsyncOperationParser(entry, adopt, isTrait = true).parse() - operation.add(DeclaredElement()) - ctx.declarations += operation - } - } - ) - - def parseMessageTraits(componentsMap: YMap, parent: String): Unit = - componentsMap.key( - "messageTraits", - entry => { - addDeclarationKey(DeclarationKey(entry, isAbstract = true)) - entry.value.as[YMap].entries.foreach { entry => - val message = AsyncMessageParser(YMapEntryLike(entry), parent, None, isTrait = true).parse() - message.add(DeclaredElement()) - ctx.declarations += message - } - } - ) - - protected def parseSecuritySchemeDeclarations(map: YMap, parent: String): Unit = { - map.key( - "securitySchemes", - e => { - addDeclarationKey(DeclarationKey(e)) - e.value.as[YMap].entries.foreach { entry => - ctx.declarations += ctx.factory - .securitySchemeParser( - entry, - (scheme) => { - val name = entry.key.as[String] - scheme.setWithoutId( - SecuritySchemeModel.Name, - AmfScalar(name, Annotations(entry.key.value)), - Annotations(entry.key) - ) - scheme - } - ) - .parse() - .add(DeclaredElement()) - } - } - ) - } - - def parseParameterDeclarations(componentsMap: YMap, parent: String): Unit = { - componentsMap.key( - "parameters", - paramsMap => { - addDeclarationKey(DeclarationKey(paramsMap)) - val parameters: Seq[Parameter] = AsyncParametersParser(parent, paramsMap.value.as[YMap]).parse() - parameters map { param => - param.add(DeclaredElement()) - ctx.declarations += param - } - } - ) - } - - def parseCorrelationIdDeclarations(componentsMap: YMap, parent: String): Unit = { - componentsMap.key( - "correlationIds", - e => { - addDeclarationKey(DeclarationKey(e)) - e.value.as[YMap].entries.foreach { entry => - val correlationId = AsyncCorrelationIdParser(YMapEntryLike(entry), parent).parse() - ctx.declarations += correlationId.add(DeclaredElement()) - } - } - ) - } - - def parseMessageBindingsDeclarations(componentsMap: YMap, parent: String): Unit = { - parseBindingsDeclarations[MessageBindings]( - "messageBindings", - componentsMap, - entry => { - AsyncMessageBindingsParser(YMapEntryLike(entry)).parse() - }, - MessageBindingsModel - ) - } - - def parseServerBindingsDeclarations(componentsMap: YMap, parent: String): Unit = { - parseBindingsDeclarations[ServerBindings]( - "serverBindings", - componentsMap, - entry => { - AsyncServerBindingsParser(YMapEntryLike(entry)).parse() - }, - ServerBindingsModel - ) - } - - def parseOperationBindingsDeclarations(componentsMap: YMap, parent: String): Unit = { - parseBindingsDeclarations[OperationBindings]( - "operationBindings", - componentsMap, - entry => { - AsyncOperationBindingsParser(YMapEntryLike(entry)).parse() - }, - OperationBindingsModel - ) - } - - def parseChannelBindingsDeclarations(componentsMap: YMap, parent: String): Unit = { - parseBindingsDeclarations[ChannelBindings]( - "channelBindings", - componentsMap, - entry => { - AsyncChannelBindingsParser(YMapEntryLike(entry)).parse() - }, - ChannelBindingsModel - ) - } - - def parseBindingsDeclarations[T <: DomainElement]( - keyword: String, - componentsMap: YMap, - parse: YMapEntry => T, - model: DomainElementModel - ): Unit = { - componentsMap.key( - keyword, - e => { - addDeclarationKey(DeclarationKey(e)) - e.value.as[YMap].entries.foreach { entry => - val bindings: T = parse(entry) - bindings.add(DeclaredElement()) - ctx.declarations += bindings - } - } - ) - } - } case class IdentifierParser(entry: YMapEntry, webApi: AsyncApi, override implicit val ctx: AsyncWebApiContext) From af2d1432767bde02d6b6680b19ce18be6722ce2b Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 29 Jan 2024 09:51:13 -0300 Subject: [PATCH 16/33] W-14875628 (refactor): change YPart to YMapEntryLike for securityScheme parsers --- .../context/AsyncSpecAwareContext.scala | 3 ++- .../document/AsyncApiDeclarationParser.scala | 2 +- .../domain/Async2SecuritySchemeParser.scala | 3 ++- .../common/emitter/SpecAwareContext.scala | 3 ++- .../common/parser/SecuritySchemeParser.scala | 20 +++++++------------ .../parser/context/Oas2VersionFactory.scala | 2 +- .../parser/context/Oas3VersionFactory.scala | 2 +- .../parser/document/OasDocumentParser.scala | 2 +- .../parser/document/OasFragmentParser.scala | 2 +- .../domain/OasLikeSecuritySchemeParser.scala | 17 +++++++++------- .../domain/OasSecuritySchemeParser.scala | 7 ++++--- .../parser/context/RamlSpecAwareContext.scala | 3 ++- .../document/Raml08DocumentParser.scala | 3 ++- .../parser/document/RamlDocumentParser.scala | 2 +- .../parser/document/RamlFragmentParser.scala | 2 +- .../domain/RamlSecuritySchemeParser.scala | 14 ++++++------- .../context/GraphQLBaseWebApiContext.scala | 5 +++-- .../parser/context/GrpcWebApiContext.scala | 5 +++-- 18 files changed, 51 insertions(+), 46 deletions(-) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncSpecAwareContext.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncSpecAwareContext.scala index 8e01fd0cf2..3aec993ac3 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncSpecAwareContext.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncSpecAwareContext.scala @@ -19,6 +19,7 @@ import amf.apicontract.internal.spec.oas.parser.domain.{ OasLikeSecuritySettingsParser, OasLikeServerVariableParser } +import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model.{YMap, YMapEntry, YPart} // TODO ASYNC complete all this @@ -35,7 +36,7 @@ case class Async20VersionFactory()(implicit ctx: AsyncWebApiContext) extends Asy override def endPointParser(entry: YMapEntry, parentId: String, collector: List[EndPoint]): OasLikeEndpointParser = AsyncEndpointParser(entry, parentId, collector)(ctx) - override def securitySchemeParser: (YPart, SecurityScheme => SecurityScheme) => SecuritySchemeParser = + override def securitySchemeParser: (YMapEntryLike, SecurityScheme => SecurityScheme) => SecuritySchemeParser = Async2SecuritySchemeParser.apply override def securitySettingsParser(map: YMap, scheme: SecurityScheme): OasLikeSecuritySettingsParser = diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala index 12a736cb0c..fbb5cfa9fe 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala @@ -105,7 +105,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) e.value.as[YMap].entries.foreach { entry => ctx.declarations += ctx.factory .securitySchemeParser( - entry, + YMapEntryLike(entry), (scheme) => { val name = entry.key.as[String] scheme.setWithoutId( diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/Async2SecuritySchemeParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/Async2SecuritySchemeParser.scala index 21f3e63b9a..df4c059cfc 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/Async2SecuritySchemeParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/Async2SecuritySchemeParser.scala @@ -3,8 +3,9 @@ package amf.apicontract.internal.spec.async.parser.domain import amf.apicontract.client.scala.model.domain.security.SecurityScheme import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.oas.parser.domain.OasLikeSecuritySchemeParser +import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model.YPart -case class Async2SecuritySchemeParser(part: YPart, adopt: SecurityScheme => SecurityScheme)(implicit +case class Async2SecuritySchemeParser(part: YMapEntryLike, adopt: SecurityScheme => SecurityScheme)(implicit ctx: AsyncWebApiContext ) extends OasLikeSecuritySchemeParser(part, adopt) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/common/emitter/SpecAwareContext.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/common/emitter/SpecAwareContext.scala index 872e7f2f30..c236bf9066 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/common/emitter/SpecAwareContext.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/common/emitter/SpecAwareContext.scala @@ -2,6 +2,7 @@ package amf.apicontract.internal.spec.common.emitter import amf.apicontract.client.scala.model.domain.security.SecurityScheme import amf.apicontract.internal.spec.common.parser.SecuritySchemeParser +import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model.YPart trait SpecAwareContext { @@ -9,5 +10,5 @@ trait SpecAwareContext { } trait SpecVersionFactory { - def securitySchemeParser: (YPart, SecurityScheme => SecurityScheme) => SecuritySchemeParser + def securitySchemeParser: (YMapEntryLike, SecurityScheme => SecurityScheme) => SecuritySchemeParser } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/common/parser/SecuritySchemeParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/common/parser/SecuritySchemeParser.scala index 558e8f15bc..0842fd9eb6 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/common/parser/SecuritySchemeParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/common/parser/SecuritySchemeParser.scala @@ -2,23 +2,17 @@ package amf.apicontract.internal.spec.common.parser import amf.apicontract.client.scala.model.domain.security.SecurityScheme import amf.core.internal.parser.YScalarYRead +import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model._ -abstract class SecuritySchemeParser(part: YPart, adopt: SecurityScheme => SecurityScheme)(implicit ctx: WebApiContext) - extends SpecParserOps { +abstract class SecuritySchemeParser(entry: YMapEntryLike)(implicit ctx: WebApiContext) extends SpecParserOps { def parse(): SecurityScheme - def getNode: YNode = { - part match { - case entry: YMapEntry => entry.value - case map: YMap => map - case node: YNode => node - } - } def getName: (String, Option[YNode]) = { - part match { - case entry: YMapEntry => (entry.key.as[YScalar].text, Some(entry.key)) - case _: YMap => ("securityDefinitions", None) - } + entry.key + .map { keyNode => + (keyNode.as[YScalar].text, Some(keyNode)) + } + .getOrElse(("securityDefinitions", None)) } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/context/Oas2VersionFactory.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/context/Oas2VersionFactory.scala index fdc02f3b22..1585814a3d 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/context/Oas2VersionFactory.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/context/Oas2VersionFactory.scala @@ -23,7 +23,7 @@ case class Oas2VersionFactory()(implicit override val ctx: OasWebApiContext) ext override def securitySettingsParser(map: YMap, scheme: SecurityScheme): OasLikeSecuritySettingsParser = new Oas2SecuritySettingsParser(map, scheme)(ctx) - override def securitySchemeParser: (YPart, SecurityScheme => SecurityScheme) => SecuritySchemeParser = + override def securitySchemeParser: (YMapEntryLike, SecurityScheme => SecurityScheme) => SecuritySchemeParser = Oas2SecuritySchemeParser.apply override def parameterParser( diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/context/Oas3VersionFactory.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/context/Oas3VersionFactory.scala index 169ce02b50..feb3784ee5 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/context/Oas3VersionFactory.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/context/Oas3VersionFactory.scala @@ -26,7 +26,7 @@ case class Oas3VersionFactory()(implicit override val ctx: OasWebApiContext) ext override def serversParser(map: YMap, endpoint: EndPoint): OasServersParser = Oas3ServersParser(map, endpoint, EndPointModel.Servers)(ctx) - override def securitySchemeParser: (YPart, SecurityScheme => SecurityScheme) => SecuritySchemeParser = + override def securitySchemeParser: (YMapEntryLike, SecurityScheme => SecurityScheme) => SecuritySchemeParser = Oas3SecuritySchemeParser.apply override def securitySettingsParser(map: YMap, scheme: SecurityScheme): OasLikeSecuritySettingsParser = diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/document/OasDocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/document/OasDocumentParser.scala index 61ea639909..3221b83b00 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/document/OasDocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/document/OasDocumentParser.scala @@ -196,7 +196,7 @@ abstract class OasDocumentParser(root: Root, val spec: Spec)(implicit val ctx: O e.value.as[YMap].entries.foreach { entry => val securityScheme: SecurityScheme = ctx.factory .securitySchemeParser( - entry, + YMapEntryLike(entry), (scheme) => { val name = entry.key.as[String] scheme.setWithoutId( diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/document/OasFragmentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/document/OasFragmentParser.scala index eacbb1435c..fe51b7f662 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/document/OasFragmentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/document/OasFragmentParser.scala @@ -169,7 +169,7 @@ case class OasFragmentParser(root: Root, spec: Spec, fragment: Option[OasHeader] security.withEncodes( ctx.factory .securitySchemeParser( - map, + YMapEntryLike(map), (security: amf.apicontract.client.scala.model.domain.security.SecurityScheme) => security ) .parse() diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/domain/OasLikeSecuritySchemeParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/domain/OasLikeSecuritySchemeParser.scala index 5dc0605cbe..e5ab875aee 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/domain/OasLikeSecuritySchemeParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/domain/OasLikeSecuritySchemeParser.scala @@ -3,7 +3,7 @@ package amf.apicontract.internal.spec.oas.parser.domain import amf.apicontract.client.scala.model.domain.security.SecurityScheme import amf.apicontract.internal.metamodel.domain.security.SecuritySchemeModel import amf.apicontract.internal.spec.common.WebApiDeclarations.ErrorSecurityScheme -import amf.apicontract.internal.spec.common.parser.{SecuritySchemeParser} +import amf.apicontract.internal.spec.common.parser.SecuritySchemeParser import amf.apicontract.internal.spec.oas.parser.context.OasLikeWebApiContext import amf.apicontract.internal.spec.raml.parser.domain.RamlDescribedByParser import amf.apicontract.internal.spec.spec.toRaml @@ -18,20 +18,20 @@ import amf.core.internal.parser.domain.{Annotations, SearchScope} import amf.core.internal.utils.AmfStrings import amf.core.internal.validation.CoreValidations import amf.shapes.internal.annotations.ExternalReferenceUrl -import amf.shapes.internal.spec.common.parser.AnnotationParser +import amf.shapes.internal.spec.common.parser.{AnnotationParser, YMapEntryLike} import org.yaml.model.{YMap, YNode, YPart, YType} -abstract class OasLikeSecuritySchemeParser(part: YPart, adopt: SecurityScheme => SecurityScheme)(implicit +abstract class OasLikeSecuritySchemeParser(entry: YMapEntryLike, adopt: SecurityScheme => SecurityScheme)(implicit ctx: OasLikeWebApiContext -) extends SecuritySchemeParser(part, adopt) { +) extends SecuritySchemeParser(entry) { override def parse(): SecurityScheme = { - val node = getNode + val node = entry.value ctx.link(node) match { case Left(link) => parseReferenced(link, node, adopt) case Right(value) => - val scheme = adopt(SecurityScheme(part)) + val scheme = adopt(SecurityScheme(entry.ast)) val map = value.as[YMap] parseType(map, scheme) @@ -114,7 +114,10 @@ abstract class OasLikeSecuritySchemeParser(part: YPart, adopt: SecurityScheme => .getOrElse { ctx.obtainRemoteYNode(parsedUrl) match { case Some(schemeNode) => - ctx.factory.securitySchemeParser(schemeNode, adopt).parse().add(ExternalReferenceUrl(parsedUrl)) + ctx.factory + .securitySchemeParser(YMapEntryLike(schemeNode), adopt) + .parse() + .add(ExternalReferenceUrl(parsedUrl)) case None => ctx.eh.violation( CoreValidations.UnresolvedReference, diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/domain/OasSecuritySchemeParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/domain/OasSecuritySchemeParser.scala index 0456a9629f..f5ea5689be 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/domain/OasSecuritySchemeParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/oas/parser/domain/OasSecuritySchemeParser.scala @@ -7,14 +7,15 @@ import amf.apicontract.internal.spec.oas.parser.context.{ OasLikeWebApiContext } import amf.core.internal.parser.YMapOps +import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model.{YMap, YPart} object Oas2SecuritySchemeParser { - def apply(part: YPart, adopt: SecurityScheme => SecurityScheme)(implicit ctx: OasLikeWebApiContext) = + def apply(part: YMapEntryLike, adopt: SecurityScheme => SecurityScheme)(implicit ctx: OasLikeWebApiContext) = new Oas2SecuritySchemeParser(part, adopt)(new CustomClosedShapeContextDecorator(ctx, OasCustomSyntax)) } -case class Oas2SecuritySchemeParser(part: YPart, adopt: SecurityScheme => SecurityScheme)(implicit +case class Oas2SecuritySchemeParser(part: YMapEntryLike, adopt: SecurityScheme => SecurityScheme)(implicit ctx: OasLikeWebApiContext ) extends OasLikeSecuritySchemeParser(part, adopt) { override def closedShape(scheme: SecurityScheme, map: YMap, shape: String): Unit = { @@ -35,6 +36,6 @@ case class Oas2SecuritySchemeParser(part: YPart, adopt: SecurityScheme => Securi } } -case class Oas3SecuritySchemeParser(part: YPart, adopt: SecurityScheme => SecurityScheme)(implicit +case class Oas3SecuritySchemeParser(part: YMapEntryLike, adopt: SecurityScheme => SecurityScheme)(implicit ctx: OasLikeWebApiContext ) extends OasLikeSecuritySchemeParser(part, adopt) {} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/context/RamlSpecAwareContext.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/context/RamlSpecAwareContext.scala index f7d1b769c9..9bc3d6a8f7 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/context/RamlSpecAwareContext.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/context/RamlSpecAwareContext.scala @@ -12,6 +12,7 @@ import amf.apicontract.internal.spec.raml.parser.document.{ import amf.apicontract.internal.spec.raml.parser.domain._ import amf.core.client.scala.model.domain.{DomainElement, Shape} import amf.core.internal.parser.Root +import amf.shapes.internal.spec.common.parser.YMapEntryLike import amf.shapes.internal.spec.raml.parser._ import org.yaml.model._ @@ -22,7 +23,7 @@ trait RamlSpecAwareContext extends SpecAwareContext {} abstract class RamlSpecVersionFactory(implicit val ctx: RamlWebApiContext) extends SpecVersionFactory { - override def securitySchemeParser: (YPart, SecurityScheme => SecurityScheme) => SecuritySchemeParser = + override def securitySchemeParser: (YMapEntryLike, SecurityScheme => SecurityScheme) => SecuritySchemeParser = RamlSecuritySchemeParser.apply def securitySettingsParser: (YNode, String, DomainElement with WithSettings) => RamlSecuritySettingsParser diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/Raml08DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/Raml08DocumentParser.scala index 87fa860415..e36d8aaa67 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/Raml08DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/Raml08DocumentParser.scala @@ -16,6 +16,7 @@ import amf.core.internal.remote.Spec import amf.core.internal.unsafe.PlatformSecrets import amf.core.internal.utils.{AmfStrings, UriUtils} import amf.shapes.internal.spec.RamlTypeDefMatcher +import amf.shapes.internal.spec.common.parser.YMapEntryLike import amf.shapes.internal.spec.raml.parser.{Raml08TypeParser, StringDefaultType} import amf.shapes.internal.validation.definitions.ShapeParserSideValidations.InvalidTypeDefinition import org.yaml.model.{YMap, YMapEntry, YScalar, YType} @@ -106,7 +107,7 @@ case class Raml08DocumentParser(root: Root)(implicit override val ctx: RamlWebAp private def parseEntries(entries: Seq[YMapEntry], parent: String): Unit = entries.foreach { entry => ctx.declarations += ctx.factory .securitySchemeParser( - entry, + YMapEntryLike(entry), scheme => { val name = entry.key.as[String] scheme.withName(name) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/RamlDocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/RamlDocumentParser.scala index 27743d9abd..f1eb41a796 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/RamlDocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/RamlDocumentParser.scala @@ -290,7 +290,7 @@ trait Raml10BaseSpecParser extends RamlBaseDocumentParser { e.value.as[YMap].entries.foreach { entry => ctx.declarations += ctx.factory .securitySchemeParser( - entry, + YMapEntryLike(entry), scheme => { val name = entry.key.as[YScalar].text scheme.setWithoutId( diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/RamlFragmentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/RamlFragmentParser.scala index 986ae6b7bb..79900b55bd 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/RamlFragmentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/document/RamlFragmentParser.scala @@ -161,7 +161,7 @@ case class RamlFragmentParser(root: Root, spec: Spec, fragmentType: RamlFragment security.setWithoutId( FragmentModel.Encodes, RamlSecuritySchemeParser( - map, + YMapEntryLike(map), (security: amf.apicontract.client.scala.model.domain.security.SecurityScheme) => security ) .parse(), diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/domain/RamlSecuritySchemeParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/domain/RamlSecuritySchemeParser.scala index 7c38885e93..737fa6fb18 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/domain/RamlSecuritySchemeParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/raml/parser/domain/RamlSecuritySchemeParser.scala @@ -15,7 +15,7 @@ import amf.core.internal.annotations.{ExternalFragmentRef, LexicalInformation} import amf.core.internal.parser.YMapOps import amf.core.internal.parser.domain.{Annotations, SearchScope} import amf.shapes.internal.domain.resolution.ExampleTracking.tracking -import amf.shapes.internal.spec.common.parser.AnnotationParser +import amf.shapes.internal.spec.common.parser.{AnnotationParser, YMapEntryLike} import amf.shapes.internal.spec.common.parser.WellKnownAnnotation.isRamlAnnotation import amf.shapes.internal.spec.raml.parser.Raml10TypeParser import amf.shapes.internal.vocabulary.VocabularyMappings @@ -23,17 +23,17 @@ import org.yaml.model._ import scala.collection.mutable -case class RamlSecuritySchemeParser(part: YPart, adopt: SecurityScheme => SecurityScheme)(implicit +case class RamlSecuritySchemeParser(entry: YMapEntryLike, adopt: SecurityScheme => SecurityScheme)(implicit ctx: RamlWebApiContext -) extends SecuritySchemeParser(part, adopt) { +) extends SecuritySchemeParser(entry) { override def parse(): SecurityScheme = { - val node = getNode + val node = entry.value val (key, partKey) = getName ctx.link(node) match { - case Left(link) => parseReferenced(key, partKey, link, Annotations(part), adopt) + case Left(link) => parseReferenced(key, partKey, link, Annotations(entry.ast), adopt) case Right(value) => - val scheme = adopt(SecurityScheme(part)) + val scheme = adopt(SecurityScheme(entry.ast)) val map = value.as[YMap] ctx.closedShape(scheme, map, "securitySchema") @@ -92,7 +92,7 @@ case class RamlSecuritySchemeParser(part: YPart, adopt: SecurityScheme => Securi ): SecurityScheme = { val scheme = ctx.declarations - .findSecuritySchemeOrError(part)(parsedUrl, SearchScope.All) + .findSecuritySchemeOrError(entry.ast)(parsedUrl, SearchScope.All) val copied: SecurityScheme = scheme.link(AmfScalar(parsedUrl), annotations, Annotations.synthesized()) adopt(copied) diff --git a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/context/GraphQLBaseWebApiContext.scala b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/context/GraphQLBaseWebApiContext.scala index 6670ba17cb..e5cdb456e5 100644 --- a/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/context/GraphQLBaseWebApiContext.scala +++ b/amf-graphql/shared/src/main/scala/amf/graphql/internal/spec/context/GraphQLBaseWebApiContext.scala @@ -17,12 +17,13 @@ import amf.shapes.internal.spec.common.parser.{ IgnoreAnnotationSchemaValidatorBuilder, IgnoreCriteria, SpecSettings, - SpecSyntax + SpecSyntax, + YMapEntryLike } import org.yaml.model.{YNode, YPart} object GraphQLBaseVersionFactory extends SpecVersionFactory { - override def securitySchemeParser: (YPart, SecurityScheme => SecurityScheme) => SecuritySchemeParser = + override def securitySchemeParser: (YMapEntryLike, SecurityScheme => SecurityScheme) => SecuritySchemeParser = throw new Exception("GraphQL specs don't support security schemes") } diff --git a/amf-grpc/shared/src/main/scala/amf/grpc/internal/spec/parser/context/GrpcWebApiContext.scala b/amf-grpc/shared/src/main/scala/amf/grpc/internal/spec/parser/context/GrpcWebApiContext.scala index a7b7720849..bb36b196bc 100644 --- a/amf-grpc/shared/src/main/scala/amf/grpc/internal/spec/parser/context/GrpcWebApiContext.scala +++ b/amf-grpc/shared/src/main/scala/amf/grpc/internal/spec/parser/context/GrpcWebApiContext.scala @@ -17,12 +17,13 @@ import amf.shapes.internal.spec.common.parser.{ IgnoreAnnotationSchemaValidatorBuilder, IgnoreCriteria, SpecSettings, - SpecSyntax + SpecSyntax, + YMapEntryLike } import org.yaml.model.{YNode, YPart} object GrpcVersionFactory extends SpecVersionFactory { - override def securitySchemeParser: (YPart, SecurityScheme => SecurityScheme) => SecuritySchemeParser = + override def securitySchemeParser: (YMapEntryLike, SecurityScheme => SecurityScheme) => SecuritySchemeParser = throw new Exception("GRPC specs don't support security schemes") } From acdddfe5598368c9a5b162f4fc49b65ffa30045f Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 29 Jan 2024 09:52:29 -0300 Subject: [PATCH 17/33] W-14875628 (chore): made methods in new async declaration parser private --- .../document/AsyncApiDeclarationParser.scala | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala index fbb5cfa9fe..f522effdca 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala @@ -57,7 +57,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) parseMessageDeclarations(map, parent + "/messages") } - def parseMessageDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = + private def parseMessageDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = componentsMap.key( "messages", e => { @@ -70,7 +70,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } ) - def parseOperationTraits(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = + private def parseOperationTraits(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = componentsMap.key( "operationTraits", entry => { @@ -84,7 +84,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } ) - def parseMessageTraits(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = + private def parseMessageTraits(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = componentsMap.key( "messageTraits", entry => { @@ -97,7 +97,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } ) - protected def parseSecuritySchemeDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + private def parseSecuritySchemeDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { map.key( "securitySchemes", e => { @@ -123,7 +123,9 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) ) } - def parseParameterDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + private def parseParameterDeclarations(componentsMap: YMap, parent: String)(implicit + ctx: AsyncWebApiContext + ): Unit = { componentsMap.key( "parameters", paramsMap => { @@ -137,7 +139,9 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) ) } - def parseCorrelationIdDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + private def parseCorrelationIdDeclarations(componentsMap: YMap, parent: String)(implicit + ctx: AsyncWebApiContext + ): Unit = { componentsMap.key( "correlationIds", e => { @@ -150,7 +154,9 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) ) } - def parseMessageBindingsDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + private def parseMessageBindingsDeclarations(componentsMap: YMap, parent: String)(implicit + ctx: AsyncWebApiContext + ): Unit = { parseBindingsDeclarations[MessageBindings]( "messageBindings", componentsMap, @@ -161,7 +167,9 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) ) } - def parseServerBindingsDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + private def parseServerBindingsDeclarations(componentsMap: YMap, parent: String)(implicit + ctx: AsyncWebApiContext + ): Unit = { parseBindingsDeclarations[ServerBindings]( "serverBindings", componentsMap, @@ -172,7 +180,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) ) } - def parseOperationBindingsDeclarations(componentsMap: YMap, parent: String)(implicit + private def parseOperationBindingsDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext ): Unit = { parseBindingsDeclarations[OperationBindings]( @@ -185,7 +193,9 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) ) } - def parseChannelBindingsDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + private def parseChannelBindingsDeclarations(componentsMap: YMap, parent: String)(implicit + ctx: AsyncWebApiContext + ): Unit = { parseBindingsDeclarations[ChannelBindings]( "channelBindings", componentsMap, @@ -196,7 +206,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) ) } - def parseBindingsDeclarations[T <: DomainElement]( + private def parseBindingsDeclarations[T <: DomainElement]( keyword: String, componentsMap: YMap, parse: YMapEntry => T, From 6797c13701554c90a79130161b4bb7757d8e6e54 Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 29 Jan 2024 10:16:59 -0300 Subject: [PATCH 18/33] W-14875628 (refactor): added declaration parsers for Async 2.3 and 2.4 --- .../spec/async/Async20ParsePlugin.scala | 3 +- .../document/AsyncApi20DocumentParser.scala | 6 +- .../document/AsyncApiDocumentParser.scala | 10 +-- .../Async20DeclarationParser.scala} | 66 +++++++------------ .../Async23DeclarationParser.scala | 10 +++ .../Async24DeclarationParser.scala | 11 ++++ .../declarations/AsyncDeclarationParser.scala | 8 +++ 7 files changed, 66 insertions(+), 48 deletions(-) rename amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/{document/AsyncApiDeclarationParser.scala => domain/declarations/Async20DeclarationParser.scala} (74%) create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async23DeclarationParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async24DeclarationParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/AsyncDeclarationParser.scala diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala index 0164b22813..39b527aa8a 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala @@ -3,6 +3,7 @@ package amf.apicontract.internal.spec.async import amf.apicontract.internal.spec.async.AsyncHeader.Async20Header import amf.apicontract.internal.spec.async.parser.context.{Async20WebApiContext, AsyncWebApiContext} import amf.apicontract.internal.spec.async.parser.document +import amf.apicontract.internal.spec.async.parser.domain.declarations.Async20DeclarationParser import amf.apicontract.internal.spec.common.AsyncWebApiDeclarations import amf.apicontract.internal.spec.oas.OasLikeParsePlugin import amf.apicontract.internal.spec.raml.Raml10ParsePlugin @@ -33,7 +34,7 @@ object Async20ParsePlugin extends OasLikeParsePlugin { private def parseAsyncUnit(root: Root)(implicit ctx: AsyncWebApiContext): BaseUnit = { AsyncHeader(root) match { - case Some(Async20Header) => document.AsyncApi20DocumentParser(root).parseDocument() + case Some(Async20Header) => document.AsyncApi20DocumentParser(root, Async20DeclarationParser).parseDocument() case _ => // unreachable as it is covered in canParse() throw new InvalidDocumentHeaderException(spec.id) } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala index 1ed9461464..41cd2732b7 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala @@ -1,7 +1,9 @@ package amf.apicontract.internal.spec.async.parser.document import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.async.parser.domain.declarations.AsyncDeclarationParser import amf.core.internal.parser.Root -case class AsyncApi20DocumentParser(root: Root)(override implicit val ctx: AsyncWebApiContext) - extends AsyncApiDocumentParser(root)(ctx) +case class AsyncApi20DocumentParser(root: Root, declarationParser: AsyncDeclarationParser)( + override implicit val ctx: AsyncWebApiContext +) extends AsyncApiDocumentParser(root, declarationParser)(ctx) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala index 9729337291..d448fd5233 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala @@ -26,6 +26,7 @@ import amf.apicontract.internal.spec.async.parser.bindings.{ } import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.async.parser.domain._ +import amf.apicontract.internal.spec.async.parser.domain.declarations.{Async20DeclarationParser, AsyncDeclarationParser} import amf.apicontract.internal.spec.common.parser._ import amf.apicontract.internal.spec.oas.parser.document.OasLikeDeclarationsHelper import amf.apicontract.internal.spec.oas.parser.domain.{OasLikeInformationParser, OasLikeTagsParser} @@ -36,7 +37,7 @@ import amf.apicontract.internal.validation.definitions.ParserSideValidations.{ import amf.core.client.scala.model.document.Document import amf.core.client.scala.model.domain.{AmfArray, AmfObject, AmfScalar, DomainElement} import amf.core.client.scala.parse.document.SyamlParsedDocument -import amf.core.internal.annotations.{DeclaredElement} +import amf.core.internal.annotations.DeclaredElement import amf.core.internal.metamodel.document.DocumentModel import amf.core.internal.metamodel.domain.DomainElementModel import amf.core.internal.parser.domain.{Annotations, ScalarNode} @@ -45,8 +46,9 @@ import amf.core.internal.remote.Spec import amf.shapes.internal.spec.common.parser.{AnnotationParser, OasLikeCreativeWorkParser, YMapEntryLike} import org.yaml.model.{YMap, YMapEntry, YType} -abstract class AsyncApiDocumentParser(root: Root)(implicit val ctx: AsyncWebApiContext) - extends AsyncApiSpecParser +abstract class AsyncApiDocumentParser(root: Root, declarationParser: AsyncDeclarationParser)(implicit + val ctx: AsyncWebApiContext +) extends AsyncApiSpecParser with OasLikeDeclarationsHelper { def parseDocument(): Document = parseDocument(Document()) @@ -75,7 +77,7 @@ abstract class AsyncApiDocumentParser(root: Root)(implicit val ctx: AsyncWebApiC map.key("components").foreach { components => val parent = root.location + "#/declarations" val componentsMap = components.value.as[YMap] - AsyncApiDeclarationParser(definitionsKey).parseDeclarations(componentsMap, parent) + declarationParser.parseDeclarations(componentsMap, parent) ctx.closedShape(parentObj, componentsMap, "components") validateNames() } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async20DeclarationParser.scala similarity index 74% rename from amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala rename to amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async20DeclarationParser.scala index f522effdca..fe7c349a4a 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDeclarationParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async20DeclarationParser.scala @@ -1,35 +1,15 @@ -package amf.apicontract.internal.spec.async.parser.document +package amf.apicontract.internal.spec.async.parser.domain.declarations import amf.aml.internal.parse.common.{DeclarationKey, DeclarationKeyCollector} +import amf.apicontract.client.scala.model.domain.bindings.{ChannelBindings, MessageBindings, OperationBindings, ServerBindings} import amf.apicontract.client.scala.model.domain.{Operation, Parameter} -import amf.apicontract.client.scala.model.domain.bindings.{ - ChannelBindings, - MessageBindings, - OperationBindings, - ServerBindings -} -import amf.apicontract.internal.metamodel.domain.bindings.{ - ChannelBindingsModel, - MessageBindingsModel, - OperationBindingsModel, - ServerBindingsModel -} +import amf.apicontract.internal.metamodel.domain.bindings.{ChannelBindingsModel, MessageBindingsModel, OperationBindingsModel, ServerBindingsModel} import amf.apicontract.internal.metamodel.domain.security.SecuritySchemeModel -import amf.apicontract.internal.spec.async.parser.bindings.{ - AsyncChannelBindingsParser, - AsyncMessageBindingsParser, - AsyncOperationBindingsParser, - AsyncServerBindingsParser -} +import amf.apicontract.internal.spec.async.parser.bindings.{AsyncChannelBindingsParser, AsyncMessageBindingsParser, AsyncOperationBindingsParser, AsyncServerBindingsParser} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext -import amf.apicontract.internal.spec.async.parser.domain.{ - AsyncCorrelationIdParser, - AsyncMessageParser, - AsyncOperationParser, - AsyncParametersParser -} +import amf.apicontract.internal.spec.async.parser.domain.{AsyncCorrelationIdParser, AsyncMessageParser, AsyncOperationParser, AsyncParametersParser} import amf.apicontract.internal.spec.oas.parser.document.OasLikeDeclarationsHelper -import amf.core.client.scala.model.domain.{AmfObject, AmfScalar, DomainElement} +import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} import amf.core.internal.annotations.DeclaredElement import amf.core.internal.metamodel.domain.DomainElementModel import amf.core.internal.parser.YMapOps @@ -37,11 +17,15 @@ import amf.core.internal.parser.domain.Annotations import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model.{YMap, YMapEntry} -case class AsyncApiDeclarationParser(override val definitionsKey: String) - extends DeclarationKeyCollector + +object Async20DeclarationParser + extends AsyncDeclarationParser + with DeclarationKeyCollector with OasLikeDeclarationsHelper { - def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + protected val definitionsKey = "schemas" + + override def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { parseSecuritySchemeDeclarations(map, parent + "/securitySchemes") parseCorrelationIdDeclarations(map, parent + "/correlationIds") super.parseTypeDeclarations(map, Some(this)) @@ -76,7 +60,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) entry => { addDeclarationKey(DeclarationKey(entry, isAbstract = true)) entry.value.as[YMap].entries.foreach { entry => - val adopt = (o: Operation) => o + val adopt = (o: Operation) => o val operation = AsyncOperationParser(entry, adopt, isTrait = true).parse() operation.add(DeclaredElement()) ctx.declarations += operation @@ -124,7 +108,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } private def parseParameterDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { componentsMap.key( "parameters", @@ -140,7 +124,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } private def parseCorrelationIdDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { componentsMap.key( "correlationIds", @@ -155,7 +139,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } private def parseMessageBindingsDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { parseBindingsDeclarations[MessageBindings]( "messageBindings", @@ -168,7 +152,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } private def parseServerBindingsDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { parseBindingsDeclarations[ServerBindings]( "serverBindings", @@ -181,7 +165,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } private def parseOperationBindingsDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { parseBindingsDeclarations[OperationBindings]( "operationBindings", @@ -194,7 +178,7 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } private def parseChannelBindingsDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { parseBindingsDeclarations[ChannelBindings]( "channelBindings", @@ -207,11 +191,11 @@ case class AsyncApiDeclarationParser(override val definitionsKey: String) } private def parseBindingsDeclarations[T <: DomainElement]( - keyword: String, - componentsMap: YMap, - parse: YMapEntry => T, - model: DomainElementModel - )(implicit ctx: AsyncWebApiContext): Unit = { + keyword: String, + componentsMap: YMap, + parse: YMapEntry => T, + model: DomainElementModel + )(implicit ctx: AsyncWebApiContext): Unit = { componentsMap.key( keyword, e => { diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async23DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async23DeclarationParser.scala new file mode 100644 index 0000000000..06bfea32dd --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async23DeclarationParser.scala @@ -0,0 +1,10 @@ +package amf.apicontract.internal.spec.async.parser.domain.declarations +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import org.yaml.model.YMap + +object Async23DeclarationParser extends AsyncDeclarationParser { + override def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + Async20DeclarationParser.parseDeclarations(map, parent) + // TODO: add stuff.... + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async24DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async24DeclarationParser.scala new file mode 100644 index 0000000000..426790e9d1 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async24DeclarationParser.scala @@ -0,0 +1,11 @@ +package amf.apicontract.internal.spec.async.parser.domain.declarations + +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import org.yaml.model.YMap + +object Async24DeclarationParser extends AsyncDeclarationParser { + override def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + Async23DeclarationParser.parseDeclarations(map, parent) + // TODO: add stuff.... + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/AsyncDeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/AsyncDeclarationParser.scala new file mode 100644 index 0000000000..a669b31f50 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/AsyncDeclarationParser.scala @@ -0,0 +1,8 @@ +package amf.apicontract.internal.spec.async.parser.domain.declarations + +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import org.yaml.model.YMap + +trait AsyncDeclarationParser { + def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit +} From 8dea723af24a72b936a0fa3cb25695c46e5807ad Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 29 Jan 2024 16:41:08 -0300 Subject: [PATCH 19/33] W-14875628 (feat): added document and declaration parsers for all async 2.x versions --- .../spec/async/Async20ParsePlugin.scala | 26 ++++++++++++--- .../internal/spec/async/AsyncHeader.scala | 14 +++++++- .../internal/spec/async/AsyncSpec.scala | 33 +++++++++++++++++++ .../document/AsyncApi20DocumentParser.scala | 7 ++-- .../document/AsyncApi21DocumentParser.scala | 28 ++++++++++++++++ .../document/AsyncApi22DocumentParser.scala | 12 +++++++ .../document/AsyncApi23DocumentParser.scala | 15 +++++++++ .../document/AsyncApi24DocumentParser.scala | 15 +++++++++ .../document/AsyncApi25DocumentParser.scala | 12 +++++++ .../document/AsyncApi26DocumentParser.scala | 12 +++++++ .../document/AsyncApiDocumentParser.scala | 6 ++-- .../Async21DeclarationParser.scala | 7 ++++ .../Async22DeclarationParser.scala | 7 ++++ .../Async25DeclarationParser.scala | 7 ++++ .../Async26DeclarationParser.scala | 7 ++++ 15 files changed, 197 insertions(+), 11 deletions(-) create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncSpec.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi21DocumentParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi22DocumentParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi23DocumentParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi24DocumentParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi25DocumentParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi26DocumentParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async21DeclarationParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async22DeclarationParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async25DeclarationParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async26DeclarationParser.scala diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala index 39b527aa8a..5e06fada59 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala @@ -1,9 +1,21 @@ package amf.apicontract.internal.spec.async -import amf.apicontract.internal.spec.async.AsyncHeader.Async20Header +import amf.apicontract.internal.spec.async.AsyncHeader.{ + Async20Header, + Async21Header, + Async22Header, + Async23Header, + Async24Header, + Async25Header, + Async26Header +} import amf.apicontract.internal.spec.async.parser.context.{Async20WebApiContext, AsyncWebApiContext} import amf.apicontract.internal.spec.async.parser.document -import amf.apicontract.internal.spec.async.parser.domain.declarations.Async20DeclarationParser +import amf.apicontract.internal.spec.async.parser.domain.declarations.{ + Async20DeclarationParser, + Async23DeclarationParser, + Async24DeclarationParser +} import amf.apicontract.internal.spec.common.AsyncWebApiDeclarations import amf.apicontract.internal.spec.oas.OasLikeParsePlugin import amf.apicontract.internal.spec.raml.Raml10ParsePlugin @@ -18,7 +30,7 @@ object Async20ParsePlugin extends OasLikeParsePlugin { override def spec: Spec = AsyncApi20 - override def applies(element: Root): Boolean = AsyncHeader(element).contains(Async20Header) + override def applies(element: Root): Boolean = AsyncHeader(element).isDefined override def validSpecsToReference: Seq[Spec] = super.validSpecsToReference :+ Raml10ParsePlugin.spec @@ -34,7 +46,13 @@ object Async20ParsePlugin extends OasLikeParsePlugin { private def parseAsyncUnit(root: Root)(implicit ctx: AsyncWebApiContext): BaseUnit = { AsyncHeader(root) match { - case Some(Async20Header) => document.AsyncApi20DocumentParser(root, Async20DeclarationParser).parseDocument() + case Some(Async20Header) => document.AsyncApi20DocumentParser(root).parseDocument() + case Some(Async21Header) => document.AsyncApi21DocumentParser(root).parseDocument() + case Some(Async22Header) => document.AsyncApi22DocumentParser(root).parseDocument() + case Some(Async23Header) => document.AsyncApi23DocumentParser(root).parseDocument() + case Some(Async24Header) => document.AsyncApi24DocumentParser(root).parseDocument() + case Some(Async25Header) => document.AsyncApi25DocumentParser(root).parseDocument() + case Some(Async26Header) => document.AsyncApi26DocumentParser(root).parseDocument() case _ => // unreachable as it is covered in canParse() throw new InvalidDocumentHeaderException(spec.id) } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala index 1a46a81c20..6c5484fa5a 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala @@ -5,7 +5,7 @@ import amf.core.internal.parser.{Root, YMapOps, YNodeLikeOps} import org.yaml.model.YMap /** */ -class AsyncHeader(val key: String, val value: String) { +sealed case class AsyncHeader(key: String, value: String) { def tuple: (String, String) = (key, value) } @@ -14,6 +14,12 @@ object AsyncHeader { val async = "asyncapi" object Async20Header extends AsyncHeader(async, "2.0.0") + object Async21Header extends AsyncHeader(async, "2.1.0") + object Async22Header extends AsyncHeader(async, "2.2.0") + object Async23Header extends AsyncHeader(async, "2.3.0") + object Async24Header extends AsyncHeader(async, "2.4.0") + object Async25Header extends AsyncHeader(async, "2.5.0") + object Async26Header extends AsyncHeader(async, "2.6.0") def apply(root: Root): Option[AsyncHeader] = root.parsed match { @@ -31,6 +37,12 @@ object AsyncHeader { def apply(text: String): Option[AsyncHeader] = { text match { case Async20Header.value => Some(Async20Header) + case Async21Header.value => Some(Async21Header) + case Async22Header.value => Some(Async22Header) + case Async23Header.value => Some(Async23Header) + case Async24Header.value => Some(Async24Header) + case Async25Header.value => Some(Async25Header) + case Async26Header.value => Some(Async26Header) case _ => None } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncSpec.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncSpec.scala new file mode 100644 index 0000000000..44766f846b --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncSpec.scala @@ -0,0 +1,33 @@ +package amf.apicontract.internal.spec.async + +import amf.core.internal.remote.{Async, Mimes, Spec} + +case object AsyncApi21 extends Async { + override def version: String = "2.0" + override val mediaType: String = Mimes.`application/yaml` +} + +case object AsyncApi22 extends Async { + override def version: String = "2.0" + override val mediaType: String = Mimes.`application/yaml` +} + +case object AsyncApi23 extends Async { + override def version: String = "2.0" + override val mediaType: String = Mimes.`application/yaml` +} + +case object AsyncApi24 extends Async { + override def version: String = "2.0" + override val mediaType: String = Mimes.`application/yaml` +} + +case object AsyncApi25 extends Async { + override def version: String = "2.0" + override val mediaType: String = Mimes.`application/yaml` +} + +case object AsyncApi26 extends Async { + override def version: String = "2.0" + override val mediaType: String = Mimes.`application/yaml` +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala index 41cd2732b7..f5399c4fed 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala @@ -1,9 +1,10 @@ package amf.apicontract.internal.spec.async.parser.document import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext -import amf.apicontract.internal.spec.async.parser.domain.declarations.AsyncDeclarationParser +import amf.apicontract.internal.spec.async.parser.domain.declarations.{Async20DeclarationParser, AsyncDeclarationParser} import amf.core.internal.parser.Root +import amf.core.internal.remote.Spec.ASYNC20 -case class AsyncApi20DocumentParser(root: Root, declarationParser: AsyncDeclarationParser)( +case class AsyncApi20DocumentParser(root: Root, declarationParser: AsyncDeclarationParser = Async20DeclarationParser)( override implicit val ctx: AsyncWebApiContext -) extends AsyncApiDocumentParser(root, declarationParser)(ctx) +) extends AsyncApiDocumentParser(root, ASYNC20, declarationParser)(ctx) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi21DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi21DocumentParser.scala new file mode 100644 index 0000000000..26d17d11b6 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi21DocumentParser.scala @@ -0,0 +1,28 @@ +package amf.apicontract.internal.spec.async.parser.document + +import amf.apicontract.client.scala.model.domain.api.AsyncApi +import amf.apicontract.internal.spec.async.{AsyncApi21, AsyncApi22} +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.async.parser.domain.declarations.{ + Async21DeclarationParser, + Async22DeclarationParser, + AsyncDeclarationParser +} +import amf.core.internal.parser.Root +import amf.core.internal.remote.Spec +import org.yaml.model.YMap + +object AsyncApi21DocumentParser { + def apply(root: Root)(implicit ctx: AsyncWebApiContext): AsyncApi21DocumentParser = + AsyncApi21DocumentParser(root, AsyncApi21, Async21DeclarationParser()) +} + +case class AsyncApi21DocumentParser(root: Root, spec: Spec, declarationParser: AsyncDeclarationParser)( + override implicit val ctx: AsyncWebApiContext +) extends AsyncApiDocumentParser(root, spec, declarationParser)(ctx) { + + override protected def parseApi(map: YMap): AsyncApi = { + super.parseApi(map) + // TODO: add stuff here + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi22DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi22DocumentParser.scala new file mode 100644 index 0000000000..f2519347d3 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi22DocumentParser.scala @@ -0,0 +1,12 @@ +package amf.apicontract.internal.spec.async.parser.document + +import amf.apicontract.internal.spec.async.{AsyncApi21, AsyncApi22} +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.async.parser.domain.declarations.Async22DeclarationParser +import amf.core.internal.parser.Root + +object AsyncApi22DocumentParser { + // Doesn't add new functionality to previous version + def apply(root: Root)(implicit ctx: AsyncWebApiContext) = + AsyncApi21DocumentParser(root, AsyncApi22, Async22DeclarationParser()) +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi23DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi23DocumentParser.scala new file mode 100644 index 0000000000..a410ff4f36 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi23DocumentParser.scala @@ -0,0 +1,15 @@ +package amf.apicontract.internal.spec.async.parser.document + +import amf.apicontract.internal.spec.async.{AsyncApi21, AsyncApi22, AsyncApi23} +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.async.parser.domain.declarations.{ + Async22DeclarationParser, + Async23DeclarationParser +} +import amf.core.internal.parser.Root + +object AsyncApi23DocumentParser { + // Doesn't add new functionality to previous version + def apply(root: Root)(implicit ctx: AsyncWebApiContext) = + AsyncApi21DocumentParser(root, AsyncApi23, Async23DeclarationParser) +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi24DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi24DocumentParser.scala new file mode 100644 index 0000000000..16761eb757 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi24DocumentParser.scala @@ -0,0 +1,15 @@ +package amf.apicontract.internal.spec.async.parser.document + +import amf.apicontract.internal.spec.async.{AsyncApi22, AsyncApi24} +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.async.parser.domain.declarations.{ + Async22DeclarationParser, + Async24DeclarationParser +} +import amf.core.internal.parser.Root + +object AsyncApi24DocumentParser { + // Doesn't add new functionality to previous version + def apply(root: Root)(implicit ctx: AsyncWebApiContext) = + AsyncApi21DocumentParser(root, AsyncApi24, Async24DeclarationParser) +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi25DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi25DocumentParser.scala new file mode 100644 index 0000000000..77219981a0 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi25DocumentParser.scala @@ -0,0 +1,12 @@ +package amf.apicontract.internal.spec.async.parser.document + +import amf.apicontract.internal.spec.async.AsyncApi25 +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.async.parser.domain.declarations.Async25DeclarationParser +import amf.core.internal.parser.Root + +object AsyncApi25DocumentParser { + // Doesn't add new functionality to previous version + def apply(root: Root)(implicit ctx: AsyncWebApiContext) = + AsyncApi21DocumentParser(root, AsyncApi25, Async25DeclarationParser()) +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi26DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi26DocumentParser.scala new file mode 100644 index 0000000000..93ff7c9fae --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi26DocumentParser.scala @@ -0,0 +1,12 @@ +package amf.apicontract.internal.spec.async.parser.document + +import amf.apicontract.internal.spec.async.AsyncApi26 +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.async.parser.domain.declarations.Async26DeclarationParser +import amf.core.internal.parser.Root + +object AsyncApi26DocumentParser { + // Doesn't add new functionality to previous version + def apply(root: Root)(implicit ctx: AsyncWebApiContext) = + AsyncApi21DocumentParser(root, AsyncApi26, Async26DeclarationParser()) +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala index d448fd5233..beca4ee8b7 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala @@ -46,7 +46,7 @@ import amf.core.internal.remote.Spec import amf.shapes.internal.spec.common.parser.{AnnotationParser, OasLikeCreativeWorkParser, YMapEntryLike} import org.yaml.model.{YMap, YMapEntry, YType} -abstract class AsyncApiDocumentParser(root: Root, declarationParser: AsyncDeclarationParser)(implicit +abstract class AsyncApiDocumentParser(root: Root, spec: Spec, declarationParser: AsyncDeclarationParser)(implicit val ctx: AsyncWebApiContext ) extends AsyncApiSpecParser with OasLikeDeclarationsHelper { @@ -54,7 +54,7 @@ abstract class AsyncApiDocumentParser(root: Root, declarationParser: AsyncDeclar def parseDocument(): Document = parseDocument(Document()) private def parseDocument[T <: Document](document: T): T = { - document.withLocation(root.location).withProcessingData(APIContractProcessingData().withSourceSpec(Spec.ASYNC20)) + document.withLocation(root.location).withProcessingData(APIContractProcessingData().withSourceSpec(spec)) val map = root.parsed.asInstanceOf[SyamlParsedDocument].document.as[YMap] ctx.setJsonSchemaAST(map) @@ -83,7 +83,7 @@ abstract class AsyncApiDocumentParser(root: Root, declarationParser: AsyncDeclar } } - def parseApi(map: YMap): AsyncApi = { + protected def parseApi(map: YMap): AsyncApi = { YamlTagValidator.validate(root) val api = AsyncApi(root.parsed.asInstanceOf[SyamlParsedDocument].document.node) map.key("info", entry => OasLikeInformationParser(entry, api, ctx).parse()) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async21DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async21DeclarationParser.scala new file mode 100644 index 0000000000..06662b2cd5 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async21DeclarationParser.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.domain.declarations + +object Async21DeclarationParser { + + // Doesn't add new functionality to previous version + def apply(): AsyncDeclarationParser = Async20DeclarationParser +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async22DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async22DeclarationParser.scala new file mode 100644 index 0000000000..13491a721e --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async22DeclarationParser.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.domain.declarations + +object Async22DeclarationParser { + + // Doesn't add new functionality to previous version + def apply(): AsyncDeclarationParser = Async21DeclarationParser() +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async25DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async25DeclarationParser.scala new file mode 100644 index 0000000000..8c905ca505 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async25DeclarationParser.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.domain.declarations + +object Async25DeclarationParser { + + // Doesn't add new functionality to previous version + def apply(): AsyncDeclarationParser = Async24DeclarationParser +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async26DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async26DeclarationParser.scala new file mode 100644 index 0000000000..c8cff85420 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async26DeclarationParser.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.domain.declarations + +object Async26DeclarationParser { + + // Doesn't add new functionality to previous version + def apply(): AsyncDeclarationParser = Async24DeclarationParser +} From 157e6a7fcdc97650e2f328528796f745c73495fa Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 29 Jan 2024 17:09:13 -0300 Subject: [PATCH 20/33] W-14875628 (feat): support for different syntax versions --- .../spec/async/Async20ParsePlugin.scala | 38 ++-- .../internal/spec/async/AsyncHeader.scala | 17 +- .../parser/context/Async20WebApiContext.scala | 34 ---- .../parser/context/Async2WebApiContext.scala | 182 ++++++++++++++++++ .../context/{ => syntax}/Async20Syntax.scala | 2 +- .../parser/context/syntax/Async21Syntax.scala | 7 + .../parser/context/syntax/Async22Syntax.scala | 7 + .../parser/context/syntax/Async23Syntax.scala | 7 + .../parser/context/syntax/Async24Syntax.scala | 7 + .../parser/context/syntax/Async25Syntax.scala | 7 + .../parser/context/syntax/Async26Syntax.scala | 7 + .../spec/jsonschema/ref/AstIndexTest.scala | 4 +- .../resolution/merge/JsonMergePatchTest.scala | 13 +- .../spec/async/parser/Async2Settings.scala | 4 +- 14 files changed, 267 insertions(+), 69 deletions(-) delete mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async20WebApiContext.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala rename amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/{ => syntax}/Async20Syntax.scala (98%) create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async21Syntax.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async22Syntax.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async23Syntax.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async24Syntax.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async25Syntax.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async26Syntax.scala diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala index 5e06fada59..59de7e1cd1 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala @@ -9,7 +9,7 @@ import amf.apicontract.internal.spec.async.AsyncHeader.{ Async25Header, Async26Header } -import amf.apicontract.internal.spec.async.parser.context.{Async20WebApiContext, AsyncWebApiContext} +import amf.apicontract.internal.spec.async.parser.context.{Async2WebApiContext, AsyncWebApiContext} import amf.apicontract.internal.spec.async.parser.document import amf.apicontract.internal.spec.async.parser.domain.declarations.{ Async20DeclarationParser, @@ -38,22 +38,27 @@ object Async20ParsePlugin extends OasLikeParsePlugin { override def mediaTypes: Seq[String] = Seq(Mimes.`application/yaml`, Mimes.`application/json`) override def parse(document: Root, ctx: ParserContext): BaseUnit = { - implicit val newCtx: AsyncWebApiContext = context(document.location, document.references, ctx.parsingOptions, ctx) + val header = parseHeader(document) + implicit val newCtx: AsyncWebApiContext = + context(document.location, document.references, ctx.parsingOptions, ctx, spec = header.spec) restrictCrossSpecReferences(document, ctx) - val parsed = parseAsyncUnit(document) + val parsed = parseAsyncUnit(header, document) promoteFragments(parsed, newCtx) } - private def parseAsyncUnit(root: Root)(implicit ctx: AsyncWebApiContext): BaseUnit = { - AsyncHeader(root) match { - case Some(Async20Header) => document.AsyncApi20DocumentParser(root).parseDocument() - case Some(Async21Header) => document.AsyncApi21DocumentParser(root).parseDocument() - case Some(Async22Header) => document.AsyncApi22DocumentParser(root).parseDocument() - case Some(Async23Header) => document.AsyncApi23DocumentParser(root).parseDocument() - case Some(Async24Header) => document.AsyncApi24DocumentParser(root).parseDocument() - case Some(Async25Header) => document.AsyncApi25DocumentParser(root).parseDocument() - case Some(Async26Header) => document.AsyncApi26DocumentParser(root).parseDocument() - case _ => // unreachable as it is covered in canParse() + private def parseHeader(root: Root): AsyncHeader = + AsyncHeader(root).getOrElse(throw new InvalidDocumentHeaderException(spec.id)) + + private def parseAsyncUnit(header: AsyncHeader, root: Root)(implicit ctx: AsyncWebApiContext): BaseUnit = { + header match { + case Async20Header => document.AsyncApi20DocumentParser(root).parseDocument() + case Async21Header => document.AsyncApi21DocumentParser(root).parseDocument() + case Async22Header => document.AsyncApi22DocumentParser(root).parseDocument() + case Async23Header => document.AsyncApi23DocumentParser(root).parseDocument() + case Async24Header => document.AsyncApi24DocumentParser(root).parseDocument() + case Async25Header => document.AsyncApi25DocumentParser(root).parseDocument() + case Async26Header => document.AsyncApi26DocumentParser(root).parseDocument() + case _ => throw new InvalidDocumentHeaderException(spec.id) } } @@ -63,11 +68,12 @@ object Async20ParsePlugin extends OasLikeParsePlugin { refs: Seq[ParsedReference], options: ParsingOptions, wrapped: ParserContext, - ds: Option[AsyncWebApiDeclarations] = None - ): Async20WebApiContext = { + ds: Option[AsyncWebApiDeclarations] = None, + spec: Spec + ): Async2WebApiContext = { // ensure unresolved references in external fragments are not resolved with main api definitions val cleanContext = wrapped.copy(futureDeclarations = EmptyFutureDeclarations()) cleanContext.globalSpace = wrapped.globalSpace - new Async20WebApiContext(loc, refs, cleanContext, ds, options = options) + Async2WebApiContext(loc, refs, cleanContext, ds, options, spec) } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala index 6c5484fa5a..240af1b2df 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala @@ -2,10 +2,11 @@ package amf.apicontract.internal.spec.async import amf.core.client.scala.parse.document.SyamlParsedDocument import amf.core.internal.parser.{Root, YMapOps, YNodeLikeOps} +import amf.core.internal.remote.{AsyncApi20, Spec} import org.yaml.model.YMap /** */ -sealed case class AsyncHeader(key: String, value: String) { +sealed case class AsyncHeader private (key: String, value: String, spec: Spec) { def tuple: (String, String) = (key, value) } @@ -13,13 +14,13 @@ object AsyncHeader { val async = "asyncapi" - object Async20Header extends AsyncHeader(async, "2.0.0") - object Async21Header extends AsyncHeader(async, "2.1.0") - object Async22Header extends AsyncHeader(async, "2.2.0") - object Async23Header extends AsyncHeader(async, "2.3.0") - object Async24Header extends AsyncHeader(async, "2.4.0") - object Async25Header extends AsyncHeader(async, "2.5.0") - object Async26Header extends AsyncHeader(async, "2.6.0") + object Async20Header extends AsyncHeader(async, "2.0.0", AsyncApi20) + object Async21Header extends AsyncHeader(async, "2.1.0", AsyncApi21) + object Async22Header extends AsyncHeader(async, "2.2.0", AsyncApi22) + object Async23Header extends AsyncHeader(async, "2.3.0", AsyncApi23) + object Async24Header extends AsyncHeader(async, "2.4.0", AsyncApi24) + object Async25Header extends AsyncHeader(async, "2.5.0", AsyncApi25) + object Async26Header extends AsyncHeader(async, "2.6.0", AsyncApi26) def apply(root: Root): Option[AsyncHeader] = root.parsed match { diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async20WebApiContext.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async20WebApiContext.scala deleted file mode 100644 index ee7efd92b6..0000000000 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async20WebApiContext.scala +++ /dev/null @@ -1,34 +0,0 @@ -package amf.apicontract.internal.spec.async.parser.context - -import amf.apicontract.internal.spec.common.AsyncWebApiDeclarations -import amf.core.client.scala.config.ParsingOptions -import amf.core.client.scala.parse.document.{ParsedReference, ParserContext} -import amf.core.internal.remote.{AsyncApi20, Spec} -import amf.shapes.internal.spec.async -import amf.shapes.internal.spec.async.parser.Async2Settings -import amf.shapes.internal.spec.common.parser.SpecSyntax -import amf.shapes.internal.spec.oas.parser - -import scala.collection.mutable - -class Async20WebApiContext( - loc: String, - refs: Seq[ParsedReference], - private val wrapped: ParserContext, - private val ds: Option[AsyncWebApiDeclarations] = None, - private val operationIds: mutable.Set[String] = mutable.HashSet(), - options: ParsingOptions = ParsingOptions() -) extends AsyncWebApiContext( - loc, - refs, - options, - wrapped, - ds, - operationIds, - async.parser.Async2Settings(Async20Syntax) - ) { - override val factory: Async20VersionFactory = Async20VersionFactory()(this) - - override def makeCopy(): Async20WebApiContext = - new Async20WebApiContext(rootContextDocument, refs, this, Some(declarations), operationIds, options) -} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala new file mode 100644 index 0000000000..05e8b27d2b --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala @@ -0,0 +1,182 @@ +package amf.apicontract.internal.spec.async.parser.context + +import amf.apicontract.internal.spec.async._ +import amf.apicontract.internal.spec.async.parser.context.syntax.{ + Async20Syntax, + Async21Syntax, + Async22Syntax, + Async23Syntax, + Async24Syntax, + Async25Syntax, + Async26Syntax +} +import amf.apicontract.internal.spec.common.AsyncWebApiDeclarations +import amf.core.client.scala.config.ParsingOptions +import amf.core.client.scala.parse.document.{ParsedReference, ParserContext} +import amf.core.internal.remote.{AsyncApi20, Spec} +import amf.shapes.internal.spec.async.parser.Async2Settings +import amf.shapes.internal.spec.common.parser.SpecSettings + +import scala.collection.mutable + +object Async2WebApiContext { + + def apply( + location: String, + refs: Seq[ParsedReference], + wrapped: ParserContext, + declarations: Option[AsyncWebApiDeclarations], + options: ParsingOptions, + spec: Spec + ): Async2WebApiContext = spec match { + case AsyncApi20 => async20(location, refs, wrapped, declarations, options) + case AsyncApi21 => async21(location, refs, wrapped, declarations, options) + case AsyncApi22 => async22(location, refs, wrapped, declarations, options) + case AsyncApi23 => async23(location, refs, wrapped, declarations, options) + case AsyncApi24 => async24(location, refs, wrapped, declarations, options) + case AsyncApi25 => async25(location, refs, wrapped, declarations, options) + case AsyncApi26 => async26(location, refs, wrapped, declarations, options) + } + + def async20( + location: String, + refs: Seq[ParsedReference], + wrapped: ParserContext, + declarations: Option[AsyncWebApiDeclarations], + options: ParsingOptions + ): Async2WebApiContext = { + context(location, refs, wrapped, declarations, options)(AsyncApi20) + } + + def async21( + location: String, + refs: Seq[ParsedReference], + wrapped: ParserContext, + declarations: Option[AsyncWebApiDeclarations], + options: ParsingOptions + ): Async2WebApiContext = { + context(location, refs, wrapped, declarations, options)(AsyncApi21) + } + + def async22( + location: String, + refs: Seq[ParsedReference], + wrapped: ParserContext, + declarations: Option[AsyncWebApiDeclarations], + options: ParsingOptions + ): Async2WebApiContext = { + context(location, refs, wrapped, declarations, options)(AsyncApi22) + } + + def async23( + location: String, + refs: Seq[ParsedReference], + wrapped: ParserContext, + declarations: Option[AsyncWebApiDeclarations], + options: ParsingOptions + ): Async2WebApiContext = { + context(location, refs, wrapped, declarations, options)(AsyncApi23) + } + + def async24( + location: String, + refs: Seq[ParsedReference], + wrapped: ParserContext, + declarations: Option[AsyncWebApiDeclarations], + options: ParsingOptions + ): Async2WebApiContext = { + context(location, refs, wrapped, declarations, options)(AsyncApi24) + } + + def async25( + location: String, + refs: Seq[ParsedReference], + wrapped: ParserContext, + declarations: Option[AsyncWebApiDeclarations], + options: ParsingOptions + ): Async2WebApiContext = { + context(location, refs, wrapped, declarations, options)(AsyncApi25) + } + + def async26( + location: String, + refs: Seq[ParsedReference], + wrapped: ParserContext, + declarations: Option[AsyncWebApiDeclarations], + options: ParsingOptions + ): Async2WebApiContext = { + context(location, refs, wrapped, declarations, options)(AsyncApi26) + } + + private def context( + location: String, + refs: Seq[ParsedReference], + wrapped: ParserContext, + declarations: Option[AsyncWebApiDeclarations], + options: ParsingOptions + )(spec: Spec): Async2WebApiContext = { + new Async2WebApiContext( + location, + refs, + wrapped, + declarations, + mutable.HashSet.empty, + options, + settings(spec), + factory(spec) + ) + } + + private def settings(spec: Spec) = spec match { + case AsyncApi20 => Async2Settings(Async20Syntax, AsyncApi20) + case AsyncApi21 => Async2Settings(Async21Syntax, AsyncApi21) + case AsyncApi22 => Async2Settings(Async22Syntax, AsyncApi22) + case AsyncApi23 => Async2Settings(Async23Syntax, AsyncApi23) + case AsyncApi24 => Async2Settings(Async24Syntax, AsyncApi24) + case AsyncApi25 => Async2Settings(Async25Syntax, AsyncApi25) + case AsyncApi26 => Async2Settings(Async26Syntax, AsyncApi26) + } + + private def factory(spec: Spec): Async2WebApiContext => AsyncSpecVersionFactory = spec match { + case AsyncApi20 => ctx => Async20VersionFactory()(ctx) + case AsyncApi21 => ctx => Async20VersionFactory()(ctx) + case AsyncApi22 => ctx => Async20VersionFactory()(ctx) + case AsyncApi23 => ctx => Async20VersionFactory()(ctx) + case AsyncApi24 => ctx => Async20VersionFactory()(ctx) + case AsyncApi25 => ctx => Async20VersionFactory()(ctx) + case AsyncApi26 => ctx => Async20VersionFactory()(ctx) + } +} + +class Async2WebApiContext private ( + loc: String, + refs: Seq[ParsedReference], + private val wrapped: ParserContext, + private val ds: Option[AsyncWebApiDeclarations] = None, + private val operationIds: mutable.Set[String] = mutable.HashSet(), + options: ParsingOptions = ParsingOptions(), + settings: SpecSettings, + factoryFactory: Async2WebApiContext => AsyncSpecVersionFactory +) extends AsyncWebApiContext( + loc, + refs, + options, + wrapped, + ds, + operationIds, + settings + ) { + + override val factory: AsyncSpecVersionFactory = factoryFactory(this) + override def makeCopy(): Async2WebApiContext = + new Async2WebApiContext( + rootContextDocument, + refs, + this, + Some(declarations), + operationIds, + options, + settings, + factoryFactory + ) +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async20Syntax.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async20Syntax.scala similarity index 98% rename from amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async20Syntax.scala rename to amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async20Syntax.scala index 531aeb5af0..ac1022bb0d 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async20Syntax.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async20Syntax.scala @@ -1,4 +1,4 @@ -package amf.apicontract.internal.spec.async.parser.context +package amf.apicontract.internal.spec.async.parser.context.syntax import amf.shapes.internal.spec.async.parser.Async20ShapeSyntax import amf.shapes.internal.spec.common.parser.SpecSyntax diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async21Syntax.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async21Syntax.scala new file mode 100644 index 0000000000..7d056ab879 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async21Syntax.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.context.syntax + +import amf.shapes.internal.spec.common.parser.SpecSyntax + +object Async21Syntax extends SpecSyntax { + override val nodes: Map[String, Set[String]] = Async20Syntax.nodes +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async22Syntax.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async22Syntax.scala new file mode 100644 index 0000000000..1352538ad1 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async22Syntax.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.context.syntax + +import amf.shapes.internal.spec.common.parser.SpecSyntax + +object Async22Syntax extends SpecSyntax { + override val nodes: Map[String, Set[String]] = Async21Syntax.nodes +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async23Syntax.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async23Syntax.scala new file mode 100644 index 0000000000..0e4418ca66 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async23Syntax.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.context.syntax + +import amf.shapes.internal.spec.common.parser.SpecSyntax + +object Async23Syntax extends SpecSyntax { + override val nodes: Map[String, Set[String]] = Async22Syntax.nodes +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async24Syntax.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async24Syntax.scala new file mode 100644 index 0000000000..8af30df7f7 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async24Syntax.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.context.syntax + +import amf.shapes.internal.spec.common.parser.SpecSyntax + +object Async24Syntax extends SpecSyntax { + override val nodes: Map[String, Set[String]] = Async23Syntax.nodes +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async25Syntax.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async25Syntax.scala new file mode 100644 index 0000000000..5ed1c534fa --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async25Syntax.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.context.syntax + +import amf.shapes.internal.spec.common.parser.SpecSyntax + +object Async25Syntax extends SpecSyntax { + override val nodes: Map[String, Set[String]] = Async24Syntax.nodes +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async26Syntax.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async26Syntax.scala new file mode 100644 index 0000000000..a429bf5308 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async26Syntax.scala @@ -0,0 +1,7 @@ +package amf.apicontract.internal.spec.async.parser.context.syntax + +import amf.shapes.internal.spec.common.parser.SpecSyntax + +object Async26Syntax extends SpecSyntax { + override val nodes: Map[String, Set[String]] = Async25Syntax.nodes +} diff --git a/amf-api-contract/shared/src/test/scala/amf/shapes/internal/spec/jsonschema/ref/AstIndexTest.scala b/amf-api-contract/shared/src/test/scala/amf/shapes/internal/spec/jsonschema/ref/AstIndexTest.scala index 0868794b74..cd6e1c1db1 100644 --- a/amf-api-contract/shared/src/test/scala/amf/shapes/internal/spec/jsonschema/ref/AstIndexTest.scala +++ b/amf-api-contract/shared/src/test/scala/amf/shapes/internal/spec/jsonschema/ref/AstIndexTest.scala @@ -1,7 +1,7 @@ package amf.shapes.internal.spec.jsonschema.ref import amf.aml.internal.registries.AMLRegistry -import amf.apicontract.internal.spec.async.parser.context.Async20WebApiContext +import amf.apicontract.internal.spec.async.parser.context.Async2WebApiContext import amf.core.client.scala.errorhandling.UnhandledErrorHandler import amf.core.client.scala.parse.document.ParserContext import amf.core.internal.parser.{LimitedParseConfig, YMapOps} @@ -170,7 +170,7 @@ trait IndexHelper extends PlatformSecrets { val content = platform.fs.syncFile(pathToFile).read() val doc = JsonParser(content).document() implicit val ctx = - new Async20WebApiContext( + new Async2WebApiContext( "loc", Seq(), ParserContext(config = LimitedParseConfig(UnhandledErrorHandler, AMLRegistry.empty)) diff --git a/amf-cli/shared/src/test/scala/amf/resolution/merge/JsonMergePatchTest.scala b/amf-cli/shared/src/test/scala/amf/resolution/merge/JsonMergePatchTest.scala index 9d9425c8b9..989b5517f6 100644 --- a/amf-cli/shared/src/test/scala/amf/resolution/merge/JsonMergePatchTest.scala +++ b/amf-cli/shared/src/test/scala/amf/resolution/merge/JsonMergePatchTest.scala @@ -4,12 +4,12 @@ import amf.aml.internal.registries.AMLRegistry import amf.apicontract.client.scala.model.document.APIContractProcessingData import amf.apicontract.client.scala.model.domain.{Message, Operation} import amf.apicontract.internal.spec.async.Subscribe -import amf.apicontract.internal.spec.async.parser.context.{Async20WebApiContext, AsyncWebApiContext} +import amf.apicontract.internal.spec.async.parser.context.{Async2WebApiContext, AsyncWebApiContext} import amf.apicontract.internal.spec.async.parser.domain.{AsyncMessageParser, AsyncOperationParser} import amf.apicontract.internal.spec.async.transformation.AsyncJsonMergePatch import amf.apicontract.internal.spec.common.transformation.stage.{AsyncKeyCriteria, JsonMergePatch} import amf.core.client.scala.adoption.IdAdopter -import amf.core.client.scala.config.RenderOptions +import amf.core.client.scala.config.{ParsingOptions, RenderOptions} import amf.core.client.scala.errorhandling.DefaultErrorHandler import amf.core.client.scala.model.document.Document import amf.core.client.scala.model.domain.{AmfElement, AmfObject, DataNode, ScalarNode} @@ -17,7 +17,7 @@ import amf.core.client.scala.parse.document.ParserContext import amf.core.internal.convert.BaseUnitConverter import amf.core.internal.datanode.{DataNodeEmitter, DataNodeParser} import amf.core.internal.parser._ -import amf.core.internal.remote.AmfJsonHint +import amf.core.internal.remote.{AmfJsonHint, AsyncApi20} import amf.core.internal.render.BaseEmitters.traverse import amf.core.internal.render.SpecOrdering import amf.emit.AMFRenderer @@ -142,10 +142,13 @@ class JsonMergePatchTest extends MultiJsonldAsyncFunSuite with Matchers with Fil } def getBogusParserCtx: AsyncWebApiContext = - new Async20WebApiContext( + Async2WebApiContext( "loc", Seq(), - ParserContext(config = LimitedParseConfig(DefaultErrorHandler(), AMLRegistry.empty)) + ParserContext(config = LimitedParseConfig(DefaultErrorHandler(), AMLRegistry.empty)), + None, + ParsingOptions(), + spec = AsyncApi20 ) def renderToString(document: Document, renderOptions: RenderOptions = defaultRenderOptions): String = diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/async/parser/Async2Settings.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/async/parser/Async2Settings.scala index 39935c8e8f..e70147c0ce 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/async/parser/Async2Settings.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/async/parser/Async2Settings.scala @@ -10,9 +10,7 @@ import amf.shapes.internal.spec.common.{JSONSchemaDraft7SchemaVersion, SchemaVer import amf.shapes.internal.spec.oas.parser.{OasLikeIgnoreCriteria, OasLink} import org.yaml.model.YNode -case class Async2Settings(syntax: SpecSyntax) extends SpecSettings { - override val spec: Spec = ASYNC20 - +case class Async2Settings private (syntax: SpecSyntax, spec: Spec) extends SpecSettings { override def link(node: YNode)(implicit eh: SyamlAMFErrorHandler): Either[String, YNode] = OasLink.getLinkValue(node) override def ignoreCriteria: IgnoreCriteria = OasLikeIgnoreCriteria From 0b25e7dc9e73112be598cdc4e333795f41270d71 Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 29 Jan 2024 17:24:36 -0300 Subject: [PATCH 21/33] W-14875628 (feat): added primitive to add nodes to a SpecSyntax --- .../spec/async/parser/context/syntax/package.scala | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/package.scala diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/package.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/package.scala new file mode 100644 index 0000000000..b121950919 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/package.scala @@ -0,0 +1,9 @@ +package amf.apicontract.internal.spec.async.parser.context + +package object syntax { + + def add(syntax: Map[String, Set[String]], key: String, values: Set[String]): Map[String, Set[String]] = { + val nextSet = syntax.getOrElse(key, Set.empty) ++ values + syntax + (key -> nextSet) + } +} From b7439a778b4f1d986d8512f8afb13d04675ef141 Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 29 Jan 2024 18:11:53 -0300 Subject: [PATCH 22/33] W-14875628 (refactor): extracted each binding parsing behind an interface to be able to mix and match them --- .../parser/bindings/AsyncBindingsParser.scala | 48 +-------- .../bindings/AsyncChannelBindingsParser.scala | 97 ++----------------- .../bindings/AsyncMessageBindingsParser.scala | 47 ++------- .../AsyncOperationBindingsParser.scala | 66 ++----------- .../bindings/AsyncServerBindingsParser.scala | 34 +------ .../async/parser/bindings/BindingParser.scala | 50 ++++++++++ .../parser/bindings/EmptyBindingParser.scala | 27 ++++++ .../channel/AmqpChannelBindingParser.scala | 92 ++++++++++++++++++ .../WebSocketsChannelBindingParser.scala | 28 ++++++ .../message/Amqp091MessageBindingParser.scala | 24 +++++ .../message/HttpMessageBindingParser.scala | 24 +++++ .../message/KafkaMessageBindingParser.scala | 23 +++++ .../message/MqttMessageBindingParser.scala | 22 +++++ .../Amqp091OperationBindingParser.scala | 33 +++++++ .../HttpOperationBindingParser.scala | 25 +++++ .../KafkaOperationBindingParser.scala | 31 ++++++ .../MqttOperationBindingParser.scala | 24 +++++ .../server/MqttServerBindingParser.scala | 46 +++++++++ 18 files changed, 480 insertions(+), 261 deletions(-) create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/BindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/EmptyBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/channel/AmqpChannelBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/channel/WebSocketsChannelBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/Amqp091MessageBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/HttpMessageBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/KafkaMessageBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/MqttMessageBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/Amqp091OperationBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/HttpOperationBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/KafkaOperationBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/MqttOperationBindingParser.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/server/MqttServerBindingParser.scala diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala index f0913e5f4d..8bab04a705 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala @@ -131,53 +131,7 @@ abstract class AsyncBindingsParser(entryLike: YMapEntryLike)(implicit ctx: Async parseEmptyBinding(entry, parent) protected def parseEmptyBinding(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = { - val binding = EmptyBinding(Annotations(entry)) - - validateEmptyMap(entry.value, binding, entry.key.as[String]) - - binding.asInstanceOf[Binding] - } - - private def validateEmptyMap(value: YNode, node: AmfObject, `type`: String)(implicit ctx: AsyncWebApiContext): Unit = - if (value.as[YMap].entries.nonEmpty) { - ctx.eh.violation( - ParserSideValidations.NonEmptyBindingMap, - node, - s"Reserved name binding '${`type`}' must have an empty map", - value.location - ) - } - - protected def parseBindingVersion(binding: BindingVersion, field: Field, map: YMap)(implicit - ctx: AsyncWebApiContext - ): Unit = { - map.key("bindingVersion", field in binding) - - if (bindingVersionIsEmpty(binding)) setDefaultBindingVersionValue(binding, field) - } - - private def setDefaultBindingVersionValue(binding: BindingVersion, field: Field) = { - binding.setWithoutId(field, AmfScalar("latest"), Annotations.synthesized()) - } - - private def bindingVersionIsEmpty(binding: BindingVersion) = { - binding.bindingVersion.isNullOrEmpty - } - - protected def parseSchema(field: Field, binding: DomainElement, entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): Unit = { - OasTypeParser( - YMapEntryLike(entry.value), - "schema", - shape => shape.withName("schema"), - JSONSchemaDraft7SchemaVersion - ) - .parse() - .foreach { shape => - binding.setWithoutId(field, shape, Annotations(entry)) - shape - } + EmptyBindingParser.parse(entry, parent).asInstanceOf[Binding] } private def setBindingType(entry: YMapEntry, binding: Binding): Binding = { diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncChannelBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncChannelBindingsParser.scala index 45ac4ed487..400e64e79d 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncChannelBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncChannelBindingsParser.scala @@ -1,22 +1,19 @@ package amf.apicontract.internal.spec.async.parser.bindings -import amf.apicontract.client.scala.model.domain.bindings.amqp.{ - Amqp091ChannelBinding, - Amqp091ChannelExchange, - Amqp091Queue -} -import amf.apicontract.client.scala.model.domain.bindings.websockets.WebSocketsChannelBinding import amf.apicontract.client.scala.model.domain.bindings.{ChannelBinding, ChannelBindings} import amf.apicontract.internal.metamodel.domain.bindings._ +import amf.apicontract.internal.spec.async.parser.bindings.channel.{ + Amqp091ChannelBindingParser, + WebSocketsChannelBindingParser +} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.common.WebApiDeclarations.ErrorChannelBindings import amf.apicontract.internal.spec.spec.OasDefinitions -import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} +import amf.core.client.scala.model.domain.AmfScalar import amf.core.internal.metamodel.Field -import amf.core.internal.parser.YMapOps import amf.core.internal.parser.domain.{Annotations, SearchScope} import amf.shapes.internal.spec.common.parser.YMapEntryLike -import org.yaml.model.{YMap, YMapEntry} +import org.yaml.model.YMapEntry case class AsyncChannelBindingsParser(entryLike: YMapEntryLike)(implicit ctx: AsyncWebApiContext) extends AsyncBindingsParser(entryLike) { @@ -49,88 +46,10 @@ case class AsyncChannelBindingsParser(entryLike: YMapEntryLike)(implicit ctx: As override protected def parseAmqp(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): ChannelBinding = { - val binding = Amqp091ChannelBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key("is", Amqp091ChannelBindingModel.Is in binding) - - // Default channel type is 'routingKey'. - if (binding.is.isNullOrEmpty) { - binding.setWithoutId(Amqp091ChannelBindingModel.Is, AmfScalar("routingKey"), Annotations.synthesized()) - } - parseQueue(binding, map) - parseExchange(binding, map) - - parseBindingVersion(binding, WebSocketsChannelBindingModel.BindingVersion, map) - ctx.closedShape(binding, map, "amqpChannelBinding") - binding - } - - private def parseExchange(binding: Amqp091ChannelBinding, map: YMap)(implicit ctx: AsyncWebApiContext): Unit = { - map.key( - "exchange", - { entry => - val exchange = Amqp091ChannelExchange(Annotations(entry.value)) - val exchangeMap = entry.value.as[YMap] - - exchangeMap.key("name", Amqp091ChannelExchangeModel.Name in exchange) // TODO validate maxlength 255 - exchangeMap.key("type", Amqp091ChannelExchangeModel.Type in exchange) - exchangeMap.key("durable", Amqp091ChannelExchangeModel.Durable in exchange) - exchangeMap.key("autoDelete", Amqp091ChannelExchangeModel.AutoDelete in exchange) - - parseVHost(exchange, Amqp091ChannelExchangeModel.VHost, exchangeMap) - - ctx.closedShape(exchange, exchangeMap, "amqpExchangeChannelBinding") - - binding.setWithoutId(Amqp091ChannelBindingModel.Exchange, exchange, Annotations(entry)) - } - ) - } - - private def parseQueue(binding: Amqp091ChannelBinding, map: YMap)(implicit ctx: AsyncWebApiContext): Unit = { - map.key( - "queue", - { entry => - val queue = Amqp091Queue(Annotations(entry.value)) - val queueMap = entry.value.as[YMap] - - queueMap.key("name", Amqp091QueueModel.Name in queue) // TODO validate maxlength 255 - queueMap.key("durable", Amqp091QueueModel.Durable in queue) - queueMap.key("exclusive", Amqp091QueueModel.Exclusive in queue) - queueMap.key("autoDelete", Amqp091QueueModel.AutoDelete in queue) - - parseVHost(queue, Amqp091QueueModel.VHost, queueMap) - - ctx.closedShape(queue, queueMap, "amqpQueueChannelBinding") - - binding.setWithoutId(Amqp091ChannelBindingModel.Queue, queue, Annotations(entry)) - } - ) - } - - private def parseVHost(element: DomainElement, field: Field, map: YMap)(implicit ctx: AsyncWebApiContext) = { - map.key("vhost", field in element) - - // Default vhost is '/'. - if (!element.fields.exists(field)) { - element.setWithoutId(field, AmfScalar("/"), Annotations.synthesized()) - } + Amqp091ChannelBindingParser.parse(entry, parent) } override protected def parseWs(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): ChannelBinding = { - val binding = WebSocketsChannelBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key("method", WebSocketsChannelBindingModel.Method in binding) - map.key("query", entry => parseSchema(WebSocketsChannelBindingModel.Query, binding, entry, binding.id + "/query")) - map.key( - "headers", - entry => parseSchema(WebSocketsChannelBindingModel.Headers, binding, entry, binding.id + "/headers") - ) - parseBindingVersion(binding, WebSocketsChannelBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "wsChannelBinding") - - binding + WebSocketsChannelBindingParser.parse(entry, parent) } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncMessageBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncMessageBindingsParser.scala index 878cfa70b2..2be6a644e4 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncMessageBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncMessageBindingsParser.scala @@ -6,6 +6,12 @@ import amf.apicontract.client.scala.model.domain.bindings.kafka.KafkaMessageBind import amf.apicontract.client.scala.model.domain.bindings.mqtt.MqttMessageBinding import amf.apicontract.client.scala.model.domain.bindings.{MessageBinding, MessageBindings} import amf.apicontract.internal.metamodel.domain.bindings._ +import amf.apicontract.internal.spec.async.parser.bindings.message.{ + Amqp091MessageBindingParser, + HttpMessageBindingParser, + KafkaMessageBindingParser, + MqttMessageBindingParser +} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.common.WebApiDeclarations.ErrorMessageBindings import amf.apicontract.internal.spec.spec.OasDefinitions @@ -47,57 +53,24 @@ case class AsyncMessageBindingsParser(entryLike: YMapEntryLike)(implicit ctx: As override protected def parseAmqp(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): MessageBinding = { - val binding = Amqp091MessageBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key("contentEncoding", Amqp091MessageBindingModel.ContentEncoding in binding) - map.key("messageType", Amqp091MessageBindingModel.MessageType in binding) - parseBindingVersion(binding, Amqp091MessageBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "amqpMessageBinding") - - binding + Amqp091MessageBindingParser.parse(entry, parent) } override protected def parseHttp(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): MessageBinding = { - val binding = HttpMessageBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key("headers", parseSchema(HttpMessageBindingModel.Headers, binding, _, binding.id)) - parseBindingVersion(binding, HttpMessageBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "httpMessageBinding") - - binding + HttpMessageBindingParser.parse(entry, parent) } override protected def parseKafka(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): MessageBinding = { - val binding = KafkaMessageBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key("key", entry => parseSchema(KafkaMessageBindingModel.MessageKey, binding, entry, binding.id + "/key")) - parseBindingVersion(binding, KafkaMessageBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "kafkaMessageBinding") - - binding + KafkaMessageBindingParser.parse(entry, parent) } override protected def parseMqtt(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): MessageBinding = { - val binding = MqttMessageBinding(Annotations(entry)) - - val map = entry.value.as[YMap] - - parseBindingVersion(binding, MqttMessageBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "mqttMessageBinding") - - binding + MqttMessageBindingParser.parse(entry, parent) } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncOperationBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncOperationBindingsParser.scala index 01e97d4618..23903bf182 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncOperationBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncOperationBindingsParser.scala @@ -6,6 +6,12 @@ import amf.apicontract.client.scala.model.domain.bindings.kafka.KafkaOperationBi import amf.apicontract.client.scala.model.domain.bindings.mqtt.MqttOperationBinding import amf.apicontract.client.scala.model.domain.bindings.{OperationBinding, OperationBindings} import amf.apicontract.internal.metamodel.domain.bindings._ +import amf.apicontract.internal.spec.async.parser.bindings.operation.{ + Amqp091OperationBindingParser, + HttpOperationBindingParser, + KafkaOperationBindingParser, + MqttOperationBindingParser +} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.common.WebApiDeclarations.ErrorOperationBindings import amf.apicontract.internal.spec.spec.OasDefinitions @@ -46,76 +52,24 @@ case class AsyncOperationBindingsParser(entryLike: YMapEntryLike)(implicit ctx: override protected def parseHttp(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): OperationBinding = { - val binding = HttpOperationBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key("type", HttpOperationBindingModel.OperationType in binding) - if (binding.operationType.is("request")) map.key("method", HttpOperationBindingModel.Method in binding) - map.key("query", entry => parseSchema(HttpOperationBindingModel.Query, binding, entry, binding.id)) - parseBindingVersion(binding, HttpOperationBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "httpOperationBinding") - - binding + HttpOperationBindingParser.parse(entry, parent) } override protected def parseAmqp(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): OperationBinding = { - val binding = Amqp091OperationBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key("expiration", Amqp091OperationBindingModel.Expiration in binding) - map.key("userId", Amqp091OperationBindingModel.UserId in binding) - map.key("cc", Amqp091OperationBindingModel.CC in binding) - map.key("priority", Amqp091OperationBindingModel.Priority in binding) - map.key("deliveryMode", Amqp091OperationBindingModel.DeliveryMode in binding) - map.key("mandatory", Amqp091OperationBindingModel.Mandatory in binding) - map.key("bcc", Amqp091OperationBindingModel.BCC in binding) - map.key("replyTo", Amqp091OperationBindingModel.ReplyTo in binding) - map.key("timestamp", Amqp091OperationBindingModel.Timestamp in binding) - map.key("ack", Amqp091OperationBindingModel.Ack in binding) - - parseBindingVersion(binding, KafkaOperationBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "amqpOperationBinding") - - binding + Amqp091OperationBindingParser.parse(entry, parent) } override protected def parseKafka(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): OperationBinding = { - val binding = KafkaOperationBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key( - "groupId", - entry => parseSchema(KafkaOperationBindingModel.GroupId, binding, entry, binding.id + "/group-id") - ) - map.key( - "clientId", - entry => parseSchema(KafkaOperationBindingModel.ClientId, binding, entry, binding.id + "/client-id") - ) - parseBindingVersion(binding, KafkaOperationBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "kafkaOperationBinding") - - binding + KafkaOperationBindingParser.parse(entry, parent) } override protected def parseMqtt(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): OperationBinding = { - val binding = MqttOperationBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key("qos", MqttOperationBindingModel.Qos in binding) - map.key("retain", MqttOperationBindingModel.Retain in binding) - parseBindingVersion(binding, MqttOperationBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "mqttOperationBinding") - - binding + MqttOperationBindingParser.parse(entry, parent) } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncServerBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncServerBindingsParser.scala index 7899b2efa9..8fe4da55aa 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncServerBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncServerBindingsParser.scala @@ -7,6 +7,7 @@ import amf.apicontract.internal.metamodel.domain.bindings.{ MqttServerLastWillModel, ServerBindingsModel } +import amf.apicontract.internal.spec.async.parser.bindings.server.MqttServerBindingParser import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.common.WebApiDeclarations.ErrorServerBindings import amf.apicontract.internal.spec.spec.OasDefinitions @@ -48,37 +49,6 @@ case class AsyncServerBindingsParser(entryLike: YMapEntryLike)(implicit ctx: Asy override protected def parseMqtt(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext ): ServerBinding = { - val binding = MqttServerBinding(Annotations(entry)) - val map = entry.value.as[YMap] - - map.key("clientId", MqttServerBindingModel.ClientId in binding) - map.key("cleanSession", MqttServerBindingModel.CleanSession in binding) - map.key("keepAlive", MqttServerBindingModel.KeepAlive in binding) - - parseLastWill(binding, map) - - parseBindingVersion(binding, MqttServerBindingModel.BindingVersion, map) - - ctx.closedShape(binding, map, "mqttServerBinding") - - binding - } - - private def parseLastWill(binding: MqttServerBinding, map: YMap)(implicit ctx: AsyncWebApiContext): Unit = { - map.key( - "lastWill", - { entry => - val lastWill = MqttServerLastWill(Annotations(entry.value)) - val lastWillMap = entry.value.as[YMap] - - lastWillMap.key("topic", MqttServerLastWillModel.Topic in lastWill) - lastWillMap.key("qos", MqttServerLastWillModel.Qos in lastWill) - lastWillMap.key("retain", MqttServerLastWillModel.Retain in lastWill) - lastWillMap.key("message", MqttServerLastWillModel.Message in lastWill) - - ctx.closedShape(lastWill, lastWillMap, "mqttServerLastWill") - binding.setWithoutId(MqttServerBindingModel.LastWill, lastWill, Annotations(entry)) - } - ) + MqttServerBindingParser.parse(entry, parent) } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/BindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/BindingParser.scala new file mode 100644 index 0000000000..ee99335f96 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/BindingParser.scala @@ -0,0 +1,50 @@ +package amf.apicontract.internal.spec.async.parser.bindings + +import amf.apicontract.client.scala.model.domain.bindings.BindingVersion +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.common.parser.SpecParserOps +import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} +import amf.core.internal.metamodel.Field +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import amf.shapes.internal.spec.common.JSONSchemaDraft7SchemaVersion +import amf.shapes.internal.spec.common.parser.YMapEntryLike +import amf.shapes.internal.spec.oas.parser.OasTypeParser +import org.yaml.model.{YMap, YMapEntry} + +trait BindingParser[Binding <: DomainElement] extends SpecParserOps { + + def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding + + protected def parseBindingVersion(binding: BindingVersion, field: Field, map: YMap)(implicit + ctx: AsyncWebApiContext + ): Unit = { + map.key("bindingVersion", field in binding) + + if (bindingVersionIsEmpty(binding)) setDefaultBindingVersionValue(binding, field) + } + + private def setDefaultBindingVersionValue(binding: BindingVersion, field: Field) = { + binding.setWithoutId(field, AmfScalar("latest"), Annotations.synthesized()) + } + + private def bindingVersionIsEmpty(binding: BindingVersion) = { + binding.bindingVersion.isNullOrEmpty + } + + protected def parseSchema(field: Field, binding: DomainElement, entry: YMapEntry)(implicit + ctx: AsyncWebApiContext + ): Unit = { + OasTypeParser( + YMapEntryLike(entry.value), + "schema", + shape => shape.withName("schema"), + JSONSchemaDraft7SchemaVersion + ) + .parse() + .foreach { shape => + binding.setWithoutId(field, shape, Annotations(entry)) + shape + } + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/EmptyBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/EmptyBindingParser.scala new file mode 100644 index 0000000000..376b6b6796 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/EmptyBindingParser.scala @@ -0,0 +1,27 @@ +package amf.apicontract.internal.spec.async.parser.bindings + +import amf.apicontract.client.scala.model.domain.bindings.EmptyBinding +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.validation.definitions.ParserSideValidations +import amf.core.client.scala.model.domain.AmfObject +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry, YNode} + +object EmptyBindingParser extends BindingParser[EmptyBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): EmptyBinding = { + val binding = EmptyBinding(Annotations(entry)) + + validateEmptyMap(entry.value, binding, entry.key.as[String]) + binding + } + + private def validateEmptyMap(value: YNode, node: AmfObject, `type`: String)(implicit ctx: AsyncWebApiContext): Unit = + if (value.as[YMap].entries.nonEmpty) { + ctx.eh.violation( + ParserSideValidations.NonEmptyBindingMap, + node, + s"Reserved name binding '${`type`}' must have an empty map", + value.location + ) + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/channel/AmqpChannelBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/channel/AmqpChannelBindingParser.scala new file mode 100644 index 0000000000..c5be2f3228 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/channel/AmqpChannelBindingParser.scala @@ -0,0 +1,92 @@ +package amf.apicontract.internal.spec.async.parser.bindings.channel + +import amf.apicontract.client.scala.model.domain.bindings.amqp.{ + Amqp091ChannelBinding, + Amqp091ChannelExchange, + Amqp091Queue +} +import amf.apicontract.internal.metamodel.domain.bindings.{ + Amqp091ChannelBindingModel, + Amqp091ChannelExchangeModel, + Amqp091QueueModel, + WebSocketsChannelBindingModel +} +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.apicontract.internal.spec.common.parser.SpecParserOps +import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} +import amf.core.internal.metamodel.Field +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object Amqp091ChannelBindingParser extends BindingParser[Amqp091ChannelBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Amqp091ChannelBinding = { + val binding = Amqp091ChannelBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key("is", Amqp091ChannelBindingModel.Is in binding) + + // Default channel type is 'routingKey'. + if (binding.is.isNullOrEmpty) { + binding.setWithoutId(Amqp091ChannelBindingModel.Is, AmfScalar("routingKey"), Annotations.synthesized()) + } + parseQueue(binding, map) + parseExchange(binding, map) + + parseBindingVersion(binding, WebSocketsChannelBindingModel.BindingVersion, map) + ctx.closedShape(binding, map, "amqpChannelBinding") + binding + } + + private def parseExchange(binding: Amqp091ChannelBinding, map: YMap)(implicit ctx: AsyncWebApiContext): Unit = { + map.key( + "exchange", + { entry => + val exchange = Amqp091ChannelExchange(Annotations(entry.value)) + val exchangeMap = entry.value.as[YMap] + + exchangeMap.key("name", Amqp091ChannelExchangeModel.Name in exchange) // TODO validate maxlength 255 + exchangeMap.key("type", Amqp091ChannelExchangeModel.Type in exchange) + exchangeMap.key("durable", Amqp091ChannelExchangeModel.Durable in exchange) + exchangeMap.key("autoDelete", Amqp091ChannelExchangeModel.AutoDelete in exchange) + + parseVHost(exchange, Amqp091ChannelExchangeModel.VHost, exchangeMap) + + ctx.closedShape(exchange, exchangeMap, "amqpExchangeChannelBinding") + + binding.setWithoutId(Amqp091ChannelBindingModel.Exchange, exchange, Annotations(entry)) + } + ) + } + + private def parseQueue(binding: Amqp091ChannelBinding, map: YMap)(implicit ctx: AsyncWebApiContext): Unit = { + map.key( + "queue", + { entry => + val queue = Amqp091Queue(Annotations(entry.value)) + val queueMap = entry.value.as[YMap] + + queueMap.key("name", Amqp091QueueModel.Name in queue) // TODO validate maxlength 255 + queueMap.key("durable", Amqp091QueueModel.Durable in queue) + queueMap.key("exclusive", Amqp091QueueModel.Exclusive in queue) + queueMap.key("autoDelete", Amqp091QueueModel.AutoDelete in queue) + + parseVHost(queue, Amqp091QueueModel.VHost, queueMap) + + ctx.closedShape(queue, queueMap, "amqpQueueChannelBinding") + + binding.setWithoutId(Amqp091ChannelBindingModel.Queue, queue, Annotations(entry)) + } + ) + } + + private def parseVHost(element: DomainElement, field: Field, map: YMap)(implicit ctx: AsyncWebApiContext) = { + map.key("vhost", field in element) + + // Default vhost is '/'. + if (!element.fields.exists(field)) { + element.setWithoutId(field, AmfScalar("/"), Annotations.synthesized()) + } + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/channel/WebSocketsChannelBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/channel/WebSocketsChannelBindingParser.scala new file mode 100644 index 0000000000..6dc54887d1 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/channel/WebSocketsChannelBindingParser.scala @@ -0,0 +1,28 @@ +package amf.apicontract.internal.spec.async.parser.bindings.channel + +import amf.apicontract.client.scala.model.domain.bindings.websockets.WebSocketsChannelBinding +import amf.apicontract.internal.metamodel.domain.bindings.WebSocketsChannelBindingModel +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object WebSocketsChannelBindingParser extends BindingParser[WebSocketsChannelBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): WebSocketsChannelBinding = { + val binding = WebSocketsChannelBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key("method", WebSocketsChannelBindingModel.Method in binding) + map.key("query", entry => parseSchema(WebSocketsChannelBindingModel.Query, binding, entry)) + map.key( + "headers", + entry => parseSchema(WebSocketsChannelBindingModel.Headers, binding, entry) + ) + parseBindingVersion(binding, WebSocketsChannelBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "wsChannelBinding") + + binding + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/Amqp091MessageBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/Amqp091MessageBindingParser.scala new file mode 100644 index 0000000000..cea6e47ca2 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/Amqp091MessageBindingParser.scala @@ -0,0 +1,24 @@ +package amf.apicontract.internal.spec.async.parser.bindings.message + +import amf.apicontract.client.scala.model.domain.bindings.amqp.Amqp091MessageBinding +import amf.apicontract.internal.metamodel.domain.bindings.Amqp091MessageBindingModel +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object Amqp091MessageBindingParser extends BindingParser[Amqp091MessageBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Amqp091MessageBinding = { + val binding = Amqp091MessageBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key("contentEncoding", Amqp091MessageBindingModel.ContentEncoding in binding) + map.key("messageType", Amqp091MessageBindingModel.MessageType in binding) + parseBindingVersion(binding, Amqp091MessageBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "amqpMessageBinding") + + binding + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/HttpMessageBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/HttpMessageBindingParser.scala new file mode 100644 index 0000000000..bfc9a79b12 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/HttpMessageBindingParser.scala @@ -0,0 +1,24 @@ +package amf.apicontract.internal.spec.async.parser.bindings.message + +import amf.apicontract.client.scala.model.domain.bindings.http.HttpMessageBinding +import amf.apicontract.client.scala.model.domain.bindings.kafka.KafkaMessageBinding +import amf.apicontract.internal.metamodel.domain.bindings.{HttpMessageBindingModel, KafkaMessageBindingModel} +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object HttpMessageBindingParser extends BindingParser[HttpMessageBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): HttpMessageBinding = { + val binding = HttpMessageBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key("headers", parseSchema(HttpMessageBindingModel.Headers, binding, _)) + parseBindingVersion(binding, HttpMessageBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "httpMessageBinding") + + binding + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/KafkaMessageBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/KafkaMessageBindingParser.scala new file mode 100644 index 0000000000..9b200315df --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/KafkaMessageBindingParser.scala @@ -0,0 +1,23 @@ +package amf.apicontract.internal.spec.async.parser.bindings.message + +import amf.apicontract.client.scala.model.domain.bindings.kafka.KafkaMessageBinding +import amf.apicontract.internal.metamodel.domain.bindings.KafkaMessageBindingModel +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object KafkaMessageBindingParser extends BindingParser[KafkaMessageBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): KafkaMessageBinding = { + val binding = KafkaMessageBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key("key", entry => parseSchema(KafkaMessageBindingModel.MessageKey, binding, entry)) + parseBindingVersion(binding, KafkaMessageBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "kafkaMessageBinding") + + binding + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/MqttMessageBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/MqttMessageBindingParser.scala new file mode 100644 index 0000000000..01d2271b00 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/message/MqttMessageBindingParser.scala @@ -0,0 +1,22 @@ +package amf.apicontract.internal.spec.async.parser.bindings.message + +import amf.apicontract.client.scala.model.domain.bindings.mqtt.MqttMessageBinding +import amf.apicontract.internal.metamodel.domain.bindings.MqttMessageBindingModel +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object MqttMessageBindingParser extends BindingParser[MqttMessageBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): MqttMessageBinding = { + val binding = MqttMessageBinding(Annotations(entry)) + + val map = entry.value.as[YMap] + + parseBindingVersion(binding, MqttMessageBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "mqttMessageBinding") + + binding + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/Amqp091OperationBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/Amqp091OperationBindingParser.scala new file mode 100644 index 0000000000..bad453e95b --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/Amqp091OperationBindingParser.scala @@ -0,0 +1,33 @@ +package amf.apicontract.internal.spec.async.parser.bindings.operation + +import amf.apicontract.client.scala.model.domain.bindings.amqp.Amqp091OperationBinding +import amf.apicontract.internal.metamodel.domain.bindings.{Amqp091OperationBindingModel, KafkaOperationBindingModel} +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object Amqp091OperationBindingParser extends BindingParser[Amqp091OperationBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Amqp091OperationBinding = { + val binding = Amqp091OperationBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key("expiration", Amqp091OperationBindingModel.Expiration in binding) + map.key("userId", Amqp091OperationBindingModel.UserId in binding) + map.key("cc", Amqp091OperationBindingModel.CC in binding) + map.key("priority", Amqp091OperationBindingModel.Priority in binding) + map.key("deliveryMode", Amqp091OperationBindingModel.DeliveryMode in binding) + map.key("mandatory", Amqp091OperationBindingModel.Mandatory in binding) + map.key("bcc", Amqp091OperationBindingModel.BCC in binding) + map.key("replyTo", Amqp091OperationBindingModel.ReplyTo in binding) + map.key("timestamp", Amqp091OperationBindingModel.Timestamp in binding) + map.key("ack", Amqp091OperationBindingModel.Ack in binding) + + parseBindingVersion(binding, KafkaOperationBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "amqpOperationBinding") + + binding + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/HttpOperationBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/HttpOperationBindingParser.scala new file mode 100644 index 0000000000..edc09fc13a --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/HttpOperationBindingParser.scala @@ -0,0 +1,25 @@ +package amf.apicontract.internal.spec.async.parser.bindings.operation + +import amf.apicontract.client.scala.model.domain.bindings.http.HttpOperationBinding +import amf.apicontract.internal.metamodel.domain.bindings.HttpOperationBindingModel +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object HttpOperationBindingParser extends BindingParser[HttpOperationBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): HttpOperationBinding = { + val binding = HttpOperationBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key("type", HttpOperationBindingModel.OperationType in binding) + if (binding.operationType.is("request")) map.key("method", HttpOperationBindingModel.Method in binding) + map.key("query", entry => parseSchema(HttpOperationBindingModel.Query, binding, entry)) + parseBindingVersion(binding, HttpOperationBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "httpOperationBinding") + + binding + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/KafkaOperationBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/KafkaOperationBindingParser.scala new file mode 100644 index 0000000000..d057a57282 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/KafkaOperationBindingParser.scala @@ -0,0 +1,31 @@ +package amf.apicontract.internal.spec.async.parser.bindings.operation + +import amf.apicontract.client.scala.model.domain.bindings.kafka.KafkaOperationBinding +import amf.apicontract.client.scala.model.domain.bindings.mqtt.MqttOperationBinding +import amf.apicontract.internal.metamodel.domain.bindings.{KafkaOperationBindingModel, MqttOperationBindingModel} +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object KafkaOperationBindingParser extends BindingParser[KafkaOperationBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): KafkaOperationBinding = { + val binding = KafkaOperationBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key( + "groupId", + entry => parseSchema(KafkaOperationBindingModel.GroupId, binding, entry) + ) + map.key( + "clientId", + entry => parseSchema(KafkaOperationBindingModel.ClientId, binding, entry) + ) + parseBindingVersion(binding, KafkaOperationBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "kafkaOperationBinding") + + binding + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/MqttOperationBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/MqttOperationBindingParser.scala new file mode 100644 index 0000000000..5b1fb420d5 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/operation/MqttOperationBindingParser.scala @@ -0,0 +1,24 @@ +package amf.apicontract.internal.spec.async.parser.bindings.operation + +import amf.apicontract.client.scala.model.domain.bindings.mqtt.{MqttMessageBinding, MqttOperationBinding} +import amf.apicontract.internal.metamodel.domain.bindings.{MqttMessageBindingModel, MqttOperationBindingModel} +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object MqttOperationBindingParser extends BindingParser[MqttOperationBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): MqttOperationBinding = { + val binding = MqttOperationBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key("qos", MqttOperationBindingModel.Qos in binding) + map.key("retain", MqttOperationBindingModel.Retain in binding) + parseBindingVersion(binding, MqttOperationBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "mqttOperationBinding") + + binding + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/server/MqttServerBindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/server/MqttServerBindingParser.scala new file mode 100644 index 0000000000..fda65b91cd --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/server/MqttServerBindingParser.scala @@ -0,0 +1,46 @@ +package amf.apicontract.internal.spec.async.parser.bindings.server + +import amf.apicontract.client.scala.model.domain.bindings.mqtt.{MqttServerBinding, MqttServerLastWill} +import amf.apicontract.internal.metamodel.domain.bindings.{MqttServerBindingModel, MqttServerLastWillModel} +import amf.apicontract.internal.spec.async.parser.bindings.BindingParser +import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.internal.parser.YMapOps +import amf.core.internal.parser.domain.Annotations +import org.yaml.model.{YMap, YMapEntry} + +object MqttServerBindingParser extends BindingParser[MqttServerBinding] { + override def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): MqttServerBinding = { + val binding = MqttServerBinding(Annotations(entry)) + val map = entry.value.as[YMap] + + map.key("clientId", MqttServerBindingModel.ClientId in binding) + map.key("cleanSession", MqttServerBindingModel.CleanSession in binding) + map.key("keepAlive", MqttServerBindingModel.KeepAlive in binding) + + parseLastWill(binding, map) + + parseBindingVersion(binding, MqttServerBindingModel.BindingVersion, map) + + ctx.closedShape(binding, map, "mqttServerBinding") + + binding + } + + private def parseLastWill(binding: MqttServerBinding, map: YMap)(implicit ctx: AsyncWebApiContext): Unit = { + map.key( + "lastWill", + { entry => + val lastWill = MqttServerLastWill(Annotations(entry.value)) + val lastWillMap = entry.value.as[YMap] + + lastWillMap.key("topic", MqttServerLastWillModel.Topic in lastWill) + lastWillMap.key("qos", MqttServerLastWillModel.Qos in lastWill) + lastWillMap.key("retain", MqttServerLastWillModel.Retain in lastWill) + lastWillMap.key("message", MqttServerLastWillModel.Message in lastWill) + + ctx.closedShape(lastWill, lastWillMap, "mqttServerLastWill") + binding.setWithoutId(MqttServerBindingModel.LastWill, lastWill, Annotations(entry)) + } + ) + } +} From b978ef47e8d2065f7e032e55dd8b804110698bc1 Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 29 Jan 2024 18:50:35 -0300 Subject: [PATCH 23/33] W-14875628 (feat): added mechanism to customize possible bindings per async api version --- .../parser/bindings/AsyncBindingsParser.scala | 55 ++++--------------- .../bindings/AsyncChannelBindingsParser.scala | 21 ++++--- .../bindings/AsyncMessageBindingsParser.scala | 41 ++++---------- .../AsyncOperationBindingsParser.scala | 39 +++++-------- .../bindings/AsyncServerBindingsParser.scala | 15 ++--- .../async/parser/bindings/BindingParser.scala | 4 +- .../parser/context/Async2WebApiContext.scala | 18 +++++- .../parser/context/AsyncValidBindingSet.scala | 20 +++++++ .../parser/context/AsyncWebApiContext.scala | 5 +- .../spec/jsonschema/ref/AstIndexTest.scala | 9 ++- 10 files changed, 103 insertions(+), 124 deletions(-) create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncValidBindingSet.scala diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala index 8bab04a705..993608bb1d 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala @@ -21,6 +21,7 @@ abstract class AsyncBindingsParser(entryLike: YMapEntryLike)(implicit ctx: Async protected type Binding <: DomainElement protected val bindingsField: Field protected type Bindings <: NamedDomainElement with Linkable + protected val parsers: Map[String, BindingParser[Binding]] def parse(): Bindings = { val map: YMap = entryLike.asMap @@ -79,57 +80,23 @@ abstract class AsyncBindingsParser(entryLike: YMapEntryLike)(implicit ctx: Async } } + private def canParse(binding: String) = ctx.validBindingSet().canParse(binding) + protected def parseElements(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Seq[Binding] = { map.regex("^(?!x-).*").flatMap(parseElement(_, parent)).toSeq } private def parseElement(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Option[Binding] = { - val bindingOption = entry.key.as[String] match { - case Http => Some(parseHttp(entry, parent)) - case WebSockets => Some(parseWs(entry, parent)) - case Kafka => Some(parseKafka(entry, parent)) - case Amqp => Some(parseAmqp(entry, parent)) - case Amqp1 => Some(parseAmqp1(entry, parent)) - case Mqtt => Some(parseMqtt(entry, parent)) - case Mqtt5 => Some(parseMqtt5(entry, parent)) - case Nats => Some(parseNats(entry, parent)) - case Jms => Some(parseJms(entry, parent)) - case Sns => Some(parseSns(entry, parent)) - case Sqs => Some(parseSqs(entry, parent)) - case Stomp => Some(parseStomp(entry, parent)) - case Redis => Some(parseRedis(entry, parent)) - case _ => None - } - bindingOption.map(setBindingType(entry, _)) + val bindingType = entry.key.as[String] + if (canParse(bindingType)) { + val binding: Binding = parsers + .get(bindingType) + .map(_.parse(entry, parent)) + .getOrElse(parseEmptyBinding(entry, parent)) + Some(setBindingType(entry, binding)) + } else None // TODO: maybe we should throw an error here? I'm not changing behaviour } - protected def parseHttp(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseWs(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseKafka(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseAmqp(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseAmqp1(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseMqtt(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseMqtt5(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseNats(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseJms(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseSns(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseSqs(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseStomp(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseRedis(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = - parseEmptyBinding(entry, parent) - protected def parseEmptyBinding(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding = { EmptyBindingParser.parse(entry, parent).asInstanceOf[Binding] } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncChannelBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncChannelBindingsParser.scala index 400e64e79d..22eaaeedcd 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncChannelBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncChannelBindingsParser.scala @@ -2,6 +2,7 @@ package amf.apicontract.internal.spec.async.parser.bindings import amf.apicontract.client.scala.model.domain.bindings.{ChannelBinding, ChannelBindings} import amf.apicontract.internal.metamodel.domain.bindings._ +import amf.apicontract.internal.spec.async.parser.bindings.Bindings.{Amqp, Http, Kafka, Mqtt, WebSockets} import amf.apicontract.internal.spec.async.parser.bindings.channel.{ Amqp091ChannelBindingParser, WebSocketsChannelBindingParser @@ -15,12 +16,20 @@ import amf.core.internal.parser.domain.{Annotations, SearchScope} import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model.YMapEntry +object AsyncChannelBindingsParser { + private val parserMap: Map[String, BindingParser[ChannelBinding]] = Map( + Amqp -> Amqp091ChannelBindingParser, + WebSockets -> WebSocketsChannelBindingParser + ) +} + case class AsyncChannelBindingsParser(entryLike: YMapEntryLike)(implicit ctx: AsyncWebApiContext) extends AsyncBindingsParser(entryLike) { override type Binding = ChannelBinding override protected type Bindings = ChannelBindings - override protected val bindingsField: Field = ChannelBindingsModel.Bindings + override protected val bindingsField: Field = ChannelBindingsModel.Bindings + override protected val parsers: Map[String, BindingParser[ChannelBinding]] = AsyncChannelBindingsParser.parserMap override protected def createBindings(): ChannelBindings = ChannelBindings() @@ -42,14 +51,4 @@ case class AsyncChannelBindingsParser(entryLike: YMapEntryLike)(implicit ctx: As override protected def errorBindings(fullRef: String, entryLike: YMapEntryLike): ChannelBindings = new ErrorChannelBindings(fullRef, entryLike.asMap) - - override protected def parseAmqp(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): ChannelBinding = { - Amqp091ChannelBindingParser.parse(entry, parent) - } - - override protected def parseWs(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): ChannelBinding = { - WebSocketsChannelBindingParser.parse(entry, parent) - } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncMessageBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncMessageBindingsParser.scala index 2be6a644e4..9614677c10 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncMessageBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncMessageBindingsParser.scala @@ -1,11 +1,8 @@ package amf.apicontract.internal.spec.async.parser.bindings -import amf.apicontract.client.scala.model.domain.bindings.amqp.Amqp091MessageBinding -import amf.apicontract.client.scala.model.domain.bindings.http.HttpMessageBinding -import amf.apicontract.client.scala.model.domain.bindings.kafka.KafkaMessageBinding -import amf.apicontract.client.scala.model.domain.bindings.mqtt.MqttMessageBinding import amf.apicontract.client.scala.model.domain.bindings.{MessageBinding, MessageBindings} import amf.apicontract.internal.metamodel.domain.bindings._ +import amf.apicontract.internal.spec.async.parser.bindings.Bindings.{Amqp, Http, Kafka, Mqtt} import amf.apicontract.internal.spec.async.parser.bindings.message.{ Amqp091MessageBindingParser, HttpMessageBindingParser, @@ -17,14 +14,22 @@ import amf.apicontract.internal.spec.common.WebApiDeclarations.ErrorMessageBindi import amf.apicontract.internal.spec.spec.OasDefinitions import amf.core.client.scala.model.domain.AmfScalar import amf.core.internal.metamodel.Field -import amf.core.internal.parser.YMapOps import amf.core.internal.parser.domain.{Annotations, SearchScope} import amf.shapes.internal.spec.common.parser.YMapEntryLike -import org.yaml.model.{YMap, YMapEntry} + +object AsyncMessageBindingsParser { + private val parserMap: Map[String, BindingParser[MessageBinding]] = Map( + Amqp -> Amqp091MessageBindingParser, + Http -> HttpMessageBindingParser, + Kafka -> KafkaMessageBindingParser, + Mqtt -> MqttMessageBindingParser + ) +} case class AsyncMessageBindingsParser(entryLike: YMapEntryLike)(implicit ctx: AsyncWebApiContext) extends AsyncBindingsParser(entryLike) { + override protected val parsers: Map[String, BindingParser[MessageBinding]] = AsyncMessageBindingsParser.parserMap override type Binding = MessageBinding override type Bindings = MessageBindings override protected val bindingsField: Field = MessageBindingsModel.Bindings @@ -49,28 +54,4 @@ case class AsyncMessageBindingsParser(entryLike: YMapEntryLike)(implicit ctx: As override protected def errorBindings(fullRef: String, entryLike: YMapEntryLike): MessageBindings = new ErrorMessageBindings(fullRef, entryLike.asMap) - - override protected def parseAmqp(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): MessageBinding = { - Amqp091MessageBindingParser.parse(entry, parent) - } - - override protected def parseHttp(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): MessageBinding = { - HttpMessageBindingParser.parse(entry, parent) - } - - override protected def parseKafka(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): MessageBinding = { - KafkaMessageBindingParser.parse(entry, parent) - } - - override protected def parseMqtt(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): MessageBinding = { - MqttMessageBindingParser.parse(entry, parent) - } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncOperationBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncOperationBindingsParser.scala index 23903bf182..6a4d4b6f5e 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncOperationBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncOperationBindingsParser.scala @@ -6,6 +6,8 @@ import amf.apicontract.client.scala.model.domain.bindings.kafka.KafkaOperationBi import amf.apicontract.client.scala.model.domain.bindings.mqtt.MqttOperationBinding import amf.apicontract.client.scala.model.domain.bindings.{OperationBinding, OperationBindings} import amf.apicontract.internal.metamodel.domain.bindings._ +import amf.apicontract.internal.spec.async.parser.bindings.AsyncOperationBindingsParser.parserMap +import amf.apicontract.internal.spec.async.parser.bindings.Bindings.{Amqp, Http, Kafka, Mqtt} import amf.apicontract.internal.spec.async.parser.bindings.operation.{ Amqp091OperationBindingParser, HttpOperationBindingParser, @@ -22,11 +24,22 @@ import amf.core.internal.parser.domain.{Annotations, SearchScope} import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model.{YMap, YMapEntry} +object AsyncOperationBindingsParser { + private val parserMap: Map[String, BindingParser[OperationBinding]] = Map( + Amqp -> Amqp091OperationBindingParser, + Http -> HttpOperationBindingParser, + Kafka -> KafkaOperationBindingParser, + Mqtt -> MqttOperationBindingParser + ) +} + case class AsyncOperationBindingsParser(entryLike: YMapEntryLike)(implicit ctx: AsyncWebApiContext) extends AsyncBindingsParser(entryLike) { + override type Binding = OperationBinding override type Bindings = OperationBindings - override val bindingsField: Field = OperationBindingsModel.Bindings + override val bindingsField: Field = OperationBindingsModel.Bindings + override protected val parsers: Map[String, BindingParser[OperationBinding]] = parserMap override protected def createBindings(): OperationBindings = OperationBindings() @@ -48,28 +61,4 @@ case class AsyncOperationBindingsParser(entryLike: YMapEntryLike)(implicit ctx: override protected def errorBindings(fullRef: String, entryLike: YMapEntryLike): OperationBindings = new ErrorOperationBindings(fullRef, entryLike.asMap) - - override protected def parseHttp(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): OperationBinding = { - HttpOperationBindingParser.parse(entry, parent) - } - - override protected def parseAmqp(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): OperationBinding = { - Amqp091OperationBindingParser.parse(entry, parent) - } - - override protected def parseKafka(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): OperationBinding = { - KafkaOperationBindingParser.parse(entry, parent) - } - - override protected def parseMqtt(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): OperationBinding = { - MqttOperationBindingParser.parse(entry, parent) - } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncServerBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncServerBindingsParser.scala index 8fe4da55aa..a646c04358 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncServerBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncServerBindingsParser.scala @@ -7,6 +7,7 @@ import amf.apicontract.internal.metamodel.domain.bindings.{ MqttServerLastWillModel, ServerBindingsModel } +import amf.apicontract.internal.spec.async.parser.bindings.Bindings.{Amqp, Http, Kafka, Mqtt} import amf.apicontract.internal.spec.async.parser.bindings.server.MqttServerBindingParser import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.common.WebApiDeclarations.ErrorServerBindings @@ -18,12 +19,18 @@ import amf.core.internal.parser.domain.{Annotations, SearchScope} import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model.{YMap, YMapEntry} +object AsyncServerBindingsParser { + private val parserMap: Map[String, BindingParser[ServerBinding]] = Map( + Mqtt -> MqttServerBindingParser + ) +} case class AsyncServerBindingsParser(entryLike: YMapEntryLike)(implicit ctx: AsyncWebApiContext) extends AsyncBindingsParser(entryLike) { override type Binding = ServerBinding override type Bindings = ServerBindings - override val bindingsField: Field = ServerBindingsModel.Bindings + override val bindingsField: Field = ServerBindingsModel.Bindings + override protected val parsers: Map[String, BindingParser[ServerBinding]] = AsyncServerBindingsParser.parserMap override protected def createParser(entryLike: YMapEntryLike)(implicit ctx: AsyncWebApiContext): AsyncBindingsParser = AsyncServerBindingsParser(entryLike) @@ -45,10 +52,4 @@ case class AsyncServerBindingsParser(entryLike: YMapEntryLike)(implicit ctx: Asy override protected def errorBindings(fullRef: String, entryLike: YMapEntryLike): ServerBindings = new ErrorServerBindings(fullRef, entryLike.asMap) - - override protected def parseMqtt(entry: YMapEntry, parent: String)(implicit - ctx: AsyncWebApiContext - ): ServerBinding = { - MqttServerBindingParser.parse(entry, parent) - } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/BindingParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/BindingParser.scala index ee99335f96..f211f5800f 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/BindingParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/BindingParser.scala @@ -3,7 +3,7 @@ package amf.apicontract.internal.spec.async.parser.bindings import amf.apicontract.client.scala.model.domain.bindings.BindingVersion import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.common.parser.SpecParserOps -import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} +import amf.core.client.scala.model.domain.{AmfScalar, DomainElement, Linkable} import amf.core.internal.metamodel.Field import amf.core.internal.parser.YMapOps import amf.core.internal.parser.domain.Annotations @@ -12,7 +12,7 @@ import amf.shapes.internal.spec.common.parser.YMapEntryLike import amf.shapes.internal.spec.oas.parser.OasTypeParser import org.yaml.model.{YMap, YMapEntry} -trait BindingParser[Binding <: DomainElement] extends SpecParserOps { +trait BindingParser[+Binding <: DomainElement] extends SpecParserOps { def parse(entry: YMapEntry, parent: String)(implicit ctx: AsyncWebApiContext): Binding diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala index 05e8b27d2b..31221f9489 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala @@ -123,6 +123,7 @@ object Async2WebApiContext { mutable.HashSet.empty, options, settings(spec), + bindingSet(spec), factory(spec) ) } @@ -146,6 +147,16 @@ object Async2WebApiContext { case AsyncApi25 => ctx => Async20VersionFactory()(ctx) case AsyncApi26 => ctx => Async20VersionFactory()(ctx) } + + private def bindingSet(spec: Spec): AsyncValidBindingSet = spec match { + case AsyncApi20 => AsyncValidBindingSet.async20 + case AsyncApi21 => AsyncValidBindingSet.async21 + case AsyncApi22 => AsyncValidBindingSet.async22 + case AsyncApi23 => AsyncValidBindingSet.async23 + case AsyncApi24 => AsyncValidBindingSet.async24 + case AsyncApi25 => AsyncValidBindingSet.async25 + case AsyncApi26 => AsyncValidBindingSet.async26 + } } class Async2WebApiContext private ( @@ -155,7 +166,8 @@ class Async2WebApiContext private ( private val ds: Option[AsyncWebApiDeclarations] = None, private val operationIds: mutable.Set[String] = mutable.HashSet(), options: ParsingOptions = ParsingOptions(), - settings: SpecSettings, + settings: Async2Settings, + bindings: AsyncValidBindingSet, factoryFactory: Async2WebApiContext => AsyncSpecVersionFactory ) extends AsyncWebApiContext( loc, @@ -164,7 +176,8 @@ class Async2WebApiContext private ( wrapped, ds, operationIds, - settings + settings, + bindings ) { override val factory: AsyncSpecVersionFactory = factoryFactory(this) @@ -177,6 +190,7 @@ class Async2WebApiContext private ( operationIds, options, settings, + bindings, factoryFactory ) } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncValidBindingSet.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncValidBindingSet.scala new file mode 100644 index 0000000000..fc9069d08f --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncValidBindingSet.scala @@ -0,0 +1,20 @@ +package amf.apicontract.internal.spec.async.parser.context + +import amf.apicontract.internal.spec.async.parser.bindings.Bindings._ + +case class AsyncValidBindingSet(bindings: Set[String]) { + def add(bindings: String*) = copy(this.bindings ++ bindings) + def canParse(binding: String): Boolean = bindings.contains(binding) +} + +object AsyncValidBindingSet { + + private val basic = Set(Http, WebSockets, Kafka, Amqp, Amqp1, Mqtt, Mqtt5, Nats, Jms, Sns, Sqs, Stomp, Redis) + val async20: AsyncValidBindingSet = AsyncValidBindingSet(basic) + val async21: AsyncValidBindingSet = async20 + val async22: AsyncValidBindingSet = async21 + val async23: AsyncValidBindingSet = async22 + val async24: AsyncValidBindingSet = async23 + val async25: AsyncValidBindingSet = async24 + val async26: AsyncValidBindingSet = async25 +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncWebApiContext.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncWebApiContext.scala index d83a08b2ab..93e60abc55 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncWebApiContext.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncWebApiContext.scala @@ -18,7 +18,8 @@ abstract class AsyncWebApiContext( private val wrapped: ParserContext, private val ds: Option[AsyncWebApiDeclarations] = None, private val operationIds: mutable.Set[String] = mutable.HashSet(), - specSettings: SpecSettings + specSettings: SpecSettings, + protected val bindings: AsyncValidBindingSet ) extends OasLikeWebApiContext(loc, refs, options, wrapped, ds, operationIds, specSettings = specSettings) { override val factory: AsyncSpecVersionFactory @@ -47,4 +48,6 @@ abstract class AsyncWebApiContext( futureDeclarations = futureDeclarations ) ) + + def validBindingSet(): AsyncValidBindingSet = bindings } diff --git a/amf-api-contract/shared/src/test/scala/amf/shapes/internal/spec/jsonschema/ref/AstIndexTest.scala b/amf-api-contract/shared/src/test/scala/amf/shapes/internal/spec/jsonschema/ref/AstIndexTest.scala index cd6e1c1db1..c921d476e8 100644 --- a/amf-api-contract/shared/src/test/scala/amf/shapes/internal/spec/jsonschema/ref/AstIndexTest.scala +++ b/amf-api-contract/shared/src/test/scala/amf/shapes/internal/spec/jsonschema/ref/AstIndexTest.scala @@ -2,9 +2,11 @@ package amf.shapes.internal.spec.jsonschema.ref import amf.aml.internal.registries.AMLRegistry import amf.apicontract.internal.spec.async.parser.context.Async2WebApiContext +import amf.core.client.scala.config.ParsingOptions import amf.core.client.scala.errorhandling.UnhandledErrorHandler import amf.core.client.scala.parse.document.ParserContext import amf.core.internal.parser.{LimitedParseConfig, YMapOps} +import amf.core.internal.remote.AsyncApi20 import amf.core.internal.unsafe.PlatformSecrets import amf.core.internal.utils.AliasCounter import amf.shapes.internal.spec.common.parser.YMapEntryLike @@ -170,10 +172,13 @@ trait IndexHelper extends PlatformSecrets { val content = platform.fs.syncFile(pathToFile).read() val doc = JsonParser(content).document() implicit val ctx = - new Async2WebApiContext( + Async2WebApiContext( "loc", Seq(), - ParserContext(config = LimitedParseConfig(UnhandledErrorHandler, AMLRegistry.empty)) + ParserContext(config = LimitedParseConfig(UnhandledErrorHandler, AMLRegistry.empty)), + None, + ParsingOptions(), + AsyncApi20 ) AstIndexBuilder.buildAst(doc.node, AliasCounter(), version) } From cfc155c068349abf0164a705eb2d1b6f44360894 Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Tue, 30 Jan 2024 20:48:11 -0300 Subject: [PATCH 24/33] W-13462021 (feat): added support for rendering different async 2.0 document versions --- .../document/AsyncApi20DocumentEmitter.scala | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala index a3a5b0e734..ccc59c39c2 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala @@ -3,8 +3,13 @@ package amf.apicontract.internal.spec.async.emitters.document import amf.apicontract.client.scala.model.domain.Tag import amf.apicontract.client.scala.model.domain.api.{Api, WebApi} import amf.apicontract.internal.metamodel.domain.api.WebApiModel +import amf.apicontract.internal.spec.async.{AsyncApi21, AsyncApi22, AsyncApi23, AsyncApi24, AsyncApi25, AsyncApi26} import amf.apicontract.internal.spec.async.emitters.context.AsyncSpecEmitterContext -import amf.apicontract.internal.spec.async.emitters.domain.{AsyncApiCreativeWorksEmitter, AsyncApiEndpointsEmitter, AsyncApiServersEmitter} +import amf.apicontract.internal.spec.async.emitters.domain.{ + AsyncApiCreativeWorksEmitter, + AsyncApiEndpointsEmitter, + AsyncApiServersEmitter +} import amf.apicontract.internal.spec.common.emitter import amf.apicontract.internal.spec.common.emitter.{AgnosticShapeEmitterContextAdapter, SecurityRequirementsEmitter} import amf.apicontract.internal.spec.oas.emitter.domain.{InfoEmitter, TagsEmitter} @@ -19,6 +24,7 @@ import amf.shapes.client.scala.model.domain.CreativeWork import amf.shapes.internal.annotations.OrphanOasExtension import amf.shapes.internal.spec.common.emitter.annotations.AnnotationsEmitter import org.yaml.model.{YDocument, YNode, YScalar, YType} + import scala.collection.mutable class AsyncApi20DocumentEmitter(document: BaseUnit)(implicit val specCtx: AsyncSpecEmitterContext) { @@ -71,8 +77,21 @@ class AsyncApi20DocumentEmitter(document: BaseUnit)(implicit val specCtx: AsyncS def wrapDeclarations(emitters: Seq[EntryEmitter], ordering: SpecOrdering): Seq[EntryEmitter] = Seq(emitter.DeclarationsEmitterWrapper(emitters, ordering)) - def versionEntry(b: YDocument.EntryBuilder): Unit = - b.asyncapi = YNode(YScalar("2.0.0"), YType.Str) // this should not be necessary but for use the same logic + def versionEntry(b: YDocument.EntryBuilder): Unit = { + val versionToEmit = document.sourceSpec + .map { + case AsyncApi20 => "2.0.0" + case AsyncApi21 => "2.1.0" + case AsyncApi22 => "2.2.0" + case AsyncApi23 => "2.3.0" + case AsyncApi24 => "2.4.0" + case AsyncApi25 => "2.5.0" + case AsyncApi26 => "2.6.0" + } + .getOrElse("2.0.0") + + b.asyncapi = YNode(YScalar(versionToEmit), YType.Str) // this should not be necessary but for use the same logic + } case class WebApiEmitter(api: Api, ordering: SpecOrdering, spec: Option[Spec], references: Seq[BaseUnit]) { val emitters: Seq[EntryEmitter] = { From 627ac4d1bbbefedf602e4afa689a6dd7066a4d78 Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Wed, 31 Jan 2024 09:41:55 -0300 Subject: [PATCH 25/33] W-14875628 (feat): added basic Async 2.x document rendering. Added tests to check that Spec objects were being parsed correctly --- .../spec/async/Async20ParsePlugin.scala | 6 -- .../internal/spec/async/AsyncHeader.scala | 11 ++- .../internal/spec/async/AsyncSpec.scala | 33 --------- .../async/NotFinishedAsync20ParsePlugin.scala | 69 +++++++++++++++++++ .../document/AsyncApi20DocumentEmitter.scala | 16 ++++- .../parser/context/Async2WebApiContext.scala | 11 ++- .../document/AsyncApi21DocumentParser.scala | 9 +-- .../document/AsyncApi22DocumentParser.scala | 2 +- .../document/AsyncApi23DocumentParser.scala | 7 +- .../document/AsyncApi24DocumentParser.scala | 7 +- .../document/AsyncApi25DocumentParser.scala | 2 +- .../document/AsyncApi26DocumentParser.scala | 2 +- .../cycle/async20/empty-async21.yaml | 5 ++ .../cycle/async20/empty-async22.yaml | 5 ++ .../cycle/async20/empty-async23.yaml | 5 ++ .../cycle/async20/empty-async24.yaml | 5 ++ .../cycle/async20/empty-async25.yaml | 5 ++ .../cycle/async20/empty-async26.yaml | 5 ++ .../scala/amf/emit/Async20CycleTest.scala | 10 ++- .../test/scala/amf/io/BuildCycleTests.scala | 3 +- .../scala/amf/testing/ConfigProvider.scala | 3 +- 21 files changed, 154 insertions(+), 67 deletions(-) delete mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncSpec.scala create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/NotFinishedAsync20ParsePlugin.scala create mode 100644 amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async21.yaml create mode 100644 amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async22.yaml create mode 100644 amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async23.yaml create mode 100644 amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async24.yaml create mode 100644 amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async25.yaml create mode 100644 amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async26.yaml diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala index 59de7e1cd1..a5bfe502e8 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/Async20ParsePlugin.scala @@ -52,12 +52,6 @@ object Async20ParsePlugin extends OasLikeParsePlugin { private def parseAsyncUnit(header: AsyncHeader, root: Root)(implicit ctx: AsyncWebApiContext): BaseUnit = { header match { case Async20Header => document.AsyncApi20DocumentParser(root).parseDocument() - case Async21Header => document.AsyncApi21DocumentParser(root).parseDocument() - case Async22Header => document.AsyncApi22DocumentParser(root).parseDocument() - case Async23Header => document.AsyncApi23DocumentParser(root).parseDocument() - case Async24Header => document.AsyncApi24DocumentParser(root).parseDocument() - case Async25Header => document.AsyncApi25DocumentParser(root).parseDocument() - case Async26Header => document.AsyncApi26DocumentParser(root).parseDocument() case _ => throw new InvalidDocumentHeaderException(spec.id) } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala index 240af1b2df..88d35af639 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncHeader.scala @@ -2,7 +2,16 @@ package amf.apicontract.internal.spec.async import amf.core.client.scala.parse.document.SyamlParsedDocument import amf.core.internal.parser.{Root, YMapOps, YNodeLikeOps} -import amf.core.internal.remote.{AsyncApi20, Spec} +import amf.core.internal.remote.{ + AsyncApi20, + AsyncApi21, + AsyncApi22, + AsyncApi23, + AsyncApi24, + AsyncApi25, + AsyncApi26, + Spec +} import org.yaml.model.YMap /** */ diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncSpec.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncSpec.scala deleted file mode 100644 index 44766f846b..0000000000 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/AsyncSpec.scala +++ /dev/null @@ -1,33 +0,0 @@ -package amf.apicontract.internal.spec.async - -import amf.core.internal.remote.{Async, Mimes, Spec} - -case object AsyncApi21 extends Async { - override def version: String = "2.0" - override val mediaType: String = Mimes.`application/yaml` -} - -case object AsyncApi22 extends Async { - override def version: String = "2.0" - override val mediaType: String = Mimes.`application/yaml` -} - -case object AsyncApi23 extends Async { - override def version: String = "2.0" - override val mediaType: String = Mimes.`application/yaml` -} - -case object AsyncApi24 extends Async { - override def version: String = "2.0" - override val mediaType: String = Mimes.`application/yaml` -} - -case object AsyncApi25 extends Async { - override def version: String = "2.0" - override val mediaType: String = Mimes.`application/yaml` -} - -case object AsyncApi26 extends Async { - override def version: String = "2.0" - override val mediaType: String = Mimes.`application/yaml` -} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/NotFinishedAsync20ParsePlugin.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/NotFinishedAsync20ParsePlugin.scala new file mode 100644 index 0000000000..9bda10594b --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/NotFinishedAsync20ParsePlugin.scala @@ -0,0 +1,69 @@ +package amf.apicontract.internal.spec.async + +import amf.apicontract.internal.spec.async.AsyncHeader._ +import amf.apicontract.internal.spec.async.parser.context.{Async2WebApiContext, AsyncWebApiContext} +import amf.apicontract.internal.spec.async.parser.document +import amf.apicontract.internal.spec.common.AsyncWebApiDeclarations +import amf.apicontract.internal.spec.oas.OasLikeParsePlugin +import amf.apicontract.internal.spec.raml.Raml10ParsePlugin +import amf.core.client.scala.config.ParsingOptions +import amf.core.client.scala.exception.InvalidDocumentHeaderException +import amf.core.client.scala.model.document.BaseUnit +import amf.core.client.scala.parse.document.{EmptyFutureDeclarations, ParsedReference, ParserContext} +import amf.core.internal.parser.Root +import amf.core.internal.remote.{AsyncApi20, Mimes, Spec} + +/* + * This plugin should be merged with Async20ParsePlugin after Async 2.x feature is finished + */ +object NotFinishedAsync20ParsePlugin extends OasLikeParsePlugin { + + override def spec: Spec = AsyncApi20 + + override def applies(element: Root): Boolean = AsyncHeader(element).isDefined + + override def validSpecsToReference: Seq[Spec] = + super.validSpecsToReference :+ Raml10ParsePlugin.spec + + override def mediaTypes: Seq[String] = Seq(Mimes.`application/yaml`, Mimes.`application/json`) + + override def parse(document: Root, ctx: ParserContext): BaseUnit = { + val header = parseHeader(document) + implicit val newCtx: AsyncWebApiContext = + context(document.location, document.references, ctx.parsingOptions, ctx, spec = header.spec) + restrictCrossSpecReferences(document, ctx) + val parsed = parseAsyncUnit(header, document) + promoteFragments(parsed, newCtx) + } + + private def parseHeader(root: Root): AsyncHeader = + AsyncHeader(root).getOrElse(throw new InvalidDocumentHeaderException(spec.id)) + + private def parseAsyncUnit(header: AsyncHeader, root: Root)(implicit ctx: AsyncWebApiContext): BaseUnit = { + header match { + case Async20Header => document.AsyncApi20DocumentParser(root).parseDocument() + case Async21Header => document.AsyncApi21DocumentParser(root).parseDocument() + case Async22Header => document.AsyncApi22DocumentParser(root).parseDocument() + case Async23Header => document.AsyncApi23DocumentParser(root).parseDocument() + case Async24Header => document.AsyncApi24DocumentParser(root).parseDocument() + case Async25Header => document.AsyncApi25DocumentParser(root).parseDocument() + case Async26Header => document.AsyncApi26DocumentParser(root).parseDocument() + case _ => + throw new InvalidDocumentHeaderException(spec.id) + } + } + + private def context( + loc: String, + refs: Seq[ParsedReference], + options: ParsingOptions, + wrapped: ParserContext, + ds: Option[AsyncWebApiDeclarations] = None, + spec: Spec + ): Async2WebApiContext = { + // ensure unresolved references in external fragments are not resolved with main api definitions + val cleanContext = wrapped.copy(futureDeclarations = EmptyFutureDeclarations()) + cleanContext.globalSpace = wrapped.globalSpace + Async2WebApiContext(loc, refs, cleanContext, ds, options, spec) + } +} diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala index ccc59c39c2..497748e64c 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala @@ -3,7 +3,6 @@ package amf.apicontract.internal.spec.async.emitters.document import amf.apicontract.client.scala.model.domain.Tag import amf.apicontract.client.scala.model.domain.api.{Api, WebApi} import amf.apicontract.internal.metamodel.domain.api.WebApiModel -import amf.apicontract.internal.spec.async.{AsyncApi21, AsyncApi22, AsyncApi23, AsyncApi24, AsyncApi25, AsyncApi26} import amf.apicontract.internal.spec.async.emitters.context.AsyncSpecEmitterContext import amf.apicontract.internal.spec.async.emitters.domain.{ AsyncApiCreativeWorksEmitter, @@ -15,7 +14,16 @@ import amf.apicontract.internal.spec.common.emitter.{AgnosticShapeEmitterContext import amf.apicontract.internal.spec.oas.emitter.domain.{InfoEmitter, TagsEmitter} import amf.core.client.scala.model.document.{BaseUnit, Document} import amf.core.internal.parser.domain.FieldEntry -import amf.core.internal.remote.{AsyncApi20, Spec} +import amf.core.internal.remote.{ + AsyncApi20, + AsyncApi21, + AsyncApi22, + AsyncApi23, + AsyncApi24, + AsyncApi25, + AsyncApi26, + Spec +} import amf.core.internal.render.BaseEmitters.{EmptyMapEmitter, EntryPartEmitter, ValueEmitter, traverse} import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter @@ -78,6 +86,7 @@ class AsyncApi20DocumentEmitter(document: BaseUnit)(implicit val specCtx: AsyncS Seq(emitter.DeclarationsEmitterWrapper(emitters, ordering)) def versionEntry(b: YDocument.EntryBuilder): Unit = { + val default = "2.6.0" // the default is the latest version to always emit a valid Async Api spec val versionToEmit = document.sourceSpec .map { case AsyncApi20 => "2.0.0" @@ -87,8 +96,9 @@ class AsyncApi20DocumentEmitter(document: BaseUnit)(implicit val specCtx: AsyncS case AsyncApi24 => "2.4.0" case AsyncApi25 => "2.5.0" case AsyncApi26 => "2.6.0" + case _ => default } - .getOrElse("2.0.0") + .getOrElse(default) b.asyncapi = YNode(YScalar(versionToEmit), YType.Str) // this should not be necessary but for use the same logic } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala index 31221f9489..8143beeb8b 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala @@ -13,7 +13,16 @@ import amf.apicontract.internal.spec.async.parser.context.syntax.{ import amf.apicontract.internal.spec.common.AsyncWebApiDeclarations import amf.core.client.scala.config.ParsingOptions import amf.core.client.scala.parse.document.{ParsedReference, ParserContext} -import amf.core.internal.remote.{AsyncApi20, Spec} +import amf.core.internal.remote.{ + AsyncApi20, + AsyncApi21, + AsyncApi22, + AsyncApi23, + AsyncApi24, + AsyncApi25, + AsyncApi26, + Spec +} import amf.shapes.internal.spec.async.parser.Async2Settings import amf.shapes.internal.spec.common.parser.SpecSettings diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi21DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi21DocumentParser.scala index 26d17d11b6..c4e5416809 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi21DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi21DocumentParser.scala @@ -1,15 +1,10 @@ package amf.apicontract.internal.spec.async.parser.document import amf.apicontract.client.scala.model.domain.api.AsyncApi -import amf.apicontract.internal.spec.async.{AsyncApi21, AsyncApi22} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext -import amf.apicontract.internal.spec.async.parser.domain.declarations.{ - Async21DeclarationParser, - Async22DeclarationParser, - AsyncDeclarationParser -} +import amf.apicontract.internal.spec.async.parser.domain.declarations.{Async21DeclarationParser, AsyncDeclarationParser} import amf.core.internal.parser.Root -import amf.core.internal.remote.Spec +import amf.core.internal.remote.{AsyncApi21, Spec} import org.yaml.model.YMap object AsyncApi21DocumentParser { diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi22DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi22DocumentParser.scala index f2519347d3..270797d9b7 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi22DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi22DocumentParser.scala @@ -1,9 +1,9 @@ package amf.apicontract.internal.spec.async.parser.document -import amf.apicontract.internal.spec.async.{AsyncApi21, AsyncApi22} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.async.parser.domain.declarations.Async22DeclarationParser import amf.core.internal.parser.Root +import amf.core.internal.remote.AsyncApi22 object AsyncApi22DocumentParser { // Doesn't add new functionality to previous version diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi23DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi23DocumentParser.scala index a410ff4f36..9a7340c8e0 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi23DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi23DocumentParser.scala @@ -1,12 +1,9 @@ package amf.apicontract.internal.spec.async.parser.document -import amf.apicontract.internal.spec.async.{AsyncApi21, AsyncApi22, AsyncApi23} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext -import amf.apicontract.internal.spec.async.parser.domain.declarations.{ - Async22DeclarationParser, - Async23DeclarationParser -} +import amf.apicontract.internal.spec.async.parser.domain.declarations.Async23DeclarationParser import amf.core.internal.parser.Root +import amf.core.internal.remote.AsyncApi23 object AsyncApi23DocumentParser { // Doesn't add new functionality to previous version diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi24DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi24DocumentParser.scala index 16761eb757..2eec6d18be 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi24DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi24DocumentParser.scala @@ -1,12 +1,9 @@ package amf.apicontract.internal.spec.async.parser.document -import amf.apicontract.internal.spec.async.{AsyncApi22, AsyncApi24} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext -import amf.apicontract.internal.spec.async.parser.domain.declarations.{ - Async22DeclarationParser, - Async24DeclarationParser -} +import amf.apicontract.internal.spec.async.parser.domain.declarations.Async24DeclarationParser import amf.core.internal.parser.Root +import amf.core.internal.remote.AsyncApi24 object AsyncApi24DocumentParser { // Doesn't add new functionality to previous version diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi25DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi25DocumentParser.scala index 77219981a0..aa5e29cad7 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi25DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi25DocumentParser.scala @@ -1,9 +1,9 @@ package amf.apicontract.internal.spec.async.parser.document -import amf.apicontract.internal.spec.async.AsyncApi25 import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.async.parser.domain.declarations.Async25DeclarationParser import amf.core.internal.parser.Root +import amf.core.internal.remote.AsyncApi25 object AsyncApi25DocumentParser { // Doesn't add new functionality to previous version diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi26DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi26DocumentParser.scala index 93ff7c9fae..964e5f9eaf 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi26DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi26DocumentParser.scala @@ -1,9 +1,9 @@ package amf.apicontract.internal.spec.async.parser.document -import amf.apicontract.internal.spec.async.AsyncApi26 import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.async.parser.domain.declarations.Async26DeclarationParser import amf.core.internal.parser.Root +import amf.core.internal.remote.AsyncApi26 object AsyncApi26DocumentParser { // Doesn't add new functionality to previous version diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async21.yaml b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async21.yaml new file mode 100644 index 0000000000..9251ed4d56 --- /dev/null +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async21.yaml @@ -0,0 +1,5 @@ +asyncapi: 2.1.0 +channels: {} +info: + title: Empty + version: v1 diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async22.yaml b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async22.yaml new file mode 100644 index 0000000000..aa013c92a3 --- /dev/null +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async22.yaml @@ -0,0 +1,5 @@ +asyncapi: 2.2.0 +channels: {} +info: + title: Empty + version: v1 diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async23.yaml b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async23.yaml new file mode 100644 index 0000000000..fd28b04e5b --- /dev/null +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async23.yaml @@ -0,0 +1,5 @@ +asyncapi: 2.3.0 +channels: {} +info: + title: Empty + version: v1 diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async24.yaml b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async24.yaml new file mode 100644 index 0000000000..05bfc99bf4 --- /dev/null +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async24.yaml @@ -0,0 +1,5 @@ +asyncapi: 2.4.0 +channels: {} +info: + title: Empty + version: v1 diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async25.yaml b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async25.yaml new file mode 100644 index 0000000000..878f52ca5e --- /dev/null +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async25.yaml @@ -0,0 +1,5 @@ +asyncapi: 2.5.0 +channels: {} +info: + title: Empty + version: v1 diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async26.yaml b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async26.yaml new file mode 100644 index 0000000000..cc27eb94b6 --- /dev/null +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/empty-async26.yaml @@ -0,0 +1,5 @@ +asyncapi: 2.6.0 +channels: {} +info: + title: Empty + version: v1 diff --git a/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala b/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala index f102447b13..dec6c1f763 100644 --- a/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala +++ b/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala @@ -124,7 +124,15 @@ class Async20CycleTest extends FunSuiteCycleTests { FixtureData("Draft 7 schemas cycle", "draft-7-schemas-cycle.yaml", "draft-7-schemas-output.yaml"), FixtureData("Security schemes", "security-schemes.yaml", "security-schemes.yaml"), FixtureData("Operation and message traits", "operation-message-traits.yaml", "operation-message-traits.yaml"), - FixtureData("components emission", "components-cycle.yaml", "components-cycle.yaml") + FixtureData("components emission", "components-cycle.yaml", "components-cycle.yaml"), + FixtureData("Async 2.1 doc - empty", "empty-async21.yaml", "empty-async21.yaml"), + FixtureData("Async 2.2 doc - empty", "empty-async22.yaml", "empty-async22.yaml"), + FixtureData("Async 2.3 doc - empty", "empty-async23.yaml", "empty-async23.yaml"), + FixtureData("Async 2.4 doc - empty", "empty-async24.yaml", "empty-async24.yaml"), + FixtureData("Async 2.5 doc - empty", "empty-async25.yaml", "empty-async25.yaml"), + FixtureData("Async 2.6 doc - empty", "empty-async26.yaml", "empty-async26.yaml") + +// TODO: figure out why this test is commented out // FixtureData("Channel params with refs", "references/channel-params.yaml", "references/channel-params.yaml"), ) } diff --git a/amf-cli/shared/src/test/scala/amf/io/BuildCycleTests.scala b/amf-cli/shared/src/test/scala/amf/io/BuildCycleTests.scala index d87bd1244e..c0c4aea747 100644 --- a/amf-cli/shared/src/test/scala/amf/io/BuildCycleTests.scala +++ b/amf-cli/shared/src/test/scala/amf/io/BuildCycleTests.scala @@ -1,6 +1,7 @@ package amf.io import amf.apicontract.client.scala.{AMFConfiguration, APIConfiguration} +import amf.apicontract.internal.spec.async.NotFinishedAsync20ParsePlugin import amf.core.client.scala.AMFGraphConfiguration import amf.core.client.scala.config.RenderOptions import amf.core.client.scala.errorhandling.{AMFErrorHandler, IgnoringErrorHandler} @@ -147,7 +148,7 @@ trait BuildCycleTestCommon extends FileAssertionTest { def renderOptions(): RenderOptions = RenderOptions().withoutFlattenedJsonLd protected def buildConfig(options: Option[RenderOptions], eh: Option[AMFErrorHandler]): AMFConfiguration = { - val amfConfig: AMFConfiguration = APIConfiguration.API() + val amfConfig: AMFConfiguration = APIConfiguration.API().withPlugin(NotFinishedAsync20ParsePlugin) val renderedConfig: AMFConfiguration = options.fold(amfConfig.withRenderOptions(renderOptions()))(r => { amfConfig.withRenderOptions(r) }) diff --git a/amf-cli/shared/src/test/scala/amf/testing/ConfigProvider.scala b/amf-cli/shared/src/test/scala/amf/testing/ConfigProvider.scala index 997f52be43..a7d0e480b5 100644 --- a/amf-cli/shared/src/test/scala/amf/testing/ConfigProvider.scala +++ b/amf-cli/shared/src/test/scala/amf/testing/ConfigProvider.scala @@ -1,6 +1,7 @@ package amf.testing import amf.apicontract.client.scala._ +import amf.apicontract.internal.spec.async.NotFinishedAsync20ParsePlugin import amf.core.internal.remote._ import amf.graphql.client.scala.GraphQLConfiguration import amf.graphqlfederation.client.scala.GraphQLFederationConfiguration @@ -13,7 +14,7 @@ object ConfigProvider { case Raml10 => RAMLConfiguration.RAML10() case Oas20 => OASConfiguration.OAS20() case Oas30 => OASConfiguration.OAS30() - case AsyncApi20 => AsyncAPIConfiguration.Async20() + case AsyncApi20 => AsyncAPIConfiguration.Async20().withPlugin(NotFinishedAsync20ParsePlugin) case Grpc => GRPCConfiguration.GRPC() case GraphQL => GraphQLConfiguration.GraphQL() case GraphQLFederation => GraphQLFederationConfiguration.GraphQLFederation() From 65f9a15c27a683f8e3bd736b8421c0120dece7be Mon Sep 17 00:00:00 2001 From: arielmirra Date: Wed, 31 Jan 2024 18:07:37 -0300 Subject: [PATCH 26/33] chore: fix imports in async files --- .../parser/context/Async2WebApiContext.scala | 11 +------ .../document/AsyncApiDocumentParser.scala | 30 +++---------------- .../Async20MultiPlatformValidationsTest.scala | 2 -- ...c20UniquePlatformUnitValidationsTest.scala | 1 - 4 files changed, 5 insertions(+), 39 deletions(-) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala index 8143beeb8b..02eabd85b5 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/Async2WebApiContext.scala @@ -1,15 +1,7 @@ package amf.apicontract.internal.spec.async.parser.context import amf.apicontract.internal.spec.async._ -import amf.apicontract.internal.spec.async.parser.context.syntax.{ - Async20Syntax, - Async21Syntax, - Async22Syntax, - Async23Syntax, - Async24Syntax, - Async25Syntax, - Async26Syntax -} +import amf.apicontract.internal.spec.async.parser.context.syntax._ import amf.apicontract.internal.spec.common.AsyncWebApiDeclarations import amf.core.client.scala.config.ParsingOptions import amf.core.client.scala.parse.document.{ParsedReference, ParserContext} @@ -24,7 +16,6 @@ import amf.core.internal.remote.{ Spec } import amf.shapes.internal.spec.async.parser.Async2Settings -import amf.shapes.internal.spec.common.parser.SpecSettings import scala.collection.mutable diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala index beca4ee8b7..03629fdfff 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala @@ -1,32 +1,12 @@ package amf.apicontract.internal.spec.async.parser.document -import amf.aml.internal.parse.common.DeclarationKey import amf.apicontract.client.scala.model.document.APIContractProcessingData import amf.apicontract.client.scala.model.domain.api.AsyncApi -import amf.apicontract.client.scala.model.domain.bindings.{ - ChannelBindings, - MessageBindings, - OperationBindings, - ServerBindings -} -import amf.apicontract.client.scala.model.domain.{EndPoint, Operation, Parameter} +import amf.apicontract.client.scala.model.domain.EndPoint import amf.apicontract.internal.metamodel.domain.api.WebApiModel -import amf.apicontract.internal.metamodel.domain.bindings.{ - ChannelBindingsModel, - MessageBindingsModel, - OperationBindingsModel, - ServerBindingsModel -} -import amf.apicontract.internal.metamodel.domain.security.SecuritySchemeModel -import amf.apicontract.internal.spec.async.parser.bindings.{ - AsyncChannelBindingsParser, - AsyncMessageBindingsParser, - AsyncOperationBindingsParser, - AsyncServerBindingsParser -} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.async.parser.domain._ -import amf.apicontract.internal.spec.async.parser.domain.declarations.{Async20DeclarationParser, AsyncDeclarationParser} +import amf.apicontract.internal.spec.async.parser.domain.declarations.AsyncDeclarationParser import amf.apicontract.internal.spec.common.parser._ import amf.apicontract.internal.spec.oas.parser.document.OasLikeDeclarationsHelper import amf.apicontract.internal.spec.oas.parser.domain.{OasLikeInformationParser, OasLikeTagsParser} @@ -35,15 +15,13 @@ import amf.apicontract.internal.validation.definitions.ParserSideValidations.{ MandatoryChannelsProperty } import amf.core.client.scala.model.document.Document -import amf.core.client.scala.model.domain.{AmfArray, AmfObject, AmfScalar, DomainElement} +import amf.core.client.scala.model.domain.{AmfArray, AmfObject, AmfScalar} import amf.core.client.scala.parse.document.SyamlParsedDocument -import amf.core.internal.annotations.DeclaredElement import amf.core.internal.metamodel.document.DocumentModel -import amf.core.internal.metamodel.domain.DomainElementModel import amf.core.internal.parser.domain.{Annotations, ScalarNode} import amf.core.internal.parser.{Root, YMapOps} import amf.core.internal.remote.Spec -import amf.shapes.internal.spec.common.parser.{AnnotationParser, OasLikeCreativeWorkParser, YMapEntryLike} +import amf.shapes.internal.spec.common.parser.{AnnotationParser, OasLikeCreativeWorkParser} import org.yaml.model.{YMap, YMapEntry, YType} abstract class AsyncApiDocumentParser(root: Root, spec: Spec, declarationParser: AsyncDeclarationParser)(implicit diff --git a/amf-cli/shared/src/test/scala/amf/validation/Async20MultiPlatformValidationsTest.scala b/amf-cli/shared/src/test/scala/amf/validation/Async20MultiPlatformValidationsTest.scala index 7ab097b939..8dccc36d3a 100644 --- a/amf-cli/shared/src/test/scala/amf/validation/Async20MultiPlatformValidationsTest.scala +++ b/amf-cli/shared/src/test/scala/amf/validation/Async20MultiPlatformValidationsTest.scala @@ -1,7 +1,5 @@ package amf.validation -import amf.core.client.common.validation.Async20Profile -import amf.core.internal.remote.{Async20YamlHint, Hint} import org.scalatest.matchers.should.Matchers class Async20MultiPlatformValidationsTest extends MultiPlatformReportGenTest with Matchers { diff --git a/amf-cli/shared/src/test/scala/amf/validation/Async20UniquePlatformUnitValidationsTest.scala b/amf-cli/shared/src/test/scala/amf/validation/Async20UniquePlatformUnitValidationsTest.scala index 8d9b4c11b8..8b48285c05 100644 --- a/amf-cli/shared/src/test/scala/amf/validation/Async20UniquePlatformUnitValidationsTest.scala +++ b/amf-cli/shared/src/test/scala/amf/validation/Async20UniquePlatformUnitValidationsTest.scala @@ -1,6 +1,5 @@ package amf.validation -import amf.core.internal.remote.{Async20JsonHint, Async20YamlHint, Hint} import org.scalatest.matchers.should.Matchers class Async20UniquePlatformUnitValidationsTest extends UniquePlatformReportGenTest with Matchers { From 9f65a3ff3cf419b317885780b6b043976e5e8991 Mon Sep 17 00:00:00 2001 From: arielmirra Date: Wed, 31 Jan 2024 18:07:50 -0300 Subject: [PATCH 27/33] W-12689951: add mercure binding in async21+ --- .../parser/bindings/AsyncBindingsParser.scala | 6 +---- .../parser/context/AsyncValidBindingSet.scala | 2 +- .../parser/context/syntax/Async21Syntax.scala | 3 ++- .../async20/bindings/mercure-binding.yaml | 23 +++++++++++++++++++ .../scala/amf/emit/Async20CycleTest.scala | 8 ++++++- 5 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 amf-cli/shared/src/test/resources/upanddown/cycle/async20/bindings/mercure-binding.yaml diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala index 993608bb1d..e430d9eb34 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/bindings/AsyncBindingsParser.scala @@ -1,19 +1,14 @@ package amf.apicontract.internal.spec.async.parser.bindings -import amf.apicontract.internal.spec.async.parser.bindings.Bindings._ import amf.core.client.scala.model.domain._ import amf.core.internal.metamodel.Field import amf.core.internal.parser.YMapOps import amf.core.internal.parser.domain.{Annotations, ScalarNode} import amf.core.internal.validation.CoreValidations import amf.apicontract.internal.metamodel.domain.bindings.BindingType -import amf.apicontract.client.scala.model.domain.bindings._ import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext import amf.apicontract.internal.spec.common.parser.SpecParserOps -import amf.apicontract.internal.validation.definitions.ParserSideValidations -import amf.shapes.internal.spec.common.JSONSchemaDraft7SchemaVersion import amf.shapes.internal.spec.common.parser.YMapEntryLike -import amf.shapes.internal.spec.oas.parser.OasTypeParser import org.yaml.model.{YMap, YMapEntry, YNode, YScalar} abstract class AsyncBindingsParser(entryLike: YMapEntryLike)(implicit ctx: AsyncWebApiContext) extends SpecParserOps { @@ -121,4 +116,5 @@ object Bindings { val Sqs = "sqs" val Stomp = "stomp" val Redis = "redis" + val Mercure = "mercure" } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncValidBindingSet.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncValidBindingSet.scala index fc9069d08f..00323de96a 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncValidBindingSet.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/AsyncValidBindingSet.scala @@ -11,7 +11,7 @@ object AsyncValidBindingSet { private val basic = Set(Http, WebSockets, Kafka, Amqp, Amqp1, Mqtt, Mqtt5, Nats, Jms, Sns, Sqs, Stomp, Redis) val async20: AsyncValidBindingSet = AsyncValidBindingSet(basic) - val async21: AsyncValidBindingSet = async20 + val async21: AsyncValidBindingSet = async20.add(Mercure) val async22: AsyncValidBindingSet = async21 val async23: AsyncValidBindingSet = async22 val async24: AsyncValidBindingSet = async23 diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async21Syntax.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async21Syntax.scala index 7d056ab879..9977ef0caa 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async21Syntax.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/context/syntax/Async21Syntax.scala @@ -1,7 +1,8 @@ package amf.apicontract.internal.spec.async.parser.context.syntax +import amf.apicontract.internal.spec.async.parser.bindings.Bindings.Mercure import amf.shapes.internal.spec.common.parser.SpecSyntax object Async21Syntax extends SpecSyntax { - override val nodes: Map[String, Set[String]] = Async20Syntax.nodes + override val nodes: Map[String, Set[String]] = add(Async20Syntax.nodes, "bindings", Set(Mercure)) } diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/async20/bindings/mercure-binding.yaml b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/bindings/mercure-binding.yaml new file mode 100644 index 0000000000..5ebda69016 --- /dev/null +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/bindings/mercure-binding.yaml @@ -0,0 +1,23 @@ +asyncapi: 2.1.0 +info: + title: test mercure binding + version: 1.0.0 +servers: + theName: + url: some.com + protocol: mercure + bindings: + mercure: {} +channels: + some-channel: + bindings: + mercure: {} + description: some channel + publish: + bindings: + mercure: {} + message: + bindings: + mercure: {} + payload: + type: string diff --git a/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala b/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala index dec6c1f763..e199706bc7 100644 --- a/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala +++ b/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala @@ -125,12 +125,18 @@ class Async20CycleTest extends FunSuiteCycleTests { FixtureData("Security schemes", "security-schemes.yaml", "security-schemes.yaml"), FixtureData("Operation and message traits", "operation-message-traits.yaml", "operation-message-traits.yaml"), FixtureData("components emission", "components-cycle.yaml", "components-cycle.yaml"), + // TODO: fill async 2.x with each spec new features FixtureData("Async 2.1 doc - empty", "empty-async21.yaml", "empty-async21.yaml"), FixtureData("Async 2.2 doc - empty", "empty-async22.yaml", "empty-async22.yaml"), FixtureData("Async 2.3 doc - empty", "empty-async23.yaml", "empty-async23.yaml"), FixtureData("Async 2.4 doc - empty", "empty-async24.yaml", "empty-async24.yaml"), FixtureData("Async 2.5 doc - empty", "empty-async25.yaml", "empty-async25.yaml"), - FixtureData("Async 2.6 doc - empty", "empty-async26.yaml", "empty-async26.yaml") + FixtureData("Async 2.6 doc - empty", "empty-async26.yaml", "empty-async26.yaml"), + FixtureData( + "mercure binding", + "bindings/mercure-binding.yaml", + "bindings/mercure-binding.yaml" + ) // TODO: figure out why this test is commented out // FixtureData("Channel params with refs", "references/channel-params.yaml", "references/channel-params.yaml"), From 8bd86a524c31af6a80430232d731775111c807fe Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Thu, 1 Feb 2024 15:09:52 -0300 Subject: [PATCH 28/33] W-12689954 add emitter and cycle test for defaultContentType --- .../document/AsyncApi20DocumentEmitter.scala | 25 +++++----------- .../AsyncApiDefaultContentTypeEmitter.scala | 30 +++++++++++++++++++ .../cycle/async20/default-content-type.yaml | 6 ++++ .../scala/amf/emit/Async20CycleTest.scala | 1 + 4 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/domain/AsyncApiDefaultContentTypeEmitter.scala create mode 100644 amf-cli/shared/src/test/resources/upanddown/cycle/async20/default-content-type.yaml diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala index 497748e64c..d92b0651a5 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/document/AsyncApi20DocumentEmitter.scala @@ -4,33 +4,22 @@ import amf.apicontract.client.scala.model.domain.Tag import amf.apicontract.client.scala.model.domain.api.{Api, WebApi} import amf.apicontract.internal.metamodel.domain.api.WebApiModel import amf.apicontract.internal.spec.async.emitters.context.AsyncSpecEmitterContext -import amf.apicontract.internal.spec.async.emitters.domain.{ - AsyncApiCreativeWorksEmitter, - AsyncApiEndpointsEmitter, - AsyncApiServersEmitter -} +import amf.apicontract.internal.spec.async.emitters.domain.{AsyncApiCreativeWorksEmitter, AsyncApiEndpointsEmitter, AsyncApiServersEmitter, DefaultContentTypeEmitter} import amf.apicontract.internal.spec.common.emitter import amf.apicontract.internal.spec.common.emitter.{AgnosticShapeEmitterContextAdapter, SecurityRequirementsEmitter} import amf.apicontract.internal.spec.oas.emitter.domain.{InfoEmitter, TagsEmitter} import amf.core.client.scala.model.document.{BaseUnit, Document} +import amf.core.client.scala.model.domain.{AmfArray, AmfScalar} import amf.core.internal.parser.domain.FieldEntry -import amf.core.internal.remote.{ - AsyncApi20, - AsyncApi21, - AsyncApi22, - AsyncApi23, - AsyncApi24, - AsyncApi25, - AsyncApi26, - Spec -} -import amf.core.internal.render.BaseEmitters.{EmptyMapEmitter, EntryPartEmitter, ValueEmitter, traverse} +import amf.core.internal.remote.{AsyncApi20, AsyncApi21, AsyncApi22, AsyncApi23, AsyncApi24, AsyncApi25, AsyncApi26, Spec} +import amf.core.internal.render.BaseEmitters.{EmptyMapEmitter, EntryPartEmitter, ValueEmitter, pos, traverse} import amf.core.internal.render.SpecOrdering import amf.core.internal.render.emitters.EntryEmitter -import amf.core.internal.validation.CoreValidations.TransformationValidation +import amf.core.internal.validation.CoreValidations.{NotLinkable, TransformationValidation} import amf.shapes.client.scala.model.domain.CreativeWork import amf.shapes.internal.annotations.OrphanOasExtension import amf.shapes.internal.spec.common.emitter.annotations.AnnotationsEmitter +import org.mulesoft.common.client.lexical.Position import org.yaml.model.{YDocument, YNode, YScalar, YType} import scala.collection.mutable @@ -134,6 +123,8 @@ class AsyncApi20DocumentEmitter(document: BaseUnit)(implicit val specCtx: AsyncS fs.entry(WebApiModel.Security).map(f => result += SecurityRequirementsEmitter("security", f, ordering)) + fs.entry(WebApiModel.ContentType).map(f => result += DefaultContentTypeEmitter(f, ordering)) + result ++= AnnotationsEmitter(api, ordering).emitters ordering.sorted(result) } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/domain/AsyncApiDefaultContentTypeEmitter.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/domain/AsyncApiDefaultContentTypeEmitter.scala new file mode 100644 index 0000000000..b77e0e27c3 --- /dev/null +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/emitters/domain/AsyncApiDefaultContentTypeEmitter.scala @@ -0,0 +1,30 @@ +package amf.apicontract.internal.spec.async.emitters.domain + +import amf.core.client.scala.model.domain.{AmfArray, AmfScalar} +import amf.core.internal.parser.domain.FieldEntry +import amf.core.internal.render.BaseEmitters.pos +import amf.core.internal.render.SpecOrdering +import amf.core.internal.render.emitters.EntryEmitter +import org.mulesoft.common.client.lexical.Position +import org.yaml.model.{YDocument, YNode} + +case class DefaultContentTypeEmitter(f: FieldEntry, ordering: SpecOrdering) extends EntryEmitter { + override def emit(b: YDocument.EntryBuilder): Unit = { + val maybeString: Option[String] = getValue + maybeString.foreach(contentType => b.entry("defaultContentType", YNode(contentType))) + + } + + private def getValue: Option[String] = { + f.value.value match { + case array: AmfArray => + array.values + .headOption + .map(f => f.asInstanceOf[AmfScalar].value.toString) + case _ => + None + } + } + + override def position(): Position = pos(f.value.annotations) +} diff --git a/amf-cli/shared/src/test/resources/upanddown/cycle/async20/default-content-type.yaml b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/default-content-type.yaml new file mode 100644 index 0000000000..05fd81888d --- /dev/null +++ b/amf-cli/shared/src/test/resources/upanddown/cycle/async20/default-content-type.yaml @@ -0,0 +1,6 @@ +asyncapi: 2.1.0 +info: + title: Test API with defaultContentType + version: 1.0.0 +defaultContentType: application/json +channels: {} diff --git a/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala b/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala index e199706bc7..fb3b7c0cdf 100644 --- a/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala +++ b/amf-cli/shared/src/test/scala/amf/emit/Async20CycleTest.scala @@ -64,6 +64,7 @@ class Async20CycleTest extends FunSuiteCycleTests { def cyclesAsyncAsync: Seq[FixtureData] = Seq( FixtureData("Empty cycle", "empty.yaml", "empty.yaml"), + FixtureData("Default Content Type", "default-content-type.yaml", "default-content-type.yaml"), FixtureData("Info cycle", "info.yaml", "info.yaml"), FixtureData("Tags cycle", "tags.yaml", "tags.yaml"), FixtureData("Documentation cycle", "documentation.yaml", "documentation.yaml"), From baaf2bac441059d2e3807f694d6983ceb9fac73a Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Fri, 2 Feb 2024 16:08:23 -0300 Subject: [PATCH 29/33] Publish 5.4.8-RC.0 --- Jenkinsfile | 3 +++ amf-apicontract.versions | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7bff044cda..9682b9c237 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -69,6 +69,7 @@ pipeline { anyOf { branch 'master' branch 'develop' + branch 'release/*' } } steps { @@ -84,6 +85,7 @@ pipeline { anyOf { branch 'master' branch 'develop' + branch 'release/*' } } steps { @@ -98,6 +100,7 @@ pipeline { anyOf { branch 'master' branch 'develop' + branch 'release/*' } } steps { diff --git a/amf-apicontract.versions b/amf-apicontract.versions index 80d7504558..44b51a7abb 100644 --- a/amf-apicontract.versions +++ b/amf-apicontract.versions @@ -1,5 +1,5 @@ -amf.apicontract=5.5.0-SNAPSHOT -amf.aml=6.5.0-SNAPSHOT +amf.apicontract=5.4.8-RC.0 +amf.aml=6.4.8-RC.0 amf.model=3.8.2 antlr4Version=0.7.25 amf.validation.profile.dialect=1.6.0 From d54c551cb2875638421497e8b0751e373b55f8d8 Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Wed, 7 Feb 2024 14:27:47 -0300 Subject: [PATCH 30/33] Publish 5.4.8 --- Jenkinsfile | 3 --- amf-apicontract.versions | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9682b9c237..7bff044cda 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -69,7 +69,6 @@ pipeline { anyOf { branch 'master' branch 'develop' - branch 'release/*' } } steps { @@ -85,7 +84,6 @@ pipeline { anyOf { branch 'master' branch 'develop' - branch 'release/*' } } steps { @@ -100,7 +98,6 @@ pipeline { anyOf { branch 'master' branch 'develop' - branch 'release/*' } } steps { diff --git a/amf-apicontract.versions b/amf-apicontract.versions index 44b51a7abb..f91242cc7a 100644 --- a/amf-apicontract.versions +++ b/amf-apicontract.versions @@ -1,5 +1,5 @@ -amf.apicontract=5.4.8-RC.0 -amf.aml=6.4.8-RC.0 +amf.apicontract=5.4.8 +amf.aml=6.4.8 amf.model=3.8.2 antlr4Version=0.7.25 amf.validation.profile.dialect=1.6.0 From c011d5b38de1dd8e4022dbf0f907a7c1d9cad490 Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Wed, 7 Feb 2024 17:12:39 -0300 Subject: [PATCH 31/33] W-14991650 (fix): fixed declaration keys setting in Async 2.0 --- .../document/AsyncApi20DocumentParser.scala | 2 +- .../document/AsyncApiDocumentParser.scala | 8 +-- .../Async20DeclarationParser.scala | 63 +++++++++++++------ .../Async21DeclarationParser.scala | 2 +- .../Async23DeclarationParser.scala | 7 ++- .../Async24DeclarationParser.scala | 7 ++- .../declarations/AsyncDeclarationParser.scala | 3 +- .../scala/amf/emit/DeclarationKeysTest.scala | 26 ++++++++ 8 files changed, 87 insertions(+), 31 deletions(-) create mode 100644 amf-cli/shared/src/test/scala/amf/emit/DeclarationKeysTest.scala diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala index f5399c4fed..8cb83d3106 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApi20DocumentParser.scala @@ -5,6 +5,6 @@ import amf.apicontract.internal.spec.async.parser.domain.declarations.{Async20De import amf.core.internal.parser.Root import amf.core.internal.remote.Spec.ASYNC20 -case class AsyncApi20DocumentParser(root: Root, declarationParser: AsyncDeclarationParser = Async20DeclarationParser)( +case class AsyncApi20DocumentParser(root: Root, declarationParser: AsyncDeclarationParser = Async20DeclarationParser())( override implicit val ctx: AsyncWebApiContext ) extends AsyncApiDocumentParser(root, ASYNC20, declarationParser)(ctx) diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala index 03629fdfff..ae5a4cf792 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/document/AsyncApiDocumentParser.scala @@ -44,19 +44,19 @@ abstract class AsyncApiDocumentParser(root: Root, spec: Spec, declarationParser: document .setWithoutId(DocumentModel.Encodes, api, Annotations.inferred()) - addDeclarationsToModel(document) if (references.nonEmpty) document.withReferences(references.baseUnitReferences()) ctx.futureDeclarations.resolve() document } - private def parseDeclarations(map: YMap, parentObj: AmfObject) = { + private def parseDeclarations(map: YMap, document: Document) = { map.key("components").foreach { components => val parent = root.location + "#/declarations" val componentsMap = components.value.as[YMap] - declarationParser.parseDeclarations(componentsMap, parent) - ctx.closedShape(parentObj, componentsMap, "components") + declarationParser.parseDeclarations(componentsMap, parent, document) + ctx.closedShape(document, componentsMap, "components") +// addDeclarationsToModel(document) // TODO: had to move this to each declaration parser as HF for release RCs validateNames() } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async20DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async20DeclarationParser.scala index fe7c349a4a..6c0911ddad 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async20DeclarationParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async20DeclarationParser.scala @@ -1,14 +1,35 @@ package amf.apicontract.internal.spec.async.parser.domain.declarations import amf.aml.internal.parse.common.{DeclarationKey, DeclarationKeyCollector} -import amf.apicontract.client.scala.model.domain.bindings.{ChannelBindings, MessageBindings, OperationBindings, ServerBindings} +import amf.apicontract.client.scala.model.domain.bindings.{ + ChannelBindings, + MessageBindings, + OperationBindings, + ServerBindings +} import amf.apicontract.client.scala.model.domain.{Operation, Parameter} -import amf.apicontract.internal.metamodel.domain.bindings.{ChannelBindingsModel, MessageBindingsModel, OperationBindingsModel, ServerBindingsModel} +import amf.apicontract.internal.metamodel.domain.bindings.{ + ChannelBindingsModel, + MessageBindingsModel, + OperationBindingsModel, + ServerBindingsModel +} import amf.apicontract.internal.metamodel.domain.security.SecuritySchemeModel -import amf.apicontract.internal.spec.async.parser.bindings.{AsyncChannelBindingsParser, AsyncMessageBindingsParser, AsyncOperationBindingsParser, AsyncServerBindingsParser} +import amf.apicontract.internal.spec.async.parser.bindings.{ + AsyncChannelBindingsParser, + AsyncMessageBindingsParser, + AsyncOperationBindingsParser, + AsyncServerBindingsParser +} import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext -import amf.apicontract.internal.spec.async.parser.domain.{AsyncCorrelationIdParser, AsyncMessageParser, AsyncOperationParser, AsyncParametersParser} +import amf.apicontract.internal.spec.async.parser.domain.{ + AsyncCorrelationIdParser, + AsyncMessageParser, + AsyncOperationParser, + AsyncParametersParser +} import amf.apicontract.internal.spec.oas.parser.document.OasLikeDeclarationsHelper +import amf.core.client.scala.model.document.Document import amf.core.client.scala.model.domain.{AmfScalar, DomainElement} import amf.core.internal.annotations.DeclaredElement import amf.core.internal.metamodel.domain.DomainElementModel @@ -17,15 +38,16 @@ import amf.core.internal.parser.domain.Annotations import amf.shapes.internal.spec.common.parser.YMapEntryLike import org.yaml.model.{YMap, YMapEntry} - -object Async20DeclarationParser - extends AsyncDeclarationParser +case class Async20DeclarationParser() + extends AsyncDeclarationParser with DeclarationKeyCollector with OasLikeDeclarationsHelper { protected val definitionsKey = "schemas" - override def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { + override def parseDeclarations(map: YMap, parent: String, document: Document)(implicit + ctx: AsyncWebApiContext + ): Unit = { parseSecuritySchemeDeclarations(map, parent + "/securitySchemes") parseCorrelationIdDeclarations(map, parent + "/correlationIds") super.parseTypeDeclarations(map, Some(this)) @@ -39,6 +61,7 @@ object Async20DeclarationParser parseMessageTraits(map, parent + "/messageTraits") parseMessageDeclarations(map, parent + "/messages") + addDeclarationsToModel(document) } private def parseMessageDeclarations(componentsMap: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = @@ -60,7 +83,7 @@ object Async20DeclarationParser entry => { addDeclarationKey(DeclarationKey(entry, isAbstract = true)) entry.value.as[YMap].entries.foreach { entry => - val adopt = (o: Operation) => o + val adopt = (o: Operation) => o val operation = AsyncOperationParser(entry, adopt, isTrait = true).parse() operation.add(DeclaredElement()) ctx.declarations += operation @@ -108,7 +131,7 @@ object Async20DeclarationParser } private def parseParameterDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { componentsMap.key( "parameters", @@ -124,7 +147,7 @@ object Async20DeclarationParser } private def parseCorrelationIdDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { componentsMap.key( "correlationIds", @@ -139,7 +162,7 @@ object Async20DeclarationParser } private def parseMessageBindingsDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { parseBindingsDeclarations[MessageBindings]( "messageBindings", @@ -152,7 +175,7 @@ object Async20DeclarationParser } private def parseServerBindingsDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { parseBindingsDeclarations[ServerBindings]( "serverBindings", @@ -165,7 +188,7 @@ object Async20DeclarationParser } private def parseOperationBindingsDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { parseBindingsDeclarations[OperationBindings]( "operationBindings", @@ -178,7 +201,7 @@ object Async20DeclarationParser } private def parseChannelBindingsDeclarations(componentsMap: YMap, parent: String)(implicit - ctx: AsyncWebApiContext + ctx: AsyncWebApiContext ): Unit = { parseBindingsDeclarations[ChannelBindings]( "channelBindings", @@ -191,11 +214,11 @@ object Async20DeclarationParser } private def parseBindingsDeclarations[T <: DomainElement]( - keyword: String, - componentsMap: YMap, - parse: YMapEntry => T, - model: DomainElementModel - )(implicit ctx: AsyncWebApiContext): Unit = { + keyword: String, + componentsMap: YMap, + parse: YMapEntry => T, + model: DomainElementModel + )(implicit ctx: AsyncWebApiContext): Unit = { componentsMap.key( keyword, e => { diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async21DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async21DeclarationParser.scala index 06662b2cd5..c6f841a8bc 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async21DeclarationParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async21DeclarationParser.scala @@ -3,5 +3,5 @@ package amf.apicontract.internal.spec.async.parser.domain.declarations object Async21DeclarationParser { // Doesn't add new functionality to previous version - def apply(): AsyncDeclarationParser = Async20DeclarationParser + def apply(): AsyncDeclarationParser = Async20DeclarationParser() } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async23DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async23DeclarationParser.scala index 06bfea32dd..75e3989230 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async23DeclarationParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async23DeclarationParser.scala @@ -1,10 +1,13 @@ package amf.apicontract.internal.spec.async.parser.domain.declarations import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.client.scala.model.document.Document import org.yaml.model.YMap object Async23DeclarationParser extends AsyncDeclarationParser { - override def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { - Async20DeclarationParser.parseDeclarations(map, parent) + override def parseDeclarations(map: YMap, parent: String, document: Document)(implicit + ctx: AsyncWebApiContext + ): Unit = { + Async20DeclarationParser().parseDeclarations(map, parent, document) // TODO: add stuff.... } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async24DeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async24DeclarationParser.scala index 426790e9d1..eb12a7eefb 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async24DeclarationParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/Async24DeclarationParser.scala @@ -1,11 +1,14 @@ package amf.apicontract.internal.spec.async.parser.domain.declarations import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.client.scala.model.document.Document import org.yaml.model.YMap object Async24DeclarationParser extends AsyncDeclarationParser { - override def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit = { - Async23DeclarationParser.parseDeclarations(map, parent) + override def parseDeclarations(map: YMap, parent: String, document: Document)(implicit + ctx: AsyncWebApiContext + ): Unit = { + Async23DeclarationParser.parseDeclarations(map, parent, document) // TODO: add stuff.... } } diff --git a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/AsyncDeclarationParser.scala b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/AsyncDeclarationParser.scala index a669b31f50..cac3df159b 100644 --- a/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/AsyncDeclarationParser.scala +++ b/amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/async/parser/domain/declarations/AsyncDeclarationParser.scala @@ -1,8 +1,9 @@ package amf.apicontract.internal.spec.async.parser.domain.declarations import amf.apicontract.internal.spec.async.parser.context.AsyncWebApiContext +import amf.core.client.scala.model.document.Document import org.yaml.model.YMap trait AsyncDeclarationParser { - def parseDeclarations(map: YMap, parent: String)(implicit ctx: AsyncWebApiContext): Unit + def parseDeclarations(map: YMap, parent: String, document: Document)(implicit ctx: AsyncWebApiContext): Unit } diff --git a/amf-cli/shared/src/test/scala/amf/emit/DeclarationKeysTest.scala b/amf-cli/shared/src/test/scala/amf/emit/DeclarationKeysTest.scala new file mode 100644 index 0000000000..d6c45c3c54 --- /dev/null +++ b/amf-cli/shared/src/test/scala/amf/emit/DeclarationKeysTest.scala @@ -0,0 +1,26 @@ +package amf.emit + +import amf.aml.internal.parse.common.DeclarationKeys +import amf.apicontract.client.scala.AsyncAPIConfiguration +import amf.core.internal.metamodel.document.ModuleModel +import amf.io.FunSuiteCycleTests +import org.scalatest.matchers.should.Matchers + +class DeclarationKeysTest extends FunSuiteCycleTests with Matchers { + + override val basePath: String = "amf-cli/shared/src/test/resources/validations/async20/" + + test("Async declarations should have declaration keys") { + val apiPath = s"file://$basePath" + "components/async-components.yaml" + for { + parseResult <- AsyncAPIConfiguration.Async20().baseUnitClient().parseDocument(apiPath) + } yield { + val api = parseResult.document + val declaresAnnotations = api.fields.getValue(ModuleModel.Declares).annotations + val maybeDeclarationKeys = declaresAnnotations.find(classOf[DeclarationKeys]) + maybeDeclarationKeys shouldBe a[Some[_]] + val keys = maybeDeclarationKeys.get.keys + keys should have size 9 // one for each type of component, not for each component + } + } +} From e37a98c0c4a53381c03dbed6ae968a56ab84d75b Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Wed, 7 Feb 2024 17:41:40 -0300 Subject: [PATCH 32/33] W-14991650 (chore): create 5.4.8-RC.1 with release fix --- Jenkinsfile | 3 +++ amf-apicontract.versions | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7bff044cda..9682b9c237 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -69,6 +69,7 @@ pipeline { anyOf { branch 'master' branch 'develop' + branch 'release/*' } } steps { @@ -84,6 +85,7 @@ pipeline { anyOf { branch 'master' branch 'develop' + branch 'release/*' } } steps { @@ -98,6 +100,7 @@ pipeline { anyOf { branch 'master' branch 'develop' + branch 'release/*' } } steps { diff --git a/amf-apicontract.versions b/amf-apicontract.versions index f91242cc7a..2ce40468d3 100644 --- a/amf-apicontract.versions +++ b/amf-apicontract.versions @@ -1,4 +1,4 @@ -amf.apicontract=5.4.8 +amf.apicontract=5.4.8-RC.1 amf.aml=6.4.8 amf.model=3.8.2 antlr4Version=0.7.25 From 990d20c52fb0db6e32e0bb3882d20fdd39fc6804 Mon Sep 17 00:00:00 2001 From: Damian Pedra Date: Fri, 9 Feb 2024 12:02:11 -0300 Subject: [PATCH 33/33] Publish 5.4.8 --- Jenkinsfile | 3 --- amf-apicontract.versions | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9682b9c237..7bff044cda 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -69,7 +69,6 @@ pipeline { anyOf { branch 'master' branch 'develop' - branch 'release/*' } } steps { @@ -85,7 +84,6 @@ pipeline { anyOf { branch 'master' branch 'develop' - branch 'release/*' } } steps { @@ -100,7 +98,6 @@ pipeline { anyOf { branch 'master' branch 'develop' - branch 'release/*' } } steps { diff --git a/amf-apicontract.versions b/amf-apicontract.versions index 2ce40468d3..f91242cc7a 100644 --- a/amf-apicontract.versions +++ b/amf-apicontract.versions @@ -1,4 +1,4 @@ -amf.apicontract=5.4.8-RC.1 +amf.apicontract=5.4.8 amf.aml=6.4.8 amf.model=3.8.2 antlr4Version=0.7.25