diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..00a51af --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# These are explicitly windows files and should use crlf +*.bat text eol=crlf + diff --git a/.gitignore b/.gitignore index d2b307e..c21f0b5 100644 --- a/.gitignore +++ b/.gitignore @@ -92,4 +92,6 @@ project/boot/ project/plugins/project/ .history .cache -.lib/ \ No newline at end of file +.lib/ +# Ignore Gradle build output directory +build \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index cfef417..ab582cd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,15 +16,16 @@ pipeline { } environment { NEXUS = credentials('exchange-nexus') + NEXUSIQ = credentials('nexus-iq') GITHUB_ORG = 'aml-org' GITHUB_REPO = 'amf-metadata' } stages { - stage('Exporters Test') { + stage('Test') { steps { script { try{ - sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean exporters/test' + sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean coverage test coverageReport' } catch (ignored) { failedStage = failedStage + " TEST " unstable "Failed tests" @@ -32,14 +33,47 @@ pipeline { } } } - stage('Transform Test') { + stage('SonarQube Analysis') { + when { + anyOf { + branch 'master' + branch 'develop' + } + } steps { - script { - try{ - sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean transform/test' - } catch (ignored) { - failedStage = failedStage + " TEST " - unstable "Failed tests" + wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { + withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sonarqube-official', passwordVariable: 'SONAR_SERVER_TOKEN', usernameVariable: 'SONAR_SERVER_URL']]) { + script { + try { + if (failedStage.isEmpty()) { + sh 'sbt -Dsonar.host.url=${SONAR_SERVER_URL} sonarScan' + } + } catch (ignored) { + failedStage = failedStage + " COVERAGE " + unstable "Failed coverage" + } + } + } + } + } + } + stage('Nexus IQ') { + when { + anyOf { + branch 'develop' + } + } + steps { + wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) { + script { + try{ + if (failedStage.isEmpty()){ + sh './gradlew nexusIq' + } + } catch(ignored) { + failedStage = failedStage + " NEXUSIQ " + unstable "Failed Nexus IQ" + } } } } diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..bb3ef68 --- /dev/null +++ b/build.gradle @@ -0,0 +1,51 @@ +buildscript { + repositories { + mavenCentral() + mavenLocal() + maven { + url "https://plugins.gradle.org/m2/" + } + maven { + name "mule-ee-releases" + url "https://repository.mulesoft.org/nexus/content/repositories/releases/" + } + maven { url "https://jitpack.io" } + } + dependencies { + classpath "com.mulesoft:gradle-tools:0.2.6" + classpath files('lib/nexus-iq-cli-1.68.0-01.jar') + } +} + +apply plugin: 'com.mulesoft.gradle.nexusIq' +apply plugin: 'application' +apply plugin: 'distribution' +apply plugin: 'java' + +repositories { + mavenCentral() + maven { + url "https://repository-master.mulesoft.org/nexus/content/repositories/snapshots" + } + maven { + url "https://repository-master.mulesoft.org/nexus/content/repositories/releases" + } + maven { url 'https://jitpack.io' } +} + +def name = 'amf-metadata' + +nexusIq.user = "${System.env.NEXUSIQ_USR}" +nexusIq.password = "${System.env.NEXUSIQ_PSW}" +nexusIq.applicationId = "${name}" + +def versions = new Properties() +file("versions.yaml").withInputStream { + stream -> versions.load(stream) +} + +dependencies { + compile "com.github.amlorg:amf-transform_2.12:${versions.'amf.transform'}" +} + +tasks.nexusIq.dependsOn(distZip) \ No newline at end of file diff --git a/build.sbt b/build.sbt index 81ea2c4..e8e85c0 100644 --- a/build.sbt +++ b/build.sbt @@ -4,8 +4,10 @@ name := "amf-metadata" organization in ThisBuild := "com.github.amlorg" scalaVersion in ThisBuild := "2.12.11" -lazy val amfVocabularyVersion = majorVersionOrSnapshot(6) -val amfCanonicalVersion = versionOrSnapshot(1, 6) +val artifactVersions = new { + val vocabularyVersion = versions("versions.yaml")("amf.vocabulary") + val transformVersion = versions("versions.yaml")("amf.transform") +} val ivyLocal = Resolver.file("ivy", file(Path.userHome.absolutePath + "/.ivy2/local"))(Resolver.ivyStylePatterns) @@ -33,8 +35,8 @@ lazy val vocabulary = project .settings( commonSettings, name := "amf-vocabulary", - version := amfVocabularyVersion - ) + version := artifactVersions.vocabularyVersion + ).disablePlugins(SonarPlugin) // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Canonical ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -44,10 +46,11 @@ lazy val transform = project .settings( commonSettings, name := "amf-transform", - version := amfCanonicalVersion, + version := artifactVersions.transformVersion, libraryDependencies ++= commonDependencies ) .sourceDependency(amfClientRef, amfClientLibJVM) + .disablePlugins(SonarPlugin) // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Exporters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -59,6 +62,7 @@ lazy val exporters = project libraryDependencies ++= commonDependencies ) .sourceDependency(amfClientRef, amfClientLibJVM) + .disablePlugins(SonarPlugin) // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Common ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -85,6 +89,24 @@ def majorVersionOrSnapshot(major: Int) = { } def versionOrSnapshot(major: Int, minor: Int) = { - lazy val branch = sys.env.get("BRANCH_NAME") if (branch.contains("master")) s"$major.$minor.0" else s"$major.${minor + 1}.0-SNAPSHOT" } + +lazy val sonarUrl = sys.env.getOrElse("SONAR_SERVER_URL", "Not found url.") +lazy val sonarToken = sys.env.getOrElse("SONAR_SERVER_TOKEN", "Not found token.") +lazy val branch = sys.env.getOrElse("BRANCH_NAME", "develop") + +//enablePlugins(ScalaJSBundlerPlugin) + +sonarProperties ++= Map( + "sonar.login" -> sonarToken, + "sonar.projectKey" -> "mulesoft.amf-metadata", + "sonar.projectName" -> "AMF-Metadata", + "sonar.projectVersion" -> artifactVersions.transformVersion, + "sonar.sourceEncoding" -> "UTF-8", + "sonar.github.repository" -> "mulesoft/amf-metadata", + "sonar.branch.name" -> branch, + "sonar.scala.coverage.reportPaths" -> "transform/target/scala-2.12/scoverage-report/scoverage.xml,exporters/target/scala-2.12/scoverage-report/scoverage.xml", + "sonar.sources" -> "transform/src/main/scala,exporters/src/main/scala", + "sonar.tests" -> "transform/src/test/scala,exporters/src/test/scala" +) \ No newline at end of file diff --git a/exporters/src/main/scala/amf/exporters/CanonicalWebAPISpecDialectExporter.scala b/exporters/src/main/scala/amf/exporters/CanonicalWebAPISpecDialectExporter.scala index 50f9984..a34d2c1 100644 --- a/exporters/src/main/scala/amf/exporters/CanonicalWebAPISpecDialectExporter.scala +++ b/exporters/src/main/scala/amf/exporters/CanonicalWebAPISpecDialectExporter.scala @@ -269,6 +269,17 @@ class CanonicalWebAPISpecDialectExporter(logger: Logger = ConsoleLogger) { | - OpenIDSettings """.stripMargin + val abstractDeclarationUnion: String = + """ + | AbstractDeclarationUnion: + | typeDiscriminatorName: elementType + | typeDiscriminator: + | Trait: Trait + | ResourceType: ResourceType + | union: + | - Trait + | - ResourceType""".stripMargin + val abstractDeclarationsRange: String = """ - ResourceType | - Trait @@ -523,6 +534,9 @@ class CanonicalWebAPISpecDialectExporter(logger: Logger = ConsoleLogger) { // domain element union stringBuilder.append(domainElementUnion + "\n") + // abstract declaration union + stringBuilder.append(abstractDeclarationUnion + "\n") + // Parsed unit union stringBuilder.append(parsedUnitUnion + "\n") @@ -603,8 +617,7 @@ class CanonicalWebAPISpecDialectExporter(logger: Logger = ConsoleLogger) { } else if (propertyMapping.range == "Settings") { stringBuilder.append(s" range: $settingsUnionDeclaration\n") } else if (propertyMapping.range == "AbstractDeclaration") { - stringBuilder.append(s" range:\n") - stringBuilder.append(abstractDeclarationsRange ++ "\n") + stringBuilder.append(s" range: AbstractDeclarationUnion\n") } else if (propertyMapping.range == "DomainElement") { stringBuilder.append(s" range: $domainElementUnionDeclaration\n") } else if (propertyMapping.range == "BaseUnit") { @@ -687,9 +700,9 @@ class CanonicalWebAPISpecDialectExporter(logger: Logger = ConsoleLogger) { } def compact(url: String): (String, String, String) = { - val compacted = Namespace.compact(url).replace(":", ".") + val compacted = Namespace.staticAliases.compact(url).replace(":", ".") val prefix = compacted.split("\\.").head - val base = Namespace.ns(prefix).base + val base = Namespace.staticAliases.ns(prefix).base (compacted, prefix, base) } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..da9702f --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..4f906e0 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/lib/nexus-iq-cli-1.68.0-01.jar b/lib/nexus-iq-cli-1.68.0-01.jar new file mode 100644 index 0000000..539d1b8 Binary files /dev/null and b/lib/nexus-iq-cli-1.68.0-01.jar differ diff --git a/project/plugins.sbt b/project/plugins.sbt index ae43f7d..8fbed3f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,3 @@ addSbtPlugin("com.eed3si9n" % "sbt-sriracha" % "0.1.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") \ No newline at end of file +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") +addSbtPlugin("com.github.mwz" % "sbt-sonar" % "2.1.0") \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..d34ebee --- /dev/null +++ b/settings.gradle @@ -0,0 +1,9 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user manual at https://docs.gradle.org/6.8/userguide/multi_project_builds.html + */ +rootProject.name = 'amf-metadata' \ No newline at end of file diff --git a/transform/dependencies.properties b/transform/dependencies.properties index b2ce650..e690824 100644 --- a/transform/dependencies.properties +++ b/transform/dependencies.properties @@ -1,3 +1,3 @@ # Leave here for the publication process to detect if amf-transform has to be published! # Because we publish a version of amf-transform for each version of amf-client publish. -amf.client=4.6.0 +amf.client=4.7.0 diff --git a/transform/src/main/scala/amf/transform/canonical/BaseUnitTransform.scala b/transform/src/main/scala/amf/transform/canonical/BaseUnitTransform.scala index 995fbb9..95abb35 100644 --- a/transform/src/main/scala/amf/transform/canonical/BaseUnitTransform.scala +++ b/transform/src/main/scala/amf/transform/canonical/BaseUnitTransform.scala @@ -4,7 +4,10 @@ import amf.core.metamodel.document.{BaseUnitModel, DocumentModel, ExternalFragme import amf.core.vocabulary.Namespace import amf.plugins.document.vocabularies.metamodel.domain.NodeMappingModel import amf.plugins.document.vocabularies.model.document.Dialect +import amf.plugins.document.vocabularies.model.domain.NodeMapping +import amf.plugins.document.webapi.metamodel.FragmentsTypesModels.DocumentationItemFragmentModel import amf.plugins.document.webapi.metamodel.{ExtensionModel, OverlayModel} +import amf.plugins.document.webapi.model.DocumentationItemFragment import org.apache.jena.rdf.model.Model import scala.collection.mutable @@ -24,6 +27,8 @@ trait BaseUnitTransform extends TransformHelpers { allTypes += allTypesIterator.next().asResource().getURI } + // This somehow adds some 'ordering' to what type is chosen from the list of types from the most specific to the most abstract. Ex: Document and Module + // The last filter is to avoid using abstract models, not sure why 'Document' is there though. val mappedDocumentType = if (allTypes.contains((Namespace.ApiContract + "Extension").iri())) { defaultIri(ExtensionModel) } else if (allTypes.contains((Namespace.ApiContract + "Overlay").iri())) { @@ -49,8 +54,13 @@ trait BaseUnitTransform extends TransformHelpers { } } - dialect.declares.find { nodeMapping => - nodeMapping.id.split("#").last.split("/").last == mappedDocumentType.split("#").last + dialect.declares.find { + case nodeMapping: NodeMapping => + val optionalClassTerm = Option(nodeMapping.nodetypeMapping.value()) + optionalClassTerm.exists { classTerm => + classTerm.split("#").last.split("/").last == mappedDocumentType.split("#").last + } + case _ => false } match { case Some(nodeMapping) => nativeModel.remove( diff --git a/transform/src/test/resources/client/webapi.canonical.jsonld b/transform/src/test/resources/client/webapi.canonical.jsonld index 7d18a2b..65d6f69 100644 --- a/transform/src/test/resources/client/webapi.canonical.jsonld +++ b/transform/src/test/resources/client/webapi.canonical.jsonld @@ -362,14 +362,14 @@ ], "doc:version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "doc:version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "doc:root": [ diff --git a/transform/src/test/resources/transformations/annotations/webapi.json b/transform/src/test/resources/transformations/annotations/webapi.json index 1c91ea5..63314a9 100644 --- a/transform/src/test/resources/transformations/annotations/webapi.json +++ b/transform/src/test/resources/transformations/annotations/webapi.json @@ -1079,14 +1079,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/declares/webapi.json b/transform/src/test/resources/transformations/declares/webapi.json index 8ac9882..74285e8 100644 --- a/transform/src/test/resources/transformations/declares/webapi.json +++ b/transform/src/test/resources/transformations/declares/webapi.json @@ -232,14 +232,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/declares/webapi.yaml b/transform/src/test/resources/transformations/declares/webapi.yaml index a560cb2..5209ad4 100644 --- a/transform/src/test/resources/transformations/declares/webapi.yaml +++ b/transform/src/test/resources/transformations/declares/webapi.yaml @@ -44,7 +44,7 @@ declares: minCount: 1 path: http://a.ml/vocabularies/data#employeeId closed: false -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/declares/api.raml encodes: diff --git a/transform/src/test/resources/transformations/fragments/external/webapi.json b/transform/src/test/resources/transformations/fragments/external/webapi.json index bf343e2..9c23142 100644 --- a/transform/src/test/resources/transformations/fragments/external/webapi.json +++ b/transform/src/test/resources/transformations/fragments/external/webapi.json @@ -55,14 +55,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/fragments/external/webapi.yaml b/transform/src/test/resources/transformations/fragments/external/webapi.yaml index cfbf56f..e009116 100644 --- a/transform/src/test/resources/transformations/fragments/external/webapi.yaml +++ b/transform/src/test/resources/transformations/fragments/external/webapi.yaml @@ -1,6 +1,6 @@ #%WebAPI Spec 1.0 unitType: ExternalFragment $id: file://transform/src/test/resources/transformations/fragments/external/fragment.yaml#/rootAsset -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/fragments/external/fragment.yaml diff --git a/transform/src/test/resources/transformations/fragments/raml/annotation-declaration/webapi.json b/transform/src/test/resources/transformations/fragments/raml/annotation-declaration/webapi.json index 6472b2d..2545c43 100644 --- a/transform/src/test/resources/transformations/fragments/raml/annotation-declaration/webapi.json +++ b/transform/src/test/resources/transformations/fragments/raml/annotation-declaration/webapi.json @@ -285,14 +285,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/fragments/raml/annotation-declaration/webapi.yaml b/transform/src/test/resources/transformations/fragments/raml/annotation-declaration/webapi.yaml index ee00583..fafdf6c 100644 --- a/transform/src/test/resources/transformations/fragments/raml/annotation-declaration/webapi.yaml +++ b/transform/src/test/resources/transformations/fragments/raml/annotation-declaration/webapi.yaml @@ -1,7 +1,7 @@ #%WebAPI Spec 1.0 unitType: AnnotationTypeFragment $id: file://transform/src/test/resources/transformations/fragments/raml/annotation-declaration/api.raml#/rootAsset -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/fragments/raml/annotation-declaration/api.raml encodes: diff --git a/transform/src/test/resources/transformations/fragments/raml/datatype/webapi.json b/transform/src/test/resources/transformations/fragments/raml/datatype/webapi.json index 6e512e8..69e2f46 100644 --- a/transform/src/test/resources/transformations/fragments/raml/datatype/webapi.json +++ b/transform/src/test/resources/transformations/fragments/raml/datatype/webapi.json @@ -159,14 +159,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/fragments/raml/datatype/webapi.yaml b/transform/src/test/resources/transformations/fragments/raml/datatype/webapi.yaml index 2f0ac7c..d6c2377 100644 --- a/transform/src/test/resources/transformations/fragments/raml/datatype/webapi.yaml +++ b/transform/src/test/resources/transformations/fragments/raml/datatype/webapi.yaml @@ -1,7 +1,7 @@ #%WebAPI Spec 1.0 unitType: DataTypeFragment $id: file://transform/src/test/resources/transformations/fragments/raml/datatype/api.raml#/rootAsset -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/fragments/raml/datatype/api.raml encodes: diff --git a/transform/src/test/resources/transformations/fragments/raml/documentation-item/webapi.json b/transform/src/test/resources/transformations/fragments/raml/documentation-item/webapi.json index ebb2d37..d420f47 100644 --- a/transform/src/test/resources/transformations/fragments/raml/documentation-item/webapi.json +++ b/transform/src/test/resources/transformations/fragments/raml/documentation-item/webapi.json @@ -55,14 +55,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/fragments/raml/documentation-item/webapi.yaml b/transform/src/test/resources/transformations/fragments/raml/documentation-item/webapi.yaml index 352eaeb..bf023f2 100644 --- a/transform/src/test/resources/transformations/fragments/raml/documentation-item/webapi.yaml +++ b/transform/src/test/resources/transformations/fragments/raml/documentation-item/webapi.yaml @@ -1,6 +1,6 @@ #%WebAPI Spec 1.0 unitType: DocumentationItemFragment $id: file://transform/src/test/resources/transformations/fragments/raml/documentation-item/api.raml#/rootAsset -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/fragments/raml/documentation-item/api.raml diff --git a/transform/src/test/resources/transformations/fragments/raml/named-example/webapi.json b/transform/src/test/resources/transformations/fragments/raml/named-example/webapi.json index cd4b5e6..e0c6f58 100644 --- a/transform/src/test/resources/transformations/fragments/raml/named-example/webapi.json +++ b/transform/src/test/resources/transformations/fragments/raml/named-example/webapi.json @@ -55,14 +55,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/fragments/raml/named-example/webapi.yaml b/transform/src/test/resources/transformations/fragments/raml/named-example/webapi.yaml index 2aa5e05..1df9247 100644 --- a/transform/src/test/resources/transformations/fragments/raml/named-example/webapi.yaml +++ b/transform/src/test/resources/transformations/fragments/raml/named-example/webapi.yaml @@ -1,6 +1,6 @@ #%WebAPI Spec 1.0 unitType: ExternalFragment $id: file://transform/src/test/resources/transformations/fragments/raml/named-example/api.raml#/rootAsset -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/fragments/raml/named-example/api.raml diff --git a/transform/src/test/resources/transformations/fragments/raml/resource-type/webapi.json b/transform/src/test/resources/transformations/fragments/raml/resource-type/webapi.json index 39e7e51..5b394e9 100644 --- a/transform/src/test/resources/transformations/fragments/raml/resource-type/webapi.json +++ b/transform/src/test/resources/transformations/fragments/raml/resource-type/webapi.json @@ -289,14 +289,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/fragments/raml/resource-type/webapi.yaml b/transform/src/test/resources/transformations/fragments/raml/resource-type/webapi.yaml index ca4d492..7207dd9 100644 --- a/transform/src/test/resources/transformations/fragments/raml/resource-type/webapi.yaml +++ b/transform/src/test/resources/transformations/fragments/raml/resource-type/webapi.yaml @@ -1,7 +1,7 @@ #%WebAPI Spec 1.0 unitType: ResourceTypeFragment $id: file://transform/src/test/resources/transformations/fragments/raml/resource-type/api.raml##/rootAsset -version: 2.3.0 +version: 2.4.0 usage: Use this to describe resource that list items root: true location: file://transform/src/test/resources/transformations/fragments/raml/resource-type/api.raml# diff --git a/transform/src/test/resources/transformations/fragments/raml/security-scheme/webapi.json b/transform/src/test/resources/transformations/fragments/raml/security-scheme/webapi.json index 7197302..14b72e0 100644 --- a/transform/src/test/resources/transformations/fragments/raml/security-scheme/webapi.json +++ b/transform/src/test/resources/transformations/fragments/raml/security-scheme/webapi.json @@ -266,14 +266,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/fragments/raml/security-scheme/webapi.yaml b/transform/src/test/resources/transformations/fragments/raml/security-scheme/webapi.yaml index eacb2e6..1d8d7c1 100644 --- a/transform/src/test/resources/transformations/fragments/raml/security-scheme/webapi.yaml +++ b/transform/src/test/resources/transformations/fragments/raml/security-scheme/webapi.yaml @@ -1,7 +1,7 @@ #%WebAPI Spec 1.0 unitType: SecuritySchemeFragment $id: file://transform/src/test/resources/transformations/fragments/raml/security-scheme/api.raml#/rootAsset -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/fragments/raml/security-scheme/api.raml encodes: diff --git a/transform/src/test/resources/transformations/fragments/raml/trait/webapi.json b/transform/src/test/resources/transformations/fragments/raml/trait/webapi.json index fe14d27..4a41d46 100644 --- a/transform/src/test/resources/transformations/fragments/raml/trait/webapi.json +++ b/transform/src/test/resources/transformations/fragments/raml/trait/webapi.json @@ -356,14 +356,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/fragments/raml/trait/webapi.yaml b/transform/src/test/resources/transformations/fragments/raml/trait/webapi.yaml index 0ee657f..e5eaa51 100644 --- a/transform/src/test/resources/transformations/fragments/raml/trait/webapi.yaml +++ b/transform/src/test/resources/transformations/fragments/raml/trait/webapi.yaml @@ -1,7 +1,7 @@ #%WebAPI Spec 1.0 unitType: TraitFragment $id: file://transform/src/test/resources/transformations/fragments/raml/trait/api.raml##/rootAsset -version: 2.3.0 +version: 2.4.0 usage: Apply this to any method that needs to be secured root: true location: file://transform/src/test/resources/transformations/fragments/raml/trait/api.raml# diff --git a/transform/src/test/resources/transformations/macros/webapi.json b/transform/src/test/resources/transformations/macros/webapi.json index 9e08f0f..0c58683 100644 --- a/transform/src/test/resources/transformations/macros/webapi.json +++ b/transform/src/test/resources/transformations/macros/webapi.json @@ -1051,14 +1051,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/macros/webapi.yaml b/transform/src/test/resources/transformations/macros/webapi.yaml index c5e5c42..4c3fddc 100644 --- a/transform/src/test/resources/transformations/macros/webapi.yaml +++ b/transform/src/test/resources/transformations/macros/webapi.yaml @@ -98,7 +98,7 @@ declares: $id: file://transform/src/test/resources/transformations/macros/api.raml#/declarations/resourceTypes/collection/object_1/scalar_2 value: The collection of <> dataType: http://www.w3.org/2001/XMLSchema#string -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/macros/api.raml encodes: @@ -123,6 +123,7 @@ encodes: value: usuarios dataType: http://www.w3.org/2001/XMLSchema#string target: + elementType: ResourceType $id: file://transform/src/test/resources/transformations/macros/api.raml#/declarations/resourceTypes/collection name: collection variable: @@ -180,6 +181,7 @@ encodes: $id: file://transform/src/test/resources/transformations/macros/api.raml#/web-api/end-points/%2Fusers/get/traceable name: traceable target: + elementType: Trait $id: file://transform/src/test/resources/transformations/macros/api.raml#/web-api/end-points/%2Fusers/get/traceable/default-abstract designLink: file://transform/src/test/resources/transformations/macros/api.raml#/declarations/traits/traceable method: get diff --git a/transform/src/test/resources/transformations/message-bindings/webapi.json b/transform/src/test/resources/transformations/message-bindings/webapi.json index 021381e..9a638f4 100644 --- a/transform/src/test/resources/transformations/message-bindings/webapi.json +++ b/transform/src/test/resources/transformations/message-bindings/webapi.json @@ -68,17 +68,6 @@ "http://a.ml/vocabularies/meta#DialectDomainElement", "http://a.ml/vocabularies/document#DomainElement" ], - "http://a.ml/vocabularies/apiContract#payload": [ - { - "@id": "file://transform/src/test/resources/transformations/message-bindings/api.yaml#/async-api/end-points/some-channel/publish/request/default", - "@type": [ - "http://a.ml/vocabularies/apiContract#Payload", - "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/Payload", - "http://a.ml/vocabularies/meta#DialectDomainElement", - "http://a.ml/vocabularies/document#DomainElement" - ] - } - ], "http://a.ml/vocabularies/apiBinding#binding": [ { "@id": "file://transform/src/test/resources/transformations/message-bindings/api.yaml#/async-api/end-points/some-channel/publish/request/message-bindings", @@ -218,14 +207,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/message-bindings/webapi.yaml b/transform/src/test/resources/transformations/message-bindings/webapi.yaml index d8333ec..fd8b71e 100644 --- a/transform/src/test/resources/transformations/message-bindings/webapi.yaml +++ b/transform/src/test/resources/transformations/message-bindings/webapi.yaml @@ -1,7 +1,7 @@ #%WebAPI Spec 1.0 unitType: Document $id: file://transform/src/test/resources/transformations/message-bindings/api.yaml#/rootAsset -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/message-bindings/api.yaml encodes: @@ -44,8 +44,5 @@ encodes: bindingVersion: 31.07.92 type: amqp messageType: sometype - payload: - - - $id: file://transform/src/test/resources/transformations/message-bindings/api.yaml#/async-api/end-points/some-channel/publish/request/default method: publish path: some-channel diff --git a/transform/src/test/resources/transformations/message-trait/webapi.json b/transform/src/test/resources/transformations/message-trait/webapi.json index 90556d7..bd66f1e 100644 --- a/transform/src/test/resources/transformations/message-trait/webapi.json +++ b/transform/src/test/resources/transformations/message-trait/webapi.json @@ -199,17 +199,6 @@ "@value": "something" } ], - "http://a.ml/vocabularies/apiContract#payload": [ - { - "@id": "file://transform/src/test/resources/transformations/message-trait/api.yaml#/declarations/messageTraits/myMessageTrait/default", - "@type": [ - "http://a.ml/vocabularies/apiContract#Payload", - "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/Payload", - "http://a.ml/vocabularies/meta#DialectDomainElement", - "http://a.ml/vocabularies/document#DomainElement" - ] - } - ], "http://a.ml/vocabularies/apiContract#isAbstract": [ { "@value": true @@ -224,14 +213,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/message-trait/webapi.yaml b/transform/src/test/resources/transformations/message-trait/webapi.yaml index 97e2ee2..94db894 100644 --- a/transform/src/test/resources/transformations/message-trait/webapi.yaml +++ b/transform/src/test/resources/transformations/message-trait/webapi.yaml @@ -2,7 +2,7 @@ unitType: Document $id: file://transform/src/test/resources/transformations/message-trait/api.yaml#/rootAsset declares: [] -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/message-trait/api.yaml encodes: diff --git a/transform/src/test/resources/transformations/modular/webapi.json b/transform/src/test/resources/transformations/modular/webapi.json index 9994c82..5ec3844 100644 --- a/transform/src/test/resources/transformations/modular/webapi.json +++ b/transform/src/test/resources/transformations/modular/webapi.json @@ -140,7 +140,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -310,7 +310,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] }, @@ -402,7 +402,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -792,14 +792,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/modular/webapi.yaml b/transform/src/test/resources/transformations/modular/webapi.yaml index c3409cc..de7e1e6 100644 --- a/transform/src/test/resources/transformations/modular/webapi.yaml +++ b/transform/src/test/resources/transformations/modular/webapi.yaml @@ -28,7 +28,7 @@ declares: minCount: 1 path: http://a.ml/vocabularies/data#a closed: false -version: 2.3.0 +version: 2.4.0 root: true references: - @@ -71,13 +71,13 @@ references: minCount: 1 path: http://a.ml/vocabularies/data#a closed: false - version: 2.3.0 + version: 2.4.0 root: false references: - unitType: DataTypeFragment $id: file://transform/src/test/resources/transformations/modular/fragment1.raml - version: 2.3.0 + version: 2.4.0 root: false location: file://transform/src/test/resources/transformations/modular/fragment1.raml encodes: @@ -100,7 +100,7 @@ references: - unitType: DataTypeFragment $id: file://transform/src/test/resources/transformations/modular/fragment2.raml - version: 2.3.0 + version: 2.4.0 root: false location: file://transform/src/test/resources/transformations/modular/fragment2.raml encodes: diff --git a/transform/src/test/resources/transformations/operation-trait/webapi.json b/transform/src/test/resources/transformations/operation-trait/webapi.json index 879b1f4..fd40c1e 100644 --- a/transform/src/test/resources/transformations/operation-trait/webapi.json +++ b/transform/src/test/resources/transformations/operation-trait/webapi.json @@ -170,14 +170,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/operation-trait/webapi.yaml b/transform/src/test/resources/transformations/operation-trait/webapi.yaml index 08ad923..c268449 100644 --- a/transform/src/test/resources/transformations/operation-trait/webapi.yaml +++ b/transform/src/test/resources/transformations/operation-trait/webapi.yaml @@ -2,7 +2,7 @@ unitType: Document $id: file://transform/src/test/resources/transformations/operation-trait/api.yaml#/rootAsset declares: [] -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/operation-trait/api.yaml encodes: diff --git a/transform/src/test/resources/transformations/raml-extension/webapi.json b/transform/src/test/resources/transformations/raml-extension/webapi.json index 2659390..6f3019e 100644 --- a/transform/src/test/resources/transformations/raml-extension/webapi.json +++ b/transform/src/test/resources/transformations/raml-extension/webapi.json @@ -88,7 +88,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -160,7 +160,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -227,7 +227,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -308,7 +308,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -380,7 +380,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -447,7 +447,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -475,14 +475,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/raml-extension/webapi.yaml b/transform/src/test/resources/transformations/raml-extension/webapi.yaml index a73d158..23a1c8a 100644 --- a/transform/src/test/resources/transformations/raml-extension/webapi.yaml +++ b/transform/src/test/resources/transformations/raml-extension/webapi.yaml @@ -1,19 +1,19 @@ #%WebAPI Spec 1.0 unitType: Extension $id: file://transform/src/test/resources/transformations/raml-extension/api.raml#/rootAsset -version: 2.3.0 +version: 2.4.0 root: true references: - unitType: Extension $id: file://transform/src/test/resources/transformations/raml-extension/secure-extension.raml - version: 2.3.0 + version: 2.4.0 root: false references: - unitType: Document $id: file://transform/src/test/resources/transformations/raml-extension/unsecure-template.raml - version: 2.3.0 + version: 2.4.0 root: false location: file://transform/src/test/resources/transformations/raml-extension/unsecure-template.raml encodes: diff --git a/transform/src/test/resources/transformations/raml-library/webapi.json b/transform/src/test/resources/transformations/raml-library/webapi.json index 7184c37..5218745 100644 --- a/transform/src/test/resources/transformations/raml-library/webapi.json +++ b/transform/src/test/resources/transformations/raml-library/webapi.json @@ -171,14 +171,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/raml-library/webapi.yaml b/transform/src/test/resources/transformations/raml-library/webapi.yaml index 65a9d5c..753044c 100644 --- a/transform/src/test/resources/transformations/raml-library/webapi.yaml +++ b/transform/src/test/resources/transformations/raml-library/webapi.yaml @@ -34,6 +34,6 @@ declares: minCount: 1 path: http://a.ml/vocabularies/data#identifier closed: true -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/raml-library/api.raml diff --git a/transform/src/test/resources/transformations/raml-overlay/webapi.json b/transform/src/test/resources/transformations/raml-overlay/webapi.json index eff9c15..6cf87fd 100644 --- a/transform/src/test/resources/transformations/raml-overlay/webapi.json +++ b/transform/src/test/resources/transformations/raml-overlay/webapi.json @@ -172,7 +172,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -342,7 +342,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -381,14 +381,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/raml-overlay/webapi.yaml b/transform/src/test/resources/transformations/raml-overlay/webapi.yaml index 43219cb..644a75c 100644 --- a/transform/src/test/resources/transformations/raml-overlay/webapi.yaml +++ b/transform/src/test/resources/transformations/raml-overlay/webapi.yaml @@ -1,14 +1,14 @@ #%WebAPI Spec 1.0 unitType: Overlay $id: file://transform/src/test/resources/transformations/raml-overlay/api.raml#/rootAsset -version: 2.3.0 +version: 2.4.0 usage: Spanish localization root: true references: - unitType: Document $id: file://transform/src/test/resources/transformations/raml-overlay/base.raml - version: 2.3.0 + version: 2.4.0 root: false location: file://transform/src/test/resources/transformations/raml-overlay/base.raml encodes: diff --git a/transform/src/test/resources/transformations/security/webapi.json b/transform/src/test/resources/transformations/security/webapi.json index 7ed4299..03a6b88 100644 --- a/transform/src/test/resources/transformations/security/webapi.json +++ b/transform/src/test/resources/transformations/security/webapi.json @@ -553,14 +553,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/security/webapi.yaml b/transform/src/test/resources/transformations/security/webapi.yaml index e964997..3ebb19f 100644 --- a/transform/src/test/resources/transformations/security/webapi.yaml +++ b/transform/src/test/resources/transformations/security/webapi.yaml @@ -50,7 +50,7 @@ declares: description: | Used to send a valid OAuth 2 access token. datatype: http://www.w3.org/2001/XMLSchema#string -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/security/api.raml encodes: diff --git a/transform/src/test/resources/transformations/simple/webapi.json b/transform/src/test/resources/transformations/simple/webapi.json index 48d9742..401fc74 100644 --- a/transform/src/test/resources/transformations/simple/webapi.json +++ b/transform/src/test/resources/transformations/simple/webapi.json @@ -362,14 +362,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/simple/webapi.yaml b/transform/src/test/resources/transformations/simple/webapi.yaml index 5fefefc..25a1192 100644 --- a/transform/src/test/resources/transformations/simple/webapi.yaml +++ b/transform/src/test/resources/transformations/simple/webapi.yaml @@ -28,7 +28,7 @@ declares: minCount: 1 path: http://a.ml/vocabularies/data#a closed: false -version: 2.3.0 +version: 2.4.0 root: true location: file://transform/src/test/resources/transformations/simple/api.raml encodes: diff --git a/transform/src/test/resources/transformations/tuple-shape-schema/webapi.json b/transform/src/test/resources/transformations/tuple-shape-schema/webapi.json index 0d2bda0..5acb1dc 100644 --- a/transform/src/test/resources/transformations/tuple-shape-schema/webapi.json +++ b/transform/src/test/resources/transformations/tuple-shape-schema/webapi.json @@ -74,7 +74,7 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } @@ -148,100 +148,121 @@ "http://a.ml/vocabularies/meta#DialectDomainElement", "http://a.ml/vocabularies/document#DomainElement" ], - "http://a.ml/vocabularies/document#reference-id": [ + "http://www.w3.org/ns/shacl#name": [ { - "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/schema.json#/external" + "@value": "schema" } ], - "http://www.w3.org/ns/shacl#property": [ + "http://a.ml/vocabularies/shapes#inherits": [ { - "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp", + "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/schema", "@type": [ - "http://www.w3.org/ns/shacl#PropertyShape", - "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/PropertyShape", + "http://www.w3.org/ns/shacl#NodeShape", + "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/NodeShape", "http://a.ml/vocabularies/meta#DialectDomainElement", "http://a.ml/vocabularies/document#DomainElement" ], - "http://a.ml/vocabularies/shapes#range": [ + "http://a.ml/vocabularies/document#reference-id": [ + { + "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/schema.json#/external" + } + ], + "http://www.w3.org/ns/shacl#property": [ { - "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/itemsTuple1/array/parentProp", + "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/schema/property/parentProp", "@type": [ - "http://a.ml/vocabularies/shapes#TupleShape", - "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/TupleShape", + "http://www.w3.org/ns/shacl#PropertyShape", + "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/PropertyShape", "http://a.ml/vocabularies/meta#DialectDomainElement", "http://a.ml/vocabularies/document#DomainElement" ], - "http://a.ml/vocabularies/shapes#items": [ + "http://a.ml/vocabularies/shapes#range": [ { - "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/itemsTuple1/array/parentProp/list", - "@type": "http://www.w3.org/2000/01/rdf-schema#Seq", - "http://www.w3.org/2000/01/rdf-schema#_1": [ + "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/schema/property/parentProp/array/parentProp/itemsTuple1/array/parentProp", + "@type": [ + "http://a.ml/vocabularies/shapes#TupleShape", + "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/TupleShape", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "http://a.ml/vocabularies/document#DomainElement" + ], + "http://a.ml/vocabularies/shapes#items": [ { - "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0", - "@type": [ - "http://www.w3.org/ns/shacl#NodeShape", - "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/NodeShape", - "http://a.ml/vocabularies/meta#DialectDomainElement", - "http://a.ml/vocabularies/document#DomainElement" - ], - "http://www.w3.org/ns/shacl#property": [ + "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/schema/property/parentProp/array/parentProp/itemsTuple1/array/parentProp/list", + "@type": "http://www.w3.org/2000/01/rdf-schema#Seq", + "http://www.w3.org/2000/01/rdf-schema#_1": [ { - "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0/property/childProp", + "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0", "@type": [ - "http://www.w3.org/ns/shacl#PropertyShape", - "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/PropertyShape", + "http://www.w3.org/ns/shacl#NodeShape", + "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/NodeShape", "http://a.ml/vocabularies/meta#DialectDomainElement", "http://a.ml/vocabularies/document#DomainElement" ], - "http://a.ml/vocabularies/shapes#range": [ + "http://www.w3.org/ns/shacl#property": [ { - "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0/property/childProp/scalar/childProp", + "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0/property/childProp", "@type": [ - "http://a.ml/vocabularies/shapes#ScalarShape", - "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/ScalarShape", + "http://www.w3.org/ns/shacl#PropertyShape", + "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/PropertyShape", "http://a.ml/vocabularies/meta#DialectDomainElement", "http://a.ml/vocabularies/document#DomainElement" ], - "http://www.w3.org/ns/shacl#datatype": [ + "http://a.ml/vocabularies/shapes#range": [ { - "@id": "http://www.w3.org/2001/XMLSchema#string" + "@id": "file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0/property/childProp/scalar/childProp", + "@type": [ + "http://a.ml/vocabularies/shapes#ScalarShape", + "file://vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml#/declarations/ScalarShape", + "http://a.ml/vocabularies/meta#DialectDomainElement", + "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": "childProp" + } + ] } ], "http://www.w3.org/ns/shacl#name": [ { "@value": "childProp" } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://a.ml/vocabularies/data#childProp" + } ] } ], "http://www.w3.org/ns/shacl#name": [ { - "@value": "childProp" + "@value": "member0" } ], - "http://www.w3.org/ns/shacl#minCount": [ + "http://www.w3.org/ns/shacl#closed": [ { - "@value": 0 - } - ], - "http://www.w3.org/ns/shacl#path": [ - { - "@id": "http://a.ml/vocabularies/data#childProp" + "@value": false } ] } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "member0" - } - ], - "http://www.w3.org/ns/shacl#closed": [ - { - "@value": false - } ] } + ], + "http://www.w3.org/ns/shacl#name": [ + { + "@value": "parentProp" + } ] } ], @@ -249,35 +270,30 @@ { "@value": "parentProp" } + ], + "http://www.w3.org/ns/shacl#minCount": [ + { + "@value": 0 + } + ], + "http://www.w3.org/ns/shacl#path": [ + { + "@id": "http://a.ml/vocabularies/data#parentProp" + } ] } ], "http://www.w3.org/ns/shacl#name": [ { - "@value": "parentProp" - } - ], - "http://www.w3.org/ns/shacl#minCount": [ - { - "@value": 0 + "@value": "schema" } ], - "http://www.w3.org/ns/shacl#path": [ + "http://www.w3.org/ns/shacl#closed": [ { - "@id": "http://a.ml/vocabularies/data#parentProp" + "@value": false } ] } - ], - "http://www.w3.org/ns/shacl#name": [ - { - "@value": "schema" - } - ], - "http://www.w3.org/ns/shacl#closed": [ - { - "@value": false - } ] } ], @@ -313,14 +329,14 @@ ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ] } ], "http://a.ml/vocabularies/document#version": [ { - "@value": "2.3.0" + "@value": "2.4.0" } ], "http://a.ml/vocabularies/document#root": [ diff --git a/transform/src/test/resources/transformations/tuple-shape-schema/webapi.yaml b/transform/src/test/resources/transformations/tuple-shape-schema/webapi.yaml index b9475c3..e8cc31a 100644 --- a/transform/src/test/resources/transformations/tuple-shape-schema/webapi.yaml +++ b/transform/src/test/resources/transformations/tuple-shape-schema/webapi.yaml @@ -1,7 +1,7 @@ #%WebAPI Spec 1.0 unitType: Document $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/rootAsset -version: 2.3.0 +version: 2.4.0 root: true references: [] location: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml @@ -26,36 +26,41 @@ encodes: schema: shapeType: Node $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema - name: schema - property: + inherits: - - $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp - range: - shapeType: Tuple - $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/itemsTuple1/array/parentProp - name: parentProp - items: - - - shapeType: Node - $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0 - name: member0 - property: + shapeType: Node + $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/schema + name: schema + property: + - + $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/schema/property/parentProp + range: + shapeType: Tuple + $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/schema/property/parentProp/array/parentProp/itemsTuple1/array/parentProp + name: parentProp + items: - - $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0/property/childProp - range: - shapeType: Scalar - $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0/property/childProp/scalar/childProp - name: childProp - datatype: http://www.w3.org/2001/XMLSchema#string - name: childProp - minCount: 0 - path: http://a.ml/vocabularies/data#childProp - closed: false - name: parentProp - minCount: 0 - path: http://a.ml/vocabularies/data#parentProp - referenceId: file://transform/src/test/resources/transformations/tuple-shape-schema/schema.json#/external - closed: false + shapeType: Node + $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0 + name: member0 + property: + - + $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0/property/childProp + range: + shapeType: Scalar + $id: file://transform/src/test/resources/transformations/tuple-shape-schema/api.raml#/web-api/end-points/%2Flist/get/200/application%2Fjson/schema/property/parentProp/array/parentProp/member0/property/childProp/scalar/childProp + name: childProp + datatype: http://www.w3.org/2001/XMLSchema#string + name: childProp + minCount: 0 + path: http://a.ml/vocabularies/data#childProp + closed: false + name: parentProp + minCount: 0 + path: http://a.ml/vocabularies/data#parentProp + referenceId: file://transform/src/test/resources/transformations/tuple-shape-schema/schema.json#/external + closed: false + name: schema mediaType: application/json statusCode: "200" method: get diff --git a/versions.yaml b/versions.yaml new file mode 100644 index 0000000..6eced67 --- /dev/null +++ b/versions.yaml @@ -0,0 +1,2 @@ +amf.vocabulary: 7.0.0 +amf.transform: 1.7.0 diff --git a/vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml b/vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml index 7c01293..c71eccd 100644 --- a/vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml +++ b/vocabulary/src/main/resources/dialects/canonical_webapi_spec.yaml @@ -134,6 +134,15 @@ nodeMappings: - ResourceType - CustomDomainProperty + + AbstractDeclarationUnion: + typeDiscriminatorName: elementType + typeDiscriminator: + Trait: Trait + ResourceType: ResourceType + union: + - Trait + - ResourceType ParsedUnitUnion: typeDiscriminatorName: unitType typeDiscriminator: @@ -1584,10 +1593,7 @@ nodeMappings: range: string target: propertyTerm: doc.target - range: - - ResourceType - - Trait - + range: AbstractDeclarationUnion variable: propertyTerm: doc.variable range: VariableValue