Releases: aml-org/amf
Changes in AMF 4.2.0
Custom Validations Expanded ("New feature!")
What's new?
Custom Validations now left beta support! This come with some changes.
SPARQL and extended SHACL functions
Now you can use SPARQL in your custom validations and some new SHACL functions.
You can find more information and examples in Validation Tutorial.
JS functions are not supported anymore
With the addition of SPARQL there is no need of using JS functions.
More performance in JVM
SHACL is now consumed directly from Apache Jena in JVM instead of using Nashorn to consume the SHACL JS library.
Dynamic model property names
We changed the way that properties are named in our dynamic model (DataNode): previously the properties were named with an autogenerated name ("scalar_#", "object_#", etc.), now they take the name of the parent node. These autogenerated names are not being used by implementors.
For reference, with this example:
openapi: 3.0.0
info:
title: Sample API
version: undefined
components:
schemas:
person:
properties:
name:
type: string
age:
type: integer
example:
name: John Doe
age: 44
paths: {}
This was the JSON-LD representation of the example previously:
"apiContract:examples": [
{
"@id": "#2",
"@type": [
"apiContract:Example",
"doc:DomainElement"
],
"doc:strict": [
{
"@value": true
}
],
"doc:structuredValue": [
{
"@id": "#3",
"@type": [
"data:Object",
"data:Node",
"doc:DomainElement"
],
"data:name": [
{
"@id": "#4",
"@type": [
"data:Scalar",
"data:Node",
"doc:DomainElement"
],
"data:value": [
{
"@value": "John Doe"
}
],
"shacl:datatype": [
{
"@id": "http://www.w3.org/2001/XMLSchema#string"
}
],
"core:name": [
{
"@value": "scalar_2"
}
]
}
],
"data:age": [
{
"@id": "#5",
"@type": [
"data:Scalar",
"data:Node",
"doc:DomainElement"
],
"data:value": [
{
"@value": "44"
}
],
"shacl:datatype": [
{
"@id": "http://www.w3.org/2001/XMLSchema#integer"
}
],
"core:name": [
{
"@value": "scalar_3"
}
]
}
],
"core:name": [
{
"@value": "object_1"
}
]
}
],
"doc:raw": [
{
"@value": "name: John Doe\nage: 44"
}
]
}
]
and this is the new one:
"apiContract:examples": [
{
"@id": "#2",
"@type": [
"apiContract:Example",
"doc:DomainElement"
],
"doc:strict": [
{
"@value": true
}
],
"doc:structuredValue": [
{
"@id": "#3",
"@type": [
"data:Object",
"data:Node",
"doc:DomainElement"
],
"data:name": [
{
"@id": "#4",
"@type": [
"data:Scalar",
"data:Node",
"doc:DomainElement"
],
"data:value": [
{
"@value": "John Doe"
}
],
"shacl:datatype": [
{
"@id": "http://www.w3.org/2001/XMLSchema#string"
}
],
"core:name": [
{
"@value": "name"
}
]
}
],
"data:age": [
{
"@id": "#5",
"@type": [
"data:Scalar",
"data:Node",
"doc:DomainElement"
],
"data:value": [
{
"@value": "44"
}
],
"shacl:datatype": [
{
"@id": "http://www.w3.org/2001/XMLSchema#integer"
}
],
"core:name": [
{
"@value": "age"
}
]
}
],
"core:name": [
{
"@value": "object_1"
}
]
}
],
"doc:raw": [
{
"@value": "name: John Doe\nage: 44"
}
]
}
]
Validation Changes
Cyclic References in OAS APIs
Cyclic references between files is now supported for OAS APIs. The example below shows an API that was invalid before but is valid now.
api.yaml
swagger: '2.0'
info:
title: pet api
version: 1.0
definitions:
pet:
type: object
properties:
animalRef:
$ref: 'ref.yaml#/definitions/animal'
paths: {}
ref.yaml
definitions:
animal:
type: object
properties:
petRef:
$ref: 'api.yaml#/definitions/pet'
YAML References fix
Fixed an Unresolved Reference bug with yaml references, for example, the following API is now valid:
api.yaml
swagger: "2.0"
info:
title: 'test'
version: "1.2"
paths:
/pets:
get:
produces:
- application/json
responses:
'403':
$ref: 'ref.yaml#/responses/response1'
ref.yaml
definitions:
TestSchema:
type: string
responses:
response1:
description: 'test'
schema:
$ref: '#/definitions/TestSchema'
RAML Overlay example validation
Fixed an invalid validation with an example inside an Overlay, for example the following API is now valid:
api.raml
#%RAML 1.0
title: Test
types:
TestEntity:
type: object
properties:
id: string
overlay.raml
#%RAML 1.0 Overlay
title: Overlay
extends: ./api.raml
types:
TestEntity:
example: |
{
"id": "t123"
}
AsyncAPI 2.0 (still beta) & OAS 3.0
Validation of invalid yaml tags was introduced as specified https://github.com/asyncapi/asyncapi/blob/master/versions/2.0.0/asyncapi.md#format
https://swagger.io/specification/
The following APIs are now invalid:
asyncapi: 2.0.0
info:
title: Signup service example (internal)
version: !!invalidTag 0.1.0
channels:
/user/signedup:
subscribe:
message:
payload:
type: object
properties:
email:
type: string
format: email
openapi: 3.0.0
info:
title: test
version: !!invalidTag 0.1.0
paths:
/pets:
get:
responses:
'403':
description: sd
AML Validation
- Added a validation for duplicated terms, for example, the following example is now invalid as Term1 is used for classTerms & propertyTerms:
#%Vocabulary 1.0
vocabulary: Term
base: http://a.ml/vocabularies#
classTerms:
Term1:
displayName: Term1
description: Term1 class
properties:
- Term1
propertyTerms:
Term1:
displayName: Term1
description: Term1 property
range: string
- Reduced severity for
missing class term
validations from Violation to Warning. Now AML will not block using semantics defined outside of the vocabulary and not specified inexternals
#%Vocabulary 1.0
vocabulary: Term
base: http://a.ml/vocabularies#
classTerms:
MyClass:
displayName: MyClass
description: My class
properties:
- myProperty
propertyTerms:
myProperty:
displayName: myProperty
description: My property
range: InexistentClass # this will show now a warning since InexistentClass is not defined in classTerms
Interface Changes
Added methods:
- amf.client.model.document.BaseUnit.withReferenceAlias()
- amf.plugins.features.validation.SHACLValidator.supportsJSFunctions()
- amf.client.model.domain.NodeMapping.isLink()
- amf.client.model.domain.NodeMapping.linkLabel()
- amf.client.model.domain.NodeMapping.withLinkTarget()
- amf.client.model.domain.NodeMapping.withLinkLabel()
- amf.client.model.domain.NodeMapping.linkTarget()
- amf.client.model.domain.NodeMapping.linkCopy()
- amf.client.model.domain.NodeMapping.link()
Updated:
These interfaces were unusable before this release
- amf.plugins.features.validation.SHACLValidator.loadLibrary()
AML Vocabularies and Canonical Web Api Dialect Repository Migration
AML Vocabularies that were previously locates in the vocabulary/vocabulary folder have been migrated to the aml-org/amf-metadata repository. Canonical Web Api spec dialect has also been migrated.
The Validations Profile dialect (validations.raml) was moved to the documentation section.
The OAS 2.0 dialect was stale and was deleted.
You can find more information into how to use these assets in the aml-org/amf-metadata README.
Canonical Web API Spec Transformation Repository Migration
...
Changes in AMF 4.1.3
Validation Changes
OAS 30 recursive reference validation
fixed a bug in which an invalid recursive reference was not detected, for example, the following API is now invalid:
{
"openapi": "3.0.0",
"info": {
"version": "0.0.1",
"title": "test"
},
"paths": {
"/path": {
"post": {
"responses": {
"400": {
"description": "desc",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/mytype"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"mytype": {
"$ref": "#/components/schemas/mytype"
}
}
}
}
RAML 1.0
Now, in RAML 1.0, if you didn't defined the field scopes
in your OAuth 2.0 SecuritySchema definition you can use any scope in the implementation, for example, the following API is now valid:
#%RAML 1.0
title: GitHub API
securitySchemes:
oauth_2_0:
description: This API supports OAuth 2.0 for authenticating all API requests.
type: OAuth 2.0
settings:
accessTokenUri: https://someurl/oauth2/access_token
authorizationGrants: [ client_credentials ]
/users:
get:
securedBy: [ oauth_2_0: { scopes: [ USER ] } ]
Async 2.0 (Beta)
Added validation for Query parameters and fragments used on Channels Object, for example, the following API is now invalid:
asyncapi: 2.0.0
info:
title: Signup service example (internal)
version: 0.1.0
channels:
/user/signedup?foo=1:
Cross-spec validation
If you are using an internal interface (like RuntimeCompiler) & at the same time you were not specifying any Vendor (Like RAML10 or OAS20) when parsing, you will encounter a validation saying that it is invalid to have cross-spec APIs (e.g.: RAML 0.8 spec referencing RAML 1.0 DataType fragment)
This validation already existed in vendor-defined compilations.
Interface Changes
Added methods:
- amf.client.model.domain.Callback.withEndpoint()
- amf.client.model.domain.DialectDomainElement.getScalarValueByPropertyUri()
- amf.client.model.domain.ParametrizedSecurityScheme.description()
- amf.client.model.domain.ParametrizedSecurityScheme.withDescription()
- amf.client.model.domain.NodeShape.withAdditionalPropertiesSchema()
- amf.client.model.domain.Payload.encodings() (deprecates amf.client.model.domain.Payload.encoding())
- amf.client.model.domain.Payload.withEncodings() (deprecates amf.client.model.domain.Payload.withEncoding())
Updated:
These interfaces were unusable before this release
- Method amf.client.model.domain.Callback.withEndpoint() changed its signature
- Method amf.client.model.domain.NodeShape.withPropertyNames() changed its return type from amf.plugins.domain.shapes.models.NodeShape to amf.client.model.domain.NodeShape
AMF Fixed issues
- APIMF-2240 - AMFCompiler with vendor
None
does not validateInvalidCrossSpec
- APIMF-2239 - AMF Valdiation - Missing OAS 30 Recursive Shape validation in a Ref to same type
- APIMF-2238 - SE: Missing validation in “scopes” parameter when applying a SecurityScheme fragment
- APIMF-2227 - Flattened JSON-LD emission & parsing for AML self-encoded dialects
- APIMF-2223 - AMF Validation Recursive Shape Regression
- APIMF-2219 - Fix expander for 4.1.3 release
- APIMF-2218 - Validation of huge API fails after resolving document with EDITING pipeline
- APIMF-2204 - Error when upload from Exchange a RAML or OAS (previously translated from a OAS or RAML respectively) using AMF
- APIMF-2202 - Missing validation on Query parameters and fragments SHALL NOT be used
- APIMF-2201 - Conversion from OAS 3.0 to RAML 1.0: externalDocs is converted with errors
- APIMF-2197 - Duplicate ID for recursive units
- APIMF-2189 - OAS 3.0 validation missing for status codes not enclosed in quotation marks
- APIMF-2184 - OAS 3 renderer outputs swagger 2.0 for RAML 1.0 Library Github Issue #585
- APIMF-2181 - SE: Default value replaces first value in Enum option - Design Specification
- APIMF-2173 - Invalid recursive shape generated when resolving nested json schema refs
- APIMF-2162 - Custom Validation with root doc as target is returning an error
- APIMF-2161 - SE: Referring type which is extended at same RAML definition file cause "Error recursive shape" error
- APIMF-2160 - Declares and encodes point to the same node in flattened JSON-LD
- APIMF-2159 - Flattened JSON-LD emitter emits wrongly the ID of the root document with compact URIs
- APIMF-2158 - Duplicate IDs for members of any-of with recursive types
- APIMF-2157 - Duplicate IDs for every member of any-of with basic RAML types
- APIMF-2156 - Duplicated IDs for every member of shapes#dependencies
- APIMF-2155 - Duplicated IDs for payload schemas in declares and their references in encodes
- APIMF-2154 - Duplicated IDs for apiBinding#query and apiBinding#headers
- APIMF-2153 - Duplicated IDs for examples for different media types
- APIMF-2152 - Duplicated ID in examples during parsing causes data nodes to have duplicated IDs
- APIMF-2151 - Duplicate ID between default-value and enums
- APIMF-2150 - Duplicated source maps ID for "document" and "encodes" nodes in dialect instances
- APIMF-2149 - Duplicate ID in responses
- APIMF-2146 - Merged trait with parametrized type in response results in new type being a link
- APIMF-2144 - Avoid full path of external fragments in id when using compact uris
- APIMF-2141 - AMF Flattened Graph Parser does not parse source maps
- APIMF-2140 - Error parsing JSON-LD node
- APIMF-2139 - Timeout while transforming to CanonicalWebAPI
- APIMF-2138 - Exception while transforming to CanonicalWebAPI
- APIMF-2137 - Conversion from OAS3 json to OAS3 yaml: resultant file is not valid in some cases
- APIMF-2136 - Conversion from RAML to OAS3: operationId with meaningless value null_0 is added to methods
- APIMF-2119 - Error due to amf-callbacks annotation emitted when converting OAS 3.0 to RAML 1.0
- APIMF-2063 - Failing API because of slow performance
- APIMF-2058 - RAML direct inheritance of an Array Shape does not resolve correctly
- APIMF-1536 - Definition not being emitted with a recursive type in OAS 20 Github Issue #441
Changes in AMF 4.1.2-1
This Hotfix comes with an improvement in Error handling for CanonicalWebAPI transformations.
This change doesn't affect the standard webapi usage of the framework, either their interface or behavior.
AMF Fixed issues
Changes in AMF 4.1.1-1
This Hotfix comes with improvements in Performance & Error handling for CanonicalWebAPI transformations.
These changes doesn't affect the standard webapi usage of the framework, either their interface or behavior.
AMF Fixed issues
Changes in AMF 4.1.2-0
OAS 30 Validation Changes
Status code in OAS 30 specs now must be a string as specified in spec.
This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML.
See OpenAPI Specification here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#patterned-fields-1
For example the following API is now invalid:
openapi: "3.0.0"
info:
version: 1.0.0
title: 1-api
paths:
/test:
get:
responses:
200: # quote this key to fix it
description: 200 response
AMF Fixed issues
Changes in AMF 4.1.2
Validation Changes
OAS YAML references
Fixed an invalid validation on references to YAML files for OpenAPI specs, for example, the following API is now valid:
api.yaml:
swagger: '2.0'
info:
title: Sample API
version: ''
paths:
/resource:
get:
responses:
'200':
description: ''
schema:
$ref: 'f/complexType.yaml'
/resource2:
get:
responses:
'200':
description: ''
schema:
$ref: 'f/baseType.yaml'
f/complexType.yaml:
type: object
properties:
ref:
$ref: baseType.yaml
f/baseType.yaml:
type: object
properties:
name:
type: string
Duplicate keys
Fixed a bug where duplicate keys with one being in quotation marks were not being validated, for example, the following API is now invalid:
#%RAML 1.0
title: A title
types:
SomeType:
type: object
properties:
type: boolean
"type":
type: string
OAS Emission change
A performance improvement was made with regards to OAS emission. Declared types which are used multiple time throughout a specification are now only rendered once and then referenced when used. Here is a simple example of converting to from raml to oas.
#%RAML 1.0
title: compact emission test
types:
Person:
properties:
name: string
/invoices:
get:
responses:
200:
body:
properties:
a: Person
b: Person
swagger: "2.0"
info:
title: compact emission test
version: "1.0"
paths:
/invoices:
get:
responses:
"200":
description: ""
schema:
type: object
required: [a, b]
properties:
a:
$ref: "#/definitions/Person"
b:
$ref: "#/definitions/Person"
definitions:
Person:
type: object
required:
- name
properties:
name:
type: string
AMF Fixed issues
- APIMF-2086 - High memory consumption/timeout at API publish time while converting to OAS
- APIMF-2124 - Invalid uri validation with "id" value defined with quotation marks (") or apostrophe makrs (')
- APIMF-2123 - Missing validation on headers for Message Traits
- APIMF-2120 - Node ID generated for two same RAMLS in different files/location does not match
- APIMF-2114 - Traits inside "exchange_modules" libraries are not found
- APIMF-2113 - SOF in SYAML parsing invalid RAML API (SYAML v1.0)
- APIMF-2112 - Duplicated IDs in structured values within examples (null parent)
- APIMF-2103 - Validation of parameters with schema composition does not work for OAS30
- APIMF-2102 - Cannot get all references and examples by reference for OAS3 api
- APIMF-2099 - Difference between raw example and structured example
- APIMF-2084 - $ref to .yaml file is not working for OAS2 and OAS3
- APIMF-2082 - Flattened emission loses lexical information for repeated links
- APIMF-2069 - Duplicate keys in yaml mapping node not detected
- APIMF-2033 - SE: "NamedExample" fragment causing internal error during validation
- APIMF-1777 - SOF when transforming BaseUnit with CanonicalWebAPISpecTransformer
- APIMF-1608 - amf-xml-extension can not generate xml for recursive shapes
Changes in AMF 4.1.1
Interface changes
ExecutionEnvironment
Dialect registration interfaces were fixed to receive a scheduler inside the environment, instead of outside
BaseUnit
Added the posibility to set the model Id
- amf.client.model.document.BaseUnit.withId() (with descendants)
Updated JS typings
Updated typings for:
- Dialect
- DialectInstance
- DialectDomainElement
- NodeMapping
- PropertyMapping
Updated JS Client Interface
Added missing UnionNodeMapping
- model.domain.UnionNodeMapping.this()
- model.domain.UnionNodeMapping.name()
- model.domain.UnionNodeMapping.withName()
Parse behavior normalization
A:
Person
type: AnotherPerson[]
B:
Person:
type: array
items: AnotherPerson
Are resolved in the same way now in Parse stage (before, case A were resolved in Resolve stage)
Validation Changes
Fixed behaviour with Recursive Shapes, for example the following API is now valid:
{
"swagger": "2.0",
"info": {
"title": "test",
"version": "1.1"
},
"definitions": {
"Causes": {
"$ref": "#/definitions/Test"
},
"Test": {
"properties": {
"subsenses": {
"items": {
"$ref": "#/definitions/Test"
},
"minItems": 1,
"type": "array"
}
},
"type": "object"
}
},
"paths": {}
}
And the next one invalid:
#%RAML 1.0
title: Recursive
types:
Recursive:
type: object
properties:
myP:
type: Recursive
/recursiveType:
post:
responses:
201:
body:
application/json:
type: Recursive
AMF Fixed issues
- APIMF-2068 - Issue with AMF.init()
- APIMF-2062 - Failing API because of high memory consumption
- APIMF-2056 - Out Of Memory while emitting JSON
- APIMF-2053 - AutoGeneratedName annotation is not being added for inline shapes in OAS 3.0
- APIMF-2051 - AMF does not list all payloads in tracked-element annotations
- APIMF-2033 - SE: "NamedExample" fragment causing internal error during validation
- APIMF-2015 - AMF generates invalid JSON Schema
- APIMF-1969 - Maximum call stack size exceeded error when rendering API specification
- APIMF-1957 - Warning msg is thrown when it shouldn't
- APIMF-1937 - Recursive type is emitted incorrectly when referenced
- APIMF-1921 - recursive shape is pointing to the same node shape id
- APIMF-1913 - Json-ld null pointer when reading an example in jsonld
- APIMF-1866 - multiple dependencies between schemas
- APIMF-1655 - Inconsistent behaviour with inherited recursive shape violations
- APIMF-1650 - Incorrect recursion validation in OAS
Changes in AMF 4.1.0
Interface Changes
Thread Management (JAVA only)
This version allows creating an "ExecutionEnvironment" using a Java ScheduledExecutorService. The internal AMF threads are created in the thread pool provided by that scheduler instead of the global thread pool provided by Scala. This enables implementers to handle the pool size & other tunings on their own.
The following interfaces can now receive this:
- amf.client.AMF.init()
- amf.client.AMF.platform()
- amf.client.AMF.registerDialect()
- amf.client.environment.Environment.executionEnvironment()
- amf.Core.generator()
- amf.Core.init()
- amf.Core.parser()
- amf.plugins.document.Vocabularies.registerDialect()
- amf.plugins.document.WebApi.register()
- amf.plugins.features.validation.SHACLValidator.report()
- amf.plugins.features.validation.SHACLValidator.validate()
- AnyShape.buildJsonSchema()
- AnyShape.buildRamlDatatype()
- AnyShape.parameterValidator()
- AnyShape.payloadValidator()
- AnyShape.toJsonSchema()
- AnyShape.toRamlDatatype()
- AnyShape.validate()
- AnyShape.validateParameter()
In order to build it, you have to use an "ScheduledExecutorService" in
- amf.client.execution.ExecutionEnvironment()
OperationModel
operationId was added to OperationModel
- amf.client.model.domain.Operation.operationId()
- amf.client.model.domain.Operation.withOperationId()
Validation Changes
OAS Validation with references
OAS references to external YAML files is now supported.
For example, the following api definition will now be valid:
root.yaml
swagger: "2.0"
info:
version: 1.0.0
title: Swagger Petstore
paths:
/pets:
get:
responses:
"200":
description: unexpected error
schema:
$ref: 'ref.yaml'
ref.yaml
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
AMF Fixed issues
- APIMF-2045 - Console is getting stuck with large API
- APIMF-2042 - Singularize is changing initiative into initiatife
- APIMF-2035 - Clone method does not set parser run at references
- APIMF-2032 - No error when a node name starts with / and is at paths node level (OAS 2 JSON)
- APIMF-2025 - OAS2 $ref to .yaml file is not supported
- APIMF-2024 - AMF Parser leaks memory every time an API is parsed
- APIMF-2023 - "Unresolved reference" error reported randomly
- APIMF-2016 - SE: Design Center showed "Error recursive shape" when referring Exchange Library type
- APIMF-1993 - AMF should fold from inner to outer refs
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