diff --git a/amf-api-contract/shared/src/test/scala/amf/adopter/DuplicateIdsTest.scala b/amf-api-contract/shared/src/test/scala/amf/adopter/DuplicateIdsTest.scala index 714cb7d028..176ff8b88b 100644 --- a/amf-api-contract/shared/src/test/scala/amf/adopter/DuplicateIdsTest.scala +++ b/amf-api-contract/shared/src/test/scala/amf/adopter/DuplicateIdsTest.scala @@ -61,12 +61,13 @@ class ResolvedModelDuplicateIdsTest extends AsyncFunSuite with DuplicateIdsTest } private def amfConfigFrom(spec: Spec): AMFConfiguration = spec match { - case Spec.OAS30 => OASConfiguration.OAS30() - case Spec.OAS20 => OASConfiguration.OAS20() - case Spec.RAML10 => RAMLConfiguration.RAML10() - case Spec.RAML08 => RAMLConfiguration.RAML08() - case Spec.ASYNC20 => AsyncAPIConfiguration.Async20() - case _ => throw new IllegalArgumentException + case Spec.OAS30 => OASConfiguration.OAS30() + case Spec.OAS20 => OASConfiguration.OAS20() + case Spec.RAML10 => RAMLConfiguration.RAML10() + case Spec.RAML08 => RAMLConfiguration.RAML08() + case Spec.ASYNC20 | Spec.ASYNC21 | Spec.ASYNC22 | Spec.ASYNC23 | Spec.ASYNC24 | Spec.ASYNC25 | Spec.ASYNC26 => + AsyncAPIConfiguration.Async20() + case _ => throw new IllegalArgumentException } } diff --git a/amf-cli/shared/src/main/scala/amf/cli/internal/commands/CommandHelper.scala b/amf-cli/shared/src/main/scala/amf/cli/internal/commands/CommandHelper.scala index fec7dfaf92..7ff792ab6c 100644 --- a/amf-cli/shared/src/main/scala/amf/cli/internal/commands/CommandHelper.scala +++ b/amf-cli/shared/src/main/scala/amf/cli/internal/commands/CommandHelper.scala @@ -119,12 +119,13 @@ trait CommandHelper { } private def configFor(spec: Spec): Option[AMFConfiguration] = spec match { - case Spec.RAML10 => Some(RAMLConfiguration.RAML10()) - case Spec.RAML08 => Some(RAMLConfiguration.RAML08()) - case Spec.OAS20 => Some(OASConfiguration.OAS20()) - case Spec.OAS30 => Some(OASConfiguration.OAS30()) - case Spec.ASYNC20 => Some(AsyncAPIConfiguration.Async20()) - case _ => None + case Spec.RAML10 => Some(RAMLConfiguration.RAML10()) + case Spec.RAML08 => Some(RAMLConfiguration.RAML08()) + case Spec.OAS20 => Some(OASConfiguration.OAS20()) + case Spec.OAS30 => Some(OASConfiguration.OAS30()) + case Spec.ASYNC20 | Spec.ASYNC21 | Spec.ASYNC22 | Spec.ASYNC23 | Spec.ASYNC24 | Spec.ASYNC25 | Spec.ASYNC26 => + Some(AsyncAPIConfiguration.Async20()) + case _ => None } def effectiveVendor(spec: Option[String]): Spec = spec.flatMap(Spec.unapply).getOrElse(Spec("unknown")) diff --git a/amf-cli/shared/src/test/resources/references/async/async20.yaml b/amf-cli/shared/src/test/resources/references/async/async20.yaml new file mode 100644 index 0000000000..ce091380ed --- /dev/null +++ b/amf-cli/shared/src/test/resources/references/async/async20.yaml @@ -0,0 +1,36 @@ +asyncapi: '2.0.0' +info: + title: Streetlights Kafka API + version: '1.0.0' + +defaultContentType: application/json + +channels: + smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured: + description: The topic on which measured values may be produced and consumed. + publish: + summary: Inform about environmental lighting conditions of a particular streetlight. + operationId: receiveLightMeasurement + message: + name: lightMeasured + title: Light measured + summary: Inform about environmental lighting conditions of a particular streetlight. + contentType: application/json + payload: + $ref: "#/components/schemas/lightMeasuredPayload" + +components: + schemas: + sentAt: + type: string + format: date-time + description: Date and time when the message was sent. + lightMeasuredPayload: + type: object + properties: + lumens: + type: integer + minimum: 0 + description: Light intensity measured in lumens. + sentAt: + $ref: "#/components/schemas/sentAt" \ No newline at end of file diff --git a/amf-cli/shared/src/test/resources/references/async/async20.yaml.yaml b/amf-cli/shared/src/test/resources/references/async/async20.yaml.yaml new file mode 100644 index 0000000000..e73a1679cf --- /dev/null +++ b/amf-cli/shared/src/test/resources/references/async/async20.yaml.yaml @@ -0,0 +1,45 @@ +asyncapi: 2.0.0 +info: + title: Streetlights Kafka API + version: 1.0.0 +defaultContentType: application/json +components: + schemas: + sentAt: + type: string + format: date-time + description: Date and time when the message was sent. + lightMeasuredPayload: + type: object + properties: + lumens: + type: integer + minimum: 0 + description: Light intensity measured in lumens. + sentAt: + type: string + format: date-time + description: Date and time when the message was sent. +channels: + smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured: + description: The topic on which measured values may be produced and consumed. + publish: + summary: Inform about environmental lighting conditions of a particular streetlight. + operationId: receiveLightMeasurement + message: + name: lightMeasured + title: Light measured + summary: Inform about environmental lighting conditions of a particular streetlight. + contentType: application/json + payload: + type: object + properties: + lumens: + type: integer + minimum: 0 + description: Light intensity measured in lumens. + sentAt: + type: string + format: date-time + description: Date and time when the message was sent. + description: The topic on which measured values may be produced and consumed. diff --git a/amf-cli/shared/src/test/resources/references/async/async26.yaml b/amf-cli/shared/src/test/resources/references/async/async26.yaml new file mode 100644 index 0000000000..76aa7e4a53 --- /dev/null +++ b/amf-cli/shared/src/test/resources/references/async/async26.yaml @@ -0,0 +1,36 @@ +asyncapi: '2.6.0' +info: + title: Streetlights Kafka API + version: '1.0.0' + +defaultContentType: application/json + +channels: + smartylighting.streetlights.1.0.event.1.lighting.measured: + description: The topic on which measured values may be produced and consumed. + publish: + summary: Inform about environmental lighting conditions of a particular streetlight. + operationId: receiveLightMeasurement + message: + name: lightMeasured + title: Light measured + summary: Inform about environmental lighting conditions of a particular streetlight. + contentType: application/json + payload: + $ref: "#/components/schemas/lightMeasuredPayload" + +components: + schemas: + sentAt: + type: string + format: date-time + description: Date and time when the message was sent. + lightMeasuredPayload: + type: object + properties: + lumens: + type: integer + minimum: 0 + description: Light intensity measured in lumens. + sentAt: + $ref: "#/components/schemas/sentAt" \ No newline at end of file diff --git a/amf-cli/shared/src/test/resources/references/async/async26.yaml.yaml b/amf-cli/shared/src/test/resources/references/async/async26.yaml.yaml new file mode 100644 index 0000000000..8682fc3e9c --- /dev/null +++ b/amf-cli/shared/src/test/resources/references/async/async26.yaml.yaml @@ -0,0 +1,45 @@ +asyncapi: 2.6.0 +info: + title: Streetlights Kafka API + version: 1.0.0 +defaultContentType: application/json +components: + schemas: + sentAt: + type: string + format: date-time + description: Date and time when the message was sent. + lightMeasuredPayload: + type: object + properties: + lumens: + type: integer + minimum: 0 + description: Light intensity measured in lumens. + sentAt: + type: string + format: date-time + description: Date and time when the message was sent. +channels: + smartylighting.streetlights.1.0.event.1.lighting.measured: + description: The topic on which measured values may be produced and consumed. + publish: + summary: Inform about environmental lighting conditions of a particular streetlight. + operationId: receiveLightMeasurement + message: + name: lightMeasured + title: Light measured + summary: Inform about environmental lighting conditions of a particular streetlight. + contentType: application/json + payload: + type: object + properties: + lumens: + type: integer + minimum: 0 + description: Light intensity measured in lumens. + sentAt: + type: string + format: date-time + description: Date and time when the message was sent. + description: The topic on which measured values may be produced and consumed. diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.expanded.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.expanded.jsonld index d3f3f531f2..a929526261 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.expanded.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.expanded.jsonld @@ -3017,12 +3017,17 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/shape/market" } ], "http://a.ml/vocabularies/document#link-label": [ { - "@value": "#/components/schemas/market" + "@value": "market" + } + ], + "http://a.ml/vocabularies/document#recursive": [ + { + "@value": true } ], "http://www.w3.org/ns/shacl#name": [ @@ -3038,10 +3043,10 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-target" + "@value": "http://a.ml/vocabularies/document#link-label" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -3054,7 +3059,20 @@ "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-label" + "@value": "http://a.ml/vocabularies/document#recursive" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#link-target" } ], "http://a.ml/vocabularies/document-source-maps#value": [ diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.flattened.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.flattened.jsonld index 07a7dad8e8..f19f2595ce 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.flattened.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.flattened.jsonld @@ -2278,10 +2278,11 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/shape/market" } ], - "http://a.ml/vocabularies/document#link-label": "#/components/schemas/market", + "http://a.ml/vocabularies/document#link-label": "market", + "http://a.ml/vocabularies/document#recursive": true, "http://www.w3.org/ns/shacl#name": "schema", "http://a.ml/vocabularies/document-source-maps#sources": [ { @@ -2471,10 +2472,13 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" } ], "http://a.ml/vocabularies/document-source-maps#lexical": [ @@ -2670,13 +2674,18 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(98,10)-(99,0)]" }, { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#recursive", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.1-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.expanded.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.expanded.jsonld index 6ddda697cd..8e99171c70 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.expanded.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.expanded.jsonld @@ -3920,12 +3920,17 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/shape/market" } ], "http://a.ml/vocabularies/document#link-label": [ { - "@value": "#/components/schemas/market" + "@value": "market" + } + ], + "http://a.ml/vocabularies/document#recursive": [ + { + "@value": true } ], "http://www.w3.org/ns/shacl#name": [ @@ -3941,10 +3946,10 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-target" + "@value": "http://a.ml/vocabularies/document#link-label" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -3957,7 +3962,20 @@ "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-label" + "@value": "http://a.ml/vocabularies/document#recursive" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#link-target" } ], "http://a.ml/vocabularies/document-source-maps#value": [ diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.flattened.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.flattened.jsonld index 6c4684edba..b6d236230a 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.flattened.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.flattened.jsonld @@ -2993,10 +2993,11 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/shape/market" } ], - "http://a.ml/vocabularies/document#link-label": "#/components/schemas/market", + "http://a.ml/vocabularies/document#link-label": "market", + "http://a.ml/vocabularies/document#recursive": true, "http://www.w3.org/ns/shacl#name": "schema", "http://a.ml/vocabularies/document-source-maps#sources": [ { @@ -3186,10 +3187,13 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" } ], "http://a.ml/vocabularies/document-source-maps#lexical": [ @@ -3385,13 +3389,18 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(118,10)-(119,0)]" }, { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#recursive", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.2-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.expanded.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.expanded.jsonld index f1cce579fa..d89135cda2 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.expanded.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.expanded.jsonld @@ -4152,12 +4152,17 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/shape/market" } ], "http://a.ml/vocabularies/document#link-label": [ { - "@value": "#/components/schemas/market" + "@value": "market" + } + ], + "http://a.ml/vocabularies/document#recursive": [ + { + "@value": true } ], "http://www.w3.org/ns/shacl#name": [ @@ -4173,10 +4178,10 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-target" + "@value": "http://a.ml/vocabularies/document#link-label" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -4189,7 +4194,20 @@ "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-label" + "@value": "http://a.ml/vocabularies/document#recursive" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#link-target" } ], "http://a.ml/vocabularies/document-source-maps#value": [ diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.flattened.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.flattened.jsonld index 35a41405b5..b42bba14d6 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.flattened.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.flattened.jsonld @@ -3185,10 +3185,11 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/shape/market" } ], - "http://a.ml/vocabularies/document#link-label": "#/components/schemas/market", + "http://a.ml/vocabularies/document#link-label": "market", + "http://a.ml/vocabularies/document#recursive": true, "http://www.w3.org/ns/shacl#name": "schema", "http://a.ml/vocabularies/document-source-maps#sources": [ { @@ -3378,10 +3379,13 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" } ], "http://a.ml/vocabularies/document-source-maps#lexical": [ @@ -3577,13 +3581,18 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(127,10)-(128,0)]" }, { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#recursive", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.3-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.expanded.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.expanded.jsonld index abe693ea22..3d8dcccb8c 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.expanded.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.expanded.jsonld @@ -6449,12 +6449,17 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/shape/market" } ], "http://a.ml/vocabularies/document#link-label": [ { - "@value": "#/components/schemas/market" + "@value": "market" + } + ], + "http://a.ml/vocabularies/document#recursive": [ + { + "@value": true } ], "http://www.w3.org/ns/shacl#name": [ @@ -6470,10 +6475,10 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-target" + "@value": "http://a.ml/vocabularies/document#link-label" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -6486,7 +6491,20 @@ "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-label" + "@value": "http://a.ml/vocabularies/document#recursive" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#link-target" } ], "http://a.ml/vocabularies/document-source-maps#value": [ diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.flattened.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.flattened.jsonld index 9134cbba39..beeaeea68e 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.flattened.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.flattened.jsonld @@ -4616,10 +4616,11 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/shape/market" } ], - "http://a.ml/vocabularies/document#link-label": "#/components/schemas/market", + "http://a.ml/vocabularies/document#link-label": "market", + "http://a.ml/vocabularies/document#recursive": true, "http://www.w3.org/ns/shacl#name": "schema", "http://a.ml/vocabularies/document-source-maps#sources": [ { @@ -4984,10 +4985,13 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" } ], "http://a.ml/vocabularies/document-source-maps#lexical": [ @@ -5271,13 +5275,18 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(153,10)-(154,0)]" }, { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#recursive", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.4-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.expanded.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.expanded.jsonld index 2b32e898f2..4c985de700 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.expanded.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.expanded.jsonld @@ -7520,12 +7520,17 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/shape/market" } ], "http://a.ml/vocabularies/document#link-label": [ { - "@value": "#/components/schemas/market" + "@value": "market" + } + ], + "http://a.ml/vocabularies/document#recursive": [ + { + "@value": true } ], "http://www.w3.org/ns/shacl#name": [ @@ -7541,10 +7546,10 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-target" + "@value": "http://a.ml/vocabularies/document#link-label" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -7557,7 +7562,20 @@ "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-label" + "@value": "http://a.ml/vocabularies/document#recursive" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#link-target" } ], "http://a.ml/vocabularies/document-source-maps#value": [ diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.flattened.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.flattened.jsonld index 1be77c7148..31576b09d2 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.flattened.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.flattened.jsonld @@ -5188,10 +5188,11 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/shape/market" } ], - "http://a.ml/vocabularies/document#link-label": "#/components/schemas/market", + "http://a.ml/vocabularies/document#link-label": "market", + "http://a.ml/vocabularies/document#recursive": true, "http://www.w3.org/ns/shacl#name": "schema", "http://a.ml/vocabularies/document-source-maps#sources": [ { @@ -5623,10 +5624,13 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" } ], "http://a.ml/vocabularies/document-source-maps#lexical": [ @@ -5996,13 +6000,18 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(153,10)-(154,0)]" }, { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#recursive", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.5-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.expanded.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.expanded.jsonld index 34ccd60fc0..9da61b489a 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.expanded.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.expanded.jsonld @@ -8111,12 +8111,17 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/shape/market" } ], "http://a.ml/vocabularies/document#link-label": [ { - "@value": "#/components/schemas/market" + "@value": "market" + } + ], + "http://a.ml/vocabularies/document#recursive": [ + { + "@value": true } ], "http://www.w3.org/ns/shacl#name": [ @@ -8132,10 +8137,10 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-target" + "@value": "http://a.ml/vocabularies/document#link-label" } ], "http://a.ml/vocabularies/document-source-maps#value": [ @@ -8148,7 +8153,20 @@ "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", "http://a.ml/vocabularies/document-source-maps#element": [ { - "@value": "http://a.ml/vocabularies/document#link-label" + "@value": "http://a.ml/vocabularies/document#recursive" + } + ], + "http://a.ml/vocabularies/document-source-maps#value": [ + { + "@value": "true" + } + ] + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": [ + { + "@value": "http://a.ml/vocabularies/document#link-target" } ], "http://a.ml/vocabularies/document-source-maps#value": [ diff --git a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.flattened.jsonld b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.flattened.jsonld index c39c00126e..7399bc85ae 100644 --- a/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.flattened.jsonld +++ b/amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.flattened.jsonld @@ -5601,10 +5601,11 @@ ], "http://a.ml/vocabularies/document#link-target": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/shape/schema" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/shape/market" } ], - "http://a.ml/vocabularies/document#link-label": "#/components/schemas/market", + "http://a.ml/vocabularies/document#link-label": "market", + "http://a.ml/vocabularies/document#recursive": true, "http://www.w3.org/ns/shacl#name": "schema", "http://a.ml/vocabularies/document-source-maps#sources": [ { @@ -6036,10 +6037,13 @@ ], "http://a.ml/vocabularies/document-source-maps#synthesized-field": [ { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1" } ], "http://a.ml/vocabularies/document-source-maps#lexical": [ @@ -6409,13 +6413,18 @@ "http://a.ml/vocabularies/document-source-maps#value": "[(177,10)-(178,0)]" }, { - "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_2", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_0", - "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-label", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#recursive", + "http://a.ml/vocabularies/document-source-maps#value": "true" + }, + { + "@id": "file://amf-cli/shared/src/test/resources/validations/async20/asyncApi-2.6-all.yaml#/declares/msg/marketData/payload/default/shape/schema/source-map/synthesized-field/element_1", + "http://a.ml/vocabularies/document-source-maps#element": "http://a.ml/vocabularies/document#link-target", "http://a.ml/vocabularies/document-source-maps#value": "true" }, { diff --git a/amf-cli/shared/src/test/scala/amf/cli/internal/convert/WrapperTests.scala b/amf-cli/shared/src/test/scala/amf/cli/internal/convert/WrapperTests.scala index af404a8edb..982cd2d239 100644 --- a/amf-cli/shared/src/test/scala/amf/cli/internal/convert/WrapperTests.scala +++ b/amf-cli/shared/src/test/scala/amf/cli/internal/convert/WrapperTests.scala @@ -2295,10 +2295,11 @@ trait WrapperTests extends MultiJsonldAsyncFunSuite with Matchers with NativeOps def getAbsolutePath(path: String): String protected def configFor(spec: Spec) = spec match { - case Spec.RAML10 => RAMLConfiguration.RAML10() - case Spec.RAML08 => RAMLConfiguration.RAML08() - case Spec.OAS20 => OASConfiguration.OAS20() - case Spec.OAS30 => OASConfiguration.OAS30() - case Spec.ASYNC20 => AsyncAPIConfiguration.Async20() + case Spec.RAML10 => RAMLConfiguration.RAML10() + case Spec.RAML08 => RAMLConfiguration.RAML08() + case Spec.OAS20 => OASConfiguration.OAS20() + case Spec.OAS30 => OASConfiguration.OAS30() + case Spec.ASYNC20 | Spec.ASYNC21 | Spec.ASYNC22 | Spec.ASYNC23 | Spec.ASYNC24 | Spec.ASYNC25 | Spec.ASYNC26 => + AsyncAPIConfiguration.Async20() } } diff --git a/amf-cli/shared/src/test/scala/amf/resolution/Async20ResolutionModelTest.scala b/amf-cli/shared/src/test/scala/amf/resolution/Async20ResolutionModelTest.scala new file mode 100644 index 0000000000..37b8b1bf6a --- /dev/null +++ b/amf-cli/shared/src/test/scala/amf/resolution/Async20ResolutionModelTest.scala @@ -0,0 +1,60 @@ +package amf.resolution + +import amf.apicontract.client.scala.AsyncAPIConfiguration +import amf.apicontract.client.scala.model.domain.api.AsyncApi +import amf.core.client.common.transform.PipelineId +import amf.core.client.scala.model.document.Document +import amf.shapes.client.scala.model.domain.{NodeShape, ScalarShape} +import org.scalatest.funsuite.AsyncFunSuite + +import scala.concurrent.ExecutionContext.Implicits.global +import scala.concurrent.{ExecutionContext, Future} + +class Async20ResolutionModelTest extends AsyncFunSuite { + override val executionContext: ExecutionContext = global + + private val basePath: String = "amf-cli/shared/src/test/resources/references/async/" + + test("async 2.0 should resolve inner references correctly") { + processApi(basePath + "async20.yaml") map { document => + val endPoints = document.encodes.asInstanceOf[AsyncApi].endPoints + assert(endPoints.nonEmpty) + val operations = endPoints.head.operations + assert(operations.nonEmpty) + val payloads = operations.head.request.payloads + assert(payloads.nonEmpty) + val schema = payloads.head.schema + assert(schema.isInstanceOf[NodeShape]) + val properties = schema.asInstanceOf[NodeShape].properties + assert(properties.nonEmpty) + val range = properties.head.range + assert(range.isInstanceOf[ScalarShape]) + } + } + + test("async 2.6 should resolve inner references correctly") { + processApi(basePath + "async26.yaml") map { document => + val endPoints = document.encodes.asInstanceOf[AsyncApi].endPoints + assert(endPoints.nonEmpty) + val operations = endPoints.head.operations + assert(operations.nonEmpty) + val payloads = operations.head.request.payloads + assert(payloads.nonEmpty) + val schema = payloads.head.schema + assert(schema.isInstanceOf[NodeShape]) + val properties = schema.asInstanceOf[NodeShape].properties + assert(properties.nonEmpty) + val range = properties.head.range + assert(range.isInstanceOf[ScalarShape]) + } + } + + private def processApi(path: String): Future[Document] = { + val client = AsyncAPIConfiguration.Async20().baseUnitClient() + client + .parse("file://" + path) + .map(p => client.transform(p.baseUnit, PipelineId.Editing)) + .map(_.baseUnit.asInstanceOf[Document]) + } + +} diff --git a/amf-cli/shared/src/test/scala/amf/resolution/Async20ResolutionTest.scala b/amf-cli/shared/src/test/scala/amf/resolution/Async20ResolutionTest.scala index f38c2dcb0e..95651582f7 100644 --- a/amf-cli/shared/src/test/scala/amf/resolution/Async20ResolutionTest.scala +++ b/amf-cli/shared/src/test/scala/amf/resolution/Async20ResolutionTest.scala @@ -9,6 +9,7 @@ import amf.core.internal.remote.{AmfJsonHint, Async20YamlHint, AsyncApi20, Spec} class Async20ResolutionTest extends ResolutionTest { override def basePath: String = "amf-cli/shared/src/test/resources/resolution/async20/" private val validationsPath: String = "amf-cli/shared/src/test/resources/validations/async20/" + private val referencePath: String = "amf-cli/shared/src/test/resources/references/async/" multiGoldenTest("Message examples are propagated to payload and parameter shapes", "message-example-propagation.%s") { config => @@ -309,6 +310,26 @@ class Async20ResolutionTest extends ResolutionTest { ) } + test("async 2.0 should resolve inner references correctly") { + cycle( + "async20.yaml", + "async20.yaml.yaml", + Async20YamlHint, + target = Async20YamlHint, + directory = referencePath + ) + } + + test("async 2.6 should resolve inner references correctly") { + cycle( + "async26.yaml", + "async26.yaml.yaml", + Async20YamlHint, + target = Async20YamlHint, + directory = referencePath + ) + } + override def transform(unit: BaseUnit, config: CycleConfig, amfConfig: AMFConfiguration): BaseUnit = { super.transform(unit, config, AsyncAPIConfiguration.Async20()) } 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 e70147c0ce..804441f517 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 @@ -3,11 +3,10 @@ package amf.shapes.internal.spec.async.parser import amf.core.client.scala.parse.document.ParserContext import amf.core.internal.plugins.syntax.SyamlAMFErrorHandler import amf.core.internal.remote.Spec -import amf.core.internal.remote.Spec.ASYNC20 -import amf.shapes.internal.spec.raml.parser.RamlWebApiContextType.RamlWebApiContextType import amf.shapes.internal.spec.common.parser._ import amf.shapes.internal.spec.common.{JSONSchemaDraft7SchemaVersion, SchemaVersion} import amf.shapes.internal.spec.oas.parser.{OasLikeIgnoreCriteria, OasLink} +import amf.shapes.internal.spec.raml.parser.RamlWebApiContextType.RamlWebApiContextType import org.yaml.model.YNode case class Async2Settings private (syntax: SpecSyntax, spec: Spec) extends SpecSettings { diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/common/emitter/DeclaredTypesEmitters.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/common/emitter/DeclaredTypesEmitters.scala index 990876bceb..0c5e013304 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/common/emitter/DeclaredTypesEmitters.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/common/emitter/DeclaredTypesEmitters.scala @@ -51,7 +51,9 @@ abstract class DeclaredTypesEmitters(types: Seq[Shape], references: Seq[BaseUnit // TODO: THIS SHOULD BE PART OF A SpecSettings object or something of the sort that the context has and we could access. val key: String = spec.spec match { - case Spec.OAS30 | Spec.ASYNC20 => "schemas" + case Spec.OAS30 | Spec.ASYNC20 | Spec.ASYNC21 | Spec.ASYNC22 | Spec.ASYNC23 | Spec.ASYNC24 | Spec.ASYNC25 | + Spec.ASYNC26 => + "schemas" case Spec.JSONSCHEMA if spec.isJsonSchema => spec.asInstanceOf[OasLikeShapeEmitterContext].schemasDeclarationsPath.replace("/", "") case _ => "definitions" diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/common/parser/SpecSettings.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/common/parser/SpecSettings.scala index 71094c3d73..0748653e0f 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/common/parser/SpecSettings.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/common/parser/SpecSettings.scala @@ -3,7 +3,7 @@ package amf.shapes.internal.spec.common.parser import amf.core.client.scala.parse.document.ParserContext import amf.core.internal.plugins.syntax.SyamlAMFErrorHandler import amf.core.internal.remote.Spec -import amf.core.internal.remote.Spec.OAS30 +import amf.core.internal.remote.Spec._ import amf.shapes.internal.spec.raml.parser.RamlWebApiContextType.RamlWebApiContextType import amf.shapes.internal.spec.common.SchemaVersion import org.yaml.model.YNode @@ -14,10 +14,11 @@ trait SpecSettings { def link(node: YNode)(implicit eh: SyamlAMFErrorHandler): Either[String, YNode] def ignoreCriteria: IgnoreCriteria def isOasLikeContext: Boolean = isOas3Context || isOas2Context || isAsyncContext - def isOas2Context: Boolean = spec == Spec.OAS20 + def isOas2Context: Boolean = spec == OAS20 def isOas3Context: Boolean = spec == OAS30 - def isAsyncContext: Boolean = spec == Spec.ASYNC20 - def isRamlContext: Boolean = spec == Spec.RAML10 || spec == Spec.RAML08 + def isAsyncContext: Boolean = + spec == ASYNC20 || spec == ASYNC21 || spec == ASYNC22 || spec == ASYNC23 || spec == ASYNC24 || spec == ASYNC25 || spec == ASYNC26 + def isRamlContext: Boolean = spec == RAML10 || spec == RAML08 def ramlContextType: Option[RamlWebApiContextType] val defaultSchemaVersion: SchemaVersion def closedShapeValidator: ClosedShapeValidator = DefaultClosedShapeValidator(ignoreCriteria, spec, syntax) diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/oas/OasShapeDefinitions.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/oas/OasShapeDefinitions.scala index ebad33579f..c10aefe1ca 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/oas/OasShapeDefinitions.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/oas/OasShapeDefinitions.scala @@ -14,7 +14,10 @@ trait OasShapeDefinitions { val oas3ComponentsPrefix = "#/components/" def stripDefinitionsPrefix(url: String)(implicit ctx: ShapeParserContext): String = { - if (ctx.spec == Spec.OAS30 || ctx.spec == Spec.ASYNC20) url.stripPrefix(oas3DefinitionsPrefix) + if ( + ctx.spec == Spec.OAS30 || ctx.spec == Spec.ASYNC20 || ctx.spec == Spec.ASYNC21 || ctx.spec == Spec.ASYNC22 || + ctx.spec == Spec.ASYNC23 || ctx.spec == Spec.ASYNC24 || ctx.spec == Spec.ASYNC25 || ctx.spec == Spec.ASYNC26 + ) url.stripPrefix(oas3DefinitionsPrefix) else url.stripPrefix(oas2DefinitionsPrefix) } @@ -30,7 +33,8 @@ trait OasShapeDefinitions { spec: Option[Spec] = None, jsonSchemaVersion: Option[JSONSchemaVersion] = None ): String = spec match { - case Some(Spec.OAS30) | Some(Spec.ASYNC20) => + case Some(Spec.OAS30) | Some(Spec.ASYNC20) | Some(Spec.ASYNC21) | Some(Spec.ASYNC22) | + Some(Spec.ASYNC23) | Some(Spec.ASYNC24) | Some(Spec.ASYNC25) | Some(Spec.ASYNC26) => if (!url.startsWith(oas3DefinitionsPrefix)) appendPrefix(oas3DefinitionsPrefix, url) else url case Some(Spec.JSONSCHEMA) if jsonSchemaVersion.exists(version => version.isBiggerThanOrEqualTo(JSONSchemaDraft201909SchemaVersion)) => diff --git a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/oas/parser/OasTypeParser.scala b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/oas/parser/OasTypeParser.scala index 9a9a140a3b..f4618fe63a 100644 --- a/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/oas/parser/OasTypeParser.scala +++ b/amf-shapes/shared/src/main/scala/amf/shapes/internal/spec/oas/parser/OasTypeParser.scala @@ -57,7 +57,9 @@ object OasTypeParser { private def getSchemaVersion(ctx: ShapeParserContext) = { if (ctx.spec == Spec.OAS30) OAS30SchemaVersion(Schema) - else if (ctx.spec == Spec.ASYNC20) JSONSchemaDraft7SchemaVersion + else if ( + ctx.spec == Spec.ASYNC20 || ctx.spec == Spec.ASYNC21 || ctx.spec == Spec.ASYNC22 || ctx.spec == Spec.ASYNC23 || ctx.spec == Spec.ASYNC24 || ctx.spec == Spec.ASYNC25 || ctx.spec == Spec.ASYNC26 + ) JSONSchemaDraft7SchemaVersion else OAS20SchemaVersion(Schema) } }