Skip to content

Changes in AMF 4.7.7

Compare
Choose a tag to compare
@arielmirra arielmirra released this 27 Aug 20:53
· 2372 commits to develop since this release
bf92095

Released Aug 27, 2021.

JS asset

JVM asset

RAML 1.0 changes

Parsing nil types

As the RAML Spec declares, nil types are equivalent to union types. However, this was not the case previously in AMF. In AMF 4.7.7 this has been changed and both notations are equivalent.

This change fixed some bugs, for example: Given the following similar RAML types:

types:
  def1?:
    type: integer
    default: 20
  def2:
    type: integer | nil
    default: 20
  def3:
    type: integer?
    default: 20

AMF didn't keep the default value in def3, thus causing an error when validating against that type. Now AMF correctly parses nillable notation and saves default and other facets in that object.

Properties declared in required field

AMF now saves properties declared in required but not present in properties. For example, consider the following JSON Schema:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type" : "object",
    "properties": {
        "name": {"type": "string"},
        "age": {"type": "integer"}
    },
    "additionalProperties": false,
    "required": [
        "address"
    ]
}

Previously, AMF ignored property address as it was not declared in properties. Now it saves it and requires it in validation.

This change solved problems when using JSON Schemas with anyOf or oneOf and multiple schemas with only required fields.

For example, given the following JSON Schema:

{
    "type": "object",
    "oneOf": [
        {
            "required": [
                "p_1"
            ]
        },
        {
            "required": [
                "p_2"
            ]
        }
    ]
}

Previously AMF ignored properties p_1 and p_2, it parsed two empty schemas where any value would match, thus making it impossible to match with only one of those. Now AMF parses two schemas, one where p_1 and other where p_2 is required.

GitHub fixed issues

AMF Fixed issues