Skip to content

Commit

Permalink
Bump to AMF RC [W-14234458] (#980)
Browse files Browse the repository at this point in the history
* Bump to AMF RC [W-14234458]

* Fixing deltas [W-14234458]

* Fixing deltas [W-14234458]
  • Loading branch information
emilianoascona authored Oct 19, 2023
1 parent 054eb63 commit 32166b8
Show file tree
Hide file tree
Showing 19 changed files with 1,358 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ diagnostics:
message: GET operations must have 2xx, 4xx and 5xx status codes but no 201
range: Range(common.Position[L:2,C:0],common.Position[L:5,C:10])
severity: Error
code: file://als-node-client/src/test/resources/custom-validation/byDirectory/profile8/profile.yaml#/encodes/validations/simple-rego2
code: file://als-node-client/src/test/resources/custom-validation/byDirectory/profile8/profile.yaml#/encodes/validations/simple-rego
relatedInformation:
-
message: "Error at "
Expand All @@ -19,7 +19,7 @@ diagnostics:
message: GET operations must have 2xx, 4xx and 5xx status codes but no 201
range: Range(common.Position[L:2,C:0],common.Position[L:5,C:10])
severity: Error
code: file://als-node-client/src/test/resources/custom-validation/byDirectory/profile8/profile.yaml#/encodes/validations/simple-rego
code: file://als-node-client/src/test/resources/custom-validation/byDirectory/profile8/profile.yaml#/encodes/validations/simple-rego2
relatedInformation:
-
message: "Error at "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
"meta:DialectDomainElement",
"doc:DomainElement"
],
"sh:message": "Ensure API can only be accessed by the specified HTTP verbs. All other HTTP verbs should be disabled (e.g. HEAD).\n",
"amf-core:name": "ab",
"validation:ramlClassId": "apiContract.Operation",
"validation:then": {
"@id": "#/encodes/validations/ab/then"
},
"validation:if": {
"@id": "#/encodes/validations/ab/if"
}
},
"sh:message": "Ensure API can only be accessed by the specified HTTP verbs. All other HTTP verbs should be disabled (e.g. HEAD).\n"
},
{
"@id": "#/encodes/validations/scalar-parameters/propertyConstraints/shapes.schema%20%252F%20shacl.minLength",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
"meta:DialectDomainElement",
"doc:DomainElement"
],
"sh:message": "Ensure API can only be accessed by the specified HTTP verbs. All other HTTP verbs should be disabled (e.g. HEAD).\n",
"amf-core:name": "ab",
"validation:ramlClassId": "apiContract.Operation",
"validation:then": {
"@id": "#/encodes/validations/ab/then"
},
"validation:if": {
"@id": "#/encodes/validations/ab/if"
}
},
"sh:message": "Ensure API can only be accessed by the specified HTTP verbs. All other HTTP verbs should be disabled (e.g. HEAD).\n"
},
{
"@id": "#/encodes/validations/scalar-parameters/propertyConstraints/shapes.schema%20%252F%20shacl.minLength",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import org.mulesoft.als.suggestions.RawSuggestion
import org.mulesoft.als.suggestions.aml.AmlCompletionRequest

import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
trait DisjointCompletionPlugins extends AMLCompletionPlugin {
protected val resolvers: List[ResolveIfApplies]

Expand All @@ -18,7 +17,8 @@ trait DisjointCompletionPlugins extends AMLCompletionPlugin {
head.resolve(request) match {
case Some(rs) =>
rs
case _ => lookForResolver(tail, request)
case _ =>
lookForResolver(tail, request)
}
case Nil =>
emptySuggestion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package org.mulesoft.als.suggestions.plugins.aml

import amf.aml.client.scala.model.document.Dialect
import amf.aml.client.scala.model.domain.{NodeMapping, PropertyMapping, UnionNodeMapping}
import amf.aml.client.scala.model.domain._
import amf.aml.internal.annotations.FromUnionNodeMapping
import amf.core.client.scala.model.StrField
import amf.core.client.scala.model.domain.{AmfObject, DomainElement}
import org.mulesoft.als.common.YPartBranch
import org.mulesoft.amfintegration.AmfImplicits.AmfObjectImp
Expand Down Expand Up @@ -66,6 +67,19 @@ trait UnionSuggestions {

private def isDuplicateOf(p: PropertyMapping, that: PropertyMapping): Boolean =
p.name().value() == that.name().value() &&
p.objectRange().headOption == that.objectRange().headOption &&
comparesObjectRange(p, that) &&
p.allowMultiple().value() == that.allowMultiple().value()

private def comparesObjectRange(p: PropertyMapping, t: PropertyMapping): Boolean = t.classification() match {
case ObjectPairProperty =>
comparesObjectProperty(p.objectRange().headOption, t.objectRange().headOption)
case _ => p.objectRange().headOption == t.objectRange().headOption
}

private def comparesObjectProperty(p: Option[StrField], t: Option[StrField]): Boolean = (p, t) match {
case (Some(p), Some(t)) =>
p.annotations() == t.annotations() &&
p.value() == t.value()
case _ => false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,42 @@
"commitCharacters": null,
"command": null
},
{
"label": "rego_extensions",
"kind": [

],
"detail": "unknown",
"documentation": "rego_extensions",
"deprecated": [

],
"preselect": [

],
"sortText": "11rego_extensions",
"filterText": "rego_extensions: ",
"insertText": null,
"insertTextFormat": [
1
],
"textEdit": {
"range": {
"start": {
"line": 1,
"character": 0
},
"end": {
"line": 1,
"character": 0
}
},
"newText": "rego_extensions: "
},
"additionalTextEdits": null,
"commitCharacters": null,
"command": null
},
{
"label": "tags",
"kind": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,42 @@
"commitCharacters": null,
"command": null
},
{
"label": "aspect",
"kind": [

],
"detail": "unknown",
"documentation": "aspect",
"deprecated": [

],
"preselect": [

],
"sortText": "11aspect",
"filterText": "aspect:\n - ",
"insertText": null,
"insertTextFormat": [
1
],
"textEdit": {
"range": {
"start": {
"line": 4,
"character": 6
},
"end": {
"line": 4,
"character": 6
}
},
"newText": "aspect:\n - "
},
"additionalTextEdits": null,
"commitCharacters": null,
"command": null
},
{
"label": "classConstraints",
"kind": [
Expand Down Expand Up @@ -107,6 +143,42 @@
"commitCharacters": null,
"command": null
},
{
"label": "documentation",
"kind": [

],
"detail": "unknown",
"documentation": "documentation",
"deprecated": [

],
"preselect": [

],
"sortText": "11documentation",
"filterText": "documentation: ",
"insertText": null,
"insertTextFormat": [
1
],
"textEdit": {
"range": {
"start": {
"line": 4,
"character": 6
},
"end": {
"line": 4,
"character": 6
}
},
"newText": "documentation: "
},
"additionalTextEdits": null,
"commitCharacters": null,
"command": null
},
{
"label": "else",
"kind": [
Expand Down Expand Up @@ -143,6 +215,42 @@
"commitCharacters": null,
"command": null
},
{
"label": "examples",
"kind": [

],
"detail": "unknown",
"documentation": "examples",
"deprecated": [

],
"preselect": [

],
"sortText": "11examples",
"filterText": "examples:\n ",
"insertText": null,
"insertTextFormat": [
1
],
"textEdit": {
"range": {
"start": {
"line": 4,
"character": 6
},
"end": {
"line": 4,
"character": 6
}
},
"newText": "examples:\n "
},
"additionalTextEdits": null,
"commitCharacters": null,
"command": null
},
{
"label": "if",
"kind": [
Expand Down
Loading

0 comments on commit 32166b8

Please sign in to comment.