Skip to content

Changes in 4.0.5

Compare
Choose a tag to compare
@BlockLucas BlockLucas released this 13 Feb 18:35
· 3646 commits to develop since this release
e229fde

Released Feb 13, 2020.

JS asset

JVM asset

Interface Changes

Async 2.0 Objects

New objects for Async 2.0 (beta)

  • amf.client.parse.Async20Parser

Compact json schema emission

When building a json schema from a shape (descendants of amf.client.model.domain.AnyShape), a new parsing option has been added to provide an alternative compacted emission. This extracts common types that are used throughout the resulting schema, and emits these schemas in the definitions facet.

shape.buildJsonSchema(ShapeRenderOptions().withCompactedEmission)

Validation changes

Improved validation of required facet in JSON schemas.

In JSON Schema 3 required facet is a boolean.
From JSON Schemas 4 & newer versions, it is an array (4 is used if no version is specified).

For example, the following schema definition will now be invalid:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "id": "id",
      "type": "string",
      "required": "true"
    }
  }
}

OAS 20 type parameter

Missing "type" facet in parameters are now validated, the following example is now invalid:

"parameters": [
          {
            "in": "query",
            "name": "filename",
            "required": true
          }
        ]

JSON Schema Properties

JSON Schema properties definitions are now validated, the following example that contains an array instead of an object for property definitions (usually a mistake using examples in the definitions) is now invalid:

{
  "$schema": "http://json-schema.org/schema",
  "type": "object",
  "properties": [
    {
      "date": "2019-10-21 13:31:17"
    },
    {
      "amount": "-13.00"
    }
  ]
}

Any JSON Schemas

JSON schemas with no types definition will now be validated correctly, for example the following raml is now valid:

types:
  Client:
    type: |
      {
        "$schema": "http://json-schema.org/draft-03/schema",
        "type": "object",
        "properties": {
          "from": {
            "required": true
          }
        }
      }
    example:
      {
        "from": "test"
      }

Before an Object was expected for the "from" value

AMF Fixed issues