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