Skip to content

Changes in 4.0.3

Compare
Choose a tag to compare
@BlockLucas BlockLucas released this 12 Dec 13:32
· 3817 commits to develop since this release
8c83c59

Released Nov 12, 2019.

JS asset

JVM asset

OAS 3.0 EA

This version comes with early access to OAS3.0 support.
Check interface changes for detail of new Objects.

JSON-LD model updated to version 2.0.0

Some namespaces of the fields have changed in the JSON-LD representation.
This change does not affect the use of the object model of AMF (interfaces remain the same).

Key changes in JSON-LD model

The key that identifies the name of an annotation has been changed from http://a.ml/vocabularies/document#name to http://a.ml/vocabularies/core#extensionName.

Interface Changes

OAS 3.0 Objects

New objects for OAS 3.0

  • amf.client.parse.Oas30Parser
  • amf.client.parse.Oas30YamlParser
  • amf.client.resolve.Oas30Resolver
  • amf.client.render.Oas30Renderer

Added Render Options

  • amf.client.render.RenderOptions.withNodeIds()
  • amf.client.render.RenderOptions.isEmitNodeIds()

Flattened

Flattened JSON-LD emission support for AMF (AML pending).
To use flattened emission use RenderOptions.withFlattenedJsonLd

  • New method amf.client.render.RenderOptions.withFlattenedJsonLd()
  • New method amf.client.render.RenderOptions.withoutFlattenedJsonLd()
  • New method amf.client.render.RenderOptions.isFlattenedJsonLd()

Security model changes

Security model in OAS3 has a change that affects compatibility, the property of security in WebApi, EndPoint and Operation that returned a List[ParametrizedSecurityScheme], now returns a List[SecurityRequirement]. SecurityRequirement is an object that contains a property schemes which is a List[ParametrizedSecurityScheme]. If there were three security schemes in the list before, now there will be three security requirements each with one security scheme, for example.
The second change is with the flows in an OAuth2Settings object. When accessing the settings of an OAuth 2 security scheme, there used to be some specific properties, now there is the authorizationGrants property and a flows property which contains a List[OAuth2Flow]. OAuth2Flow contains the other properties that used to be immediately in the settings of the scheme.

JSON Schema building

buildJsonSchema() available for Shapes:

  • amf.client.model.domain.UnionShape.buildJsonSchema()
  • amf.client.model.domain.DataArrangeShape.buildJsonSchema()
  • amf.client.model.domain.SchemaShape.buildJsonSchema()
  • amf.client.model.domain.MatrixShape.buildJsonSchema()
  • amf.client.model.domain.NilShape.buildJsonSchema()
  • amf.client.model.domain.TupleShape.buildJsonSchema()
  • amf.client.model.domain.AnyShape.buildJsonSchema()
  • amf.client.model.domain.ArrayShape.buildJsonSchema()
  • amf.client.model.domain.NodeShape.buildJsonSchema()

Validation changes

Enum value types in OAS are now properly validated, i.e. the following example is no longer valid.

"test": {
          "type": "string",
          "enum": 
            [{
              "key": "value"
            }]
}

Fixed invalid validation with !include tag, i.e. the following example is valid now (as it is considered a string payload)

#%RAML 1.0
title: test API

/resource:
  get:
    responses:
      200:
        body:
          application/json:
            example: !includedexample

Fixed wrong validation of additionalItems with values that are not Boolean, for example, the following schema is now valid:

{
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "object",
      "description": "Allows the insertion of a Contact Us request into Unilever backend systems",
      "properties": {
          "consumer": {
              "type": "object",
              "properties": {
                  "contactDetail": {
                      "type": "array",
                      "minItems": 1,
                      "items": [
                          {
                              "type": "object",
                              "properties": {
                                  "id": {
                                      "type": "string"
                                  }
                              }
                          }
                      ],
                      "additionalItems": {
                          "type": "string"
                      }
                  }
              }
            }
        }
      }

Fixed a case in which a payload with null value for an optional enum used inside a trait was not correctly validated

AMF Fixed issues