Releases: aml-org/amf
Changes in 4.0.6
Interface Changes
Changed bindings
New intermediate object was created to enable named bindings.
- amf.client.model.domain.EndPoint.bindings changed its return type to amf.client.model.domain.ChannelBindings
- amf.client.model.domain.Operation.bindings changed its return type to amf.client.model.domain.OperationBindings
- amf.client.model.domain.Request.bindings changed its return type to amf.client.model.domain.MessageBindings
- amf.client.model.domain.Response.bindings changed its return type to amf.client.model.domain.MessageBindings
- amf.client.model.domain.Server.bindings changed its return type to amf.client.model.domain.ServerBindings
Example:
Before
val bindingsList List[ServerBinding] = EndPoint.bindings()
Now
val bindingsObject ChannelBindings = EndPoint.bindings()
val bindingList List[ServerBinding] = bindingsObject.bindings()
This applies exactly the same with the interfaces mentioned before.
New bindings methods
- amf.client.model.domain.EndPoint.withBindings (added)
- amf.client.model.domain.Operation.withBindings (added)
- amf.client.model.domain.Request.withBindings (added)
- amf.client.model.domain.Response.withBindings (added)
- amf.client.model.domain.Server.withBindings (added)
New validate method for payloads
If you are currently blocking the asynchronous payload validation call you can use the following new method:
- amf.client.validate.PayloadValidator.syncValidate (synchronous)
OAS 2.0 Validation changes
Body parameters.
Duplicated body parameters are now being validated.
For example, the following api definition will now be invalid:
{
"swagger": "2.0",
"info": {
"title": "Test",
"version": "1.0.0"
},
"paths": {
"/": {
"parameters": [
{
"name": "body parameter 1",
"in": "body",
"schema": {}
},
{
"name": "body parameter 2",
"in": "body",
"schema": {}
}
],
"get": {
"responses": {
"200": {
"description": "ok"
}
}
}
}
}
}
Security requirement object
Security requirement object value is now being correctly validated as an array.
Valid example:
{
"swagger" : "2.0",
"info" : {
"title" : "Registry",
"version" : "1"
},
"paths" : {
},
"security" : [ {
"Bearer" : []
} ],
"securityDefinitions" : {
"Bearer" : {
"in" : "header",
"name" : "Authorization",
"type" : "apiKey"
}
}
}
Invalid example:
{
"swagger" : "2.0",
"info" : {
"title" : "Registry",
"version" : "2"
},
"paths" : {
},
"security" : [ {
"Bearer" : ""
} ],
"securityDefinitions" : {
"Bearer" : {
"in" : "header",
"name" : "Authorization",
"type" : "apiKey"
}
}
}
Info Object
Required facet "name" is now being validated.
Valid example:
{
"swagger": "2.0",
"info": {
"title": "Testing API",
"version": "1.0.0",
"name": "my name",
"license": {}
},
"paths": {}
}
Invalid example:
{
"swagger": "2.0",
"info": {
"title": "Testing API",
"version": "1.0.0",
"license": {}
},
"paths": {}
}
AMF Fixed issues
- APIMF-2008 - OAS 3: Do not remove Server objects from Root and Endpoint nodes when resolving in editing pipeline
- APIMF-1997 - Body parameters amount not being validated
- APIMF-1995 - security Requirement' object type not being validated
- APIMF-1974 - name' field is required in license object
- APIMF-1959 - AMF hangs with multiple anchors from endpoint
- APIMF-1958 - SE: Missing validation when overriding inherited properties
- APIMF-1954 - Payload name is null when consumes is declared (OAS)
- APIMF-1953 - AMF fails in conversion with IllegalTypeDeclarations in parameters
- APIMF-1946 - SE: A property defined in RAML is generated as a new declare
- APIMF-1940 - AMF emits JSON path references in conversion to RAML
- APIMF-1939 - AMF emits/parses additional properties with OAS emitters/parsers in RAML
- APIMF-1929 - SE: Gives a random validation error for a RAML Fragment file
- APIMF-1928 - AMF Resolution throws NPE
- APIMF-1926 - OAS 20 Validation analysis
- APIMF-1923 - SE: Using optional response codes do not throw an error in Design Center - API Console
- APIMF-1910 - AMF Validate: missing validation of invalid $ref inside paths
- APIMF-1906 - AMF Validate: missing validation of invalid securityDefinition type
- APIMF-1893 - AMF Validate: missing validation with invalid reference (missing slash)
- APIMF-1875 - Issue while validating number with more than 16 digits within a JSON body
- APIMF-1814 - improve ScalarShape.parameterValidator performance
- APIMF-1728 - recursive type declared in additionalProperties is not generating a RecursiveShape
Changes in 4.0.5
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
- APIMF-1945 - Reference to file inside folder with spaces
- APIMF-1942 - AMF emits extra facets allowed in OAS but not in RAML during conversion
- APIMF-1933 - Missing reference (on invalid RAML)
- APIMF-1932 - When having a file type property, property name is not propagated from PropertyShape to FileShape
- APIMF-1922 - Null scalar is not being validated correctly
- APIMF-1911 - AMF expander is not expanding enums correctly
- APIMF-1909 - required property constraint (unique) not being validated
- APIMF-1908 - AMF Validate missing validation of required field for Flow Object
- APIMF-1904 - AMF Validate: missing validation of invalid style for Parameter
- APIMF-1903 - tag object restrictions not being checked
- APIMF-1901 - [swagger validation] should be an array not being checked in AMF
- APIMF-1900 - AMF Validate: missing validation of required field in License Object
- APIMF-1899 - AMF Validate: missing validation of invalid facets for Security Scheme object
- APIMF-1897 - AMF Validate: missing validation for invalid facets inside flows object
- APIMF-1895 - AMF Validate: missing validation with null value in object nodes
- APIMF-1879 - Jenkins test run and Sonar test run dont support Japanese folder and file names
- APIMF-1877 - Header names must not contain non-US-ASCII characters
- APIMF-1872 - AMF doesn't validate the existence of "paths" node
- APIMF-1860 - AMF incorrectly resolves URI Parameters
- APIMF-1790 - Escape characters are visible in Web API Model
- APIMF-1716 - Building a json schema from a shape should use refs
Changes in 4.0.4
OAS 3.0 full support
This version comes with full support of OAS 3.0, for adoption check EA release that contains the interface changes
Async API Early Access
This version is an Early Access to Async API support.
You have all API lifecycle development such as parse, resolve & some validations ready.
Take in mind that components object (and refs to it) & traits are still not supported.
Interface Changes
- added amf.client.model.domain.Payload.schemaMediaType()
- added amf.client.model.domain.Payload.withSchemaMediaType()
- added amf.client.model.domain.SecurityScheme.withHttpApiKeySettings()
- added amf.client.parse.Aml10Parser.parseAsync()
- added amf.client.parse.JsonPayloadParser.parseAsync()
- added amf.client.parse.Oas20Parser.parseAsync()
- added amf.client.parse.Parser.parseAsync()
- added amf.client.parse.Raml08Parser.parseAsync()
- added amf.client.parse.Raml10Parser.parseAsync()
- added amf.client.parse.RamlParser.parseAsync()
- added amf.client.parse.YamlPayloadParser.parseAsync()
- added amf.ProfileNames.ASYNC()
- added amf.ProfileNames.ASYNC20()
Validation changes
Fixed invalid validation with repeat facet for RAML 0.8, for example the following api is now valid
securitySchemes:
-
oauth_2_0:
description: |
Mule OAUTH.
type: OAuth 2.0
describedBy:
headers:
Authorization:
description: |
Used to send a valid OAuth 2 access token. Do not use
with the "access_token" query string parameter.
type: string
required: false
repeat: true
AMF Fixed issues
- APIMF-1876 - Oas Security Scheme Emitter only emits one security scheme for a given type
- APIMF-1858 - Parsing an OAS with enums is generating different WebApi documents
- APIMF-1847 - Converting RAML to OAS encodes Japanese characters
- APIMF-1846 - OAS 20 parser does not parse "description" and "required" parameter fields
- APIMF-1840 - SE: Unresolved reference to Inner Elements for a JSON schema
- APIMF-1797 - SE: Merging traits and methods does not return the expected examples defined in the Spec API
- APIMF-1786 - Invalid JSON is valid
- APIMF-1717 - AMF should return results if any when parsing
Changes in 4.0.3
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
- APIMF-1670 - User facets with two inheritance levels are not supported
- APIMF-1702 - Fix restriction computation of additional properties
- APIMF-1708 - Json schemas should have the option to not render examples
- APIMF-1709 - Can't generate RAML with null value in example
- APIMF-1710 - Annotations has no name
- APIMF-1713 - OAS' API key security scheme does not support logical AND operation
- APIMF-1714 - Duplicated declaration in generated JSON-LD
- APIMF-1718 - Improve ReferenceResolver logic on order to differentiate files with the same name in other directories
- APIMF-1724 - Error in validation/resolution in AMF service
- APIMF-1727 - JSON_LD repeats enums values
- APIMF-1729 - JSON_LD Rendering produces duplicates keys
- APIMF-1730 - Security issue with lib.thrift 0.10.0
- APIMF-1773 - Missing closure shape in recursive type
- APIMF-1798 - Conflict of IDs with cached refs resolved with editing