Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W-11778938: Fix null value location #1635

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Level: Violation
Severity: Violation
Target:
Property:
Range: [(16,25)-(16,26)]
Range: [(15,39)-(16,25)]
Location: file://amf-cli/shared/src/test/resources/validations/null-value-json.raml

- Constraint: http://a.ml/vocabularies/amf/core#syaml-error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package amf.validation

import amf.apicontract.client.scala.RAMLConfiguration
import amf.core.client.common.validation.{Raml08Profile, Raml10Profile}
import amf.core.client.scala.config.ParsingOptions
import amf.core.internal.remote.{Hint, Raml08YamlHint, Raml10YamlHint}

class RamlModelUniquePlatformReportTest extends UniquePlatformReportGenTest {
Expand Down Expand Up @@ -173,7 +175,8 @@ class RamlModelUniquePlatformReportTest extends UniquePlatformReportGenTest {
test("Test null value in json when expecting scalar value") {
validate(
"/null-value-json.raml",
Some("null-value-json.report")
Some("null-value-json.report"),
configOverride = Some(RAMLConfiguration.RAML08().withParsingOptions(ParsingOptions().withTokens))
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object InlineJsonSchemaParser extends JsonParsing with ScopedJsonContext with Er
ctx: ShapeParserContext
): AnyShape = {

val node = getJsonParserFor(text, valueAST).document().node
val node = getJsonParserFor(text, valueAST).document(ctx.parsingOptions.tokens).node
val schemaEntry = YMapEntry(key, node)
val shape = withScopedContext(valueAST, schemaEntry) { jsonSchemaContext =>
parse(value, schemaEntry)(jsonSchemaContext)
Expand Down