Releases: aml-org/amf
Changes in 4.7.4
Lexical information optimization
Additions and corrections were made on the lexical information
Interface Changes
NullSecurity annotation exposed in ParametrizedSecurityScheme
There is a new method in ParametrizedSecurityScheme to check if a security scheme is null and not "null".
Added
- amf.client.model.domain.ParametrizedSecurityScheme.hasNullSecurityScheme(..)
AMF Fixed issues
APIMF-3129 - Examples field with empty object causes exception
APIMF-3127 - Error with numeric names in traits
APIMF-3115 - AMF fails to parse DiscriminatorValueMapping nodes in JSON-LD
APIMF-3061 - RAML datetime-only validation doesn't check year with 5 digitals
APIMF-3020 - Unable to use amf.js as an ES module due to bad syntax Github Issue #888
APIMF-2601 - Improve/add annotations tests for AsyncApi 2.0
APIMF-2600 - Improve/add annotations tests for OAS 3.0
APIMF-2599 - Improve/add annotations tests for OAS 2.0
APIMF-2597 - Improve/add annotations tests for RAML 0.8
APIMF-2566 - Improve/add annotations tests for RAML 1.0
APIMF-3120 - Provide way to access NullSecurity annotation from client
Changes in 4.7.3-1
OAS 3.0 discriminator mappings
Node shapes parsed from OAS 3.0 schemas which define a mapping
for the discriminator
facet now have a new field called DiscriminatorValueMapping
field that holds the relation discriminator value with the corresponding parsed target for that discriminator value.
AMF Fixed issues
APIMF-3062 - Invalid discriminator mapping values result in violation and NPE
APIMF-3060 - Release Bug: Error resolving paths in RAML08
APIMF-3059 - Release Fix - !include with spaces not being resolved
APIMF-3057 - Content.stream is not accesible
APIMF-3045 - Analyze performance of slow API in API Designer
APIMF-3034 - Fix resolution for self-encoded dialect instances
APIMF-3033 - Support cyclic reference parsing in AMF Flattened JSON-LD parser
APIMF-3023 - AMF provides wrong path to the provided resource loader
APIMF-2988 - Recursive shape inexistent fixpoints analysis
APIMF-2987 - Incorrect fix point value in RecursiveShape
APIMF-2980 - Refactor constraints validation plugins to support all contraints
APIMF-2966 - Oas Type Parsing with nullable as single map entry creates a UnionShape
APIMF-2963 - Implement: parsing plugin dependencies
APIMF-2944 - Unify creation of enum validation candidates in payload validation
APIMF-2920 - Link referenced Shape by JSON pointer in OAS 3 Discriminator mapping
APIMF-2909 - Move Dialect indexation to new plugins logic
APIMF-2901 - Debug Windows issue during resolution
APIMF-2601 - Improve/add annotations tests for AsyncApi 2.0
Changes in 4.7.2
AMF Fixed issues
APIMF-2461 - Declares node is not being emitted in some Dialect Instances although present in JSON-LD
APIMF-2986 - UrlShorteningStage not applied to RecursiveShape fix point in external library
APIMF-3005 - Parse allowMultiple property mappings with single elements in JSON-LD
APIMF-2962 - JSON-LD parsing with AMF GraphParser is slower than Jena + RDF model parser
APIMF-2930 - Tracked Element annotation is not being rendered for RDF
APIMF-2954 - Compatibility Pipeline OAS to RAML is not resolving mediatypes
APIMF-2876 - Duplicated id: query and header parameters in RAML 1.0
APIMF-2934 - Nillable shorthand types don't work in parameters
APIMF-2890 - Analyze support for linking RecursiveShape when parsing
APIMF-2965 - Invalid nodes in unions are not validated
APIMF-2600 - Improve/add annotations tests for OAS 3.0
APIMF-2943 - Analyze reconstruction of MutRef when emitting DataNode
Changes in 4.7.1
Model changes (AMF model version from 2.4.0 to 3.0.0)
Fixed IRI clash between Server,Operation,Message and ChannelBindings's binding field and:
- OperationModel -> Bindings
- EndpointModel -> Bindings
- ServerModel -> Bindings
- MessageModel -> Bindings
The iri for the Server,Operation,Message and ChannelBindings "binding" field was changed from http://a.ml/vocabularies/apiBinding#binding to http://a.ml/vocabularies/apiBinding#bindings
Adjust error messages in JVM validation associated to decimal values
In the previous release of AMF (4.7.0) our json schema library was updated generating certain differences in our messages for payload validations. More specifically, as all decimal values are now parsed as BigDecimals, this was reflected in messages of the following type:
previous to 4.7.0 - expected type: Integer, found: Double
4.7.0 - expected type: Integer, found: BigDecimal
In this release a minor fix was made to maintain our old messages, as they are more clear for the end user and abstract away implementation specific terminology.
AMF Fixed issues
APIMF-2929 - Adjust error messages in JVM validation associated to decimal values
APIMF-2902 - Payload validation ignores text at the right of the main JSON flow
APIMF-2897 - $ref not resolved in operationTraits defined in components
APIMF-2854 - Implement: JSON-LD encoded URI's checker for internal testing
APIMF-2853 - Analysis: Compatibility pipeline should convert non-used declarations
APIMF-2829 - StackOverflow on fromNativeRdfModel
APIMF-2376 - AMF invalid validation with object payloads inside enum
APIMF-2264 - Do not throw validations when merging inferred nodes
APIMF-2105 - IRI ApiContract + binding is used for fields of different type.
Changes in 4.7.0
Model changes (AMF model version from 2.3.0 to 2.4.0)
CustomDomainProperties were added to Module.
Paths Refactor
We made some internal changes in the methods that we use to normalize and resolve paths and URIs. This refactor will bring more consistency and robustness when managing paths and URIs.
RAML 1.0 - Fixed parsing of inlined raw external schema wrappers
Before, external type wrapper facets were involuntarily overriden if the inlined schema defined the same facet.
For example:
A:
description: an inlined json schema
examples:
test:
input: "my string"
type: |
{
"$schema": "http://json-schema.org/draft-03/schema",
"properties": {
"input": {
"required": false,
"type": "string"
}
},
"description": "Inner description",
"required": false,
"type": "object"
}
In the example, type A defines a wrapper for the inlined JSON Schema. Before, the inlined type overrode some of the facets of type A like "description. Querying the "description" facet of A would yield "inner description", not "an inlined json schema".
Now, the inlined JSON Schema is parsed as an inheritance to type A, thus maintaining A's own facets intact. Querying the new A's "description" facet will now yield "an inlined json schema". This applies to all the fields that are allowed in type wrappers as defined by the spec.
Interface Changes
CustomDomainProperties (annotations) in Module
A new CustomizableElement interface was created defining common CustomDomainProperties getter and setter methods which where defined in DomainElement. Module and DomainElement now extends this interface.
Added
- amf.client.model.document.Module.customDomainProperties(..)
- amf.client.model.document.Module.withCustomDomainProperties(..)
Generic Parse Method
A new method of generic parser was added to the CoreWrapper client interface.
Added
- amf.client.CoreWrapper.parser(..)
Dependencies Changes
Updated
- com.github.everit-org.json-schema % org.everit.json.schema moved from 1.9.2 to 1.12.2
- org.json % json moved from 20180130 to 20201115
AMF Fixed issues
APIMF-2875 - Can't parse JSON-LD from a RAML Extension
APIMF-2873 - Delta: Everit exception with $ref in adittionalProperties
APIMF-2862 - '$ref' key must be validated in operation object
APIMF-2852 - JSON-LD parser resolves non-relative URIs
APIMF-2845 - Implement: custom types support
APIMF-2814 - Validation not working OK with 16 digit number
APIMF-2811 - Review custom thread pool usage
APIMF-2810 - High memory consumption/timeout at transforming time
APIMF-2805 - Custom resource loader not working in JS
APIMF-2799 - Custom Validation with SPARQL query is not working in JS Github Issue #790
APIMF-2797 - Analyze SBT API to obtain sources path from source dependencies
APIMF-2790 - Operation node method is overriden by trait
APIMF-2789 - Automatic JSON-LD context generation for AML
APIMF-2786 - Analyze performance fixes for forked repository of SHACL
APIMF-2777 - Initial analysis on node parsers indexation
APIMF-2769 - Annotations in root level of RAML library are missing Github Issue #779
APIMF-2763 - PoC to unify resolve methods in amf.core.Context and WebApiContext
APIMF-2759 - Performance improvement: improve performance of new AstIndexBuilder to match or improve JsonSchemaAstIndex's.
APIMF-2732 - No way to distinguish inline Json Schema from Raml type
APIMF-2723 - Spaces are not being encoded for jsonld
APIMF-2722 - Error with canonical transformation for async api
APIMF-2721 - Analyze: @types publication in Plugin
APIMF-2719 - Analyze Scala's reflection capabilities to avoid depending entirely on parsing
APIMF-2716 - Analyze implementation feasibility for typings cases with Scalameta
APIMF-2711 - Analysis/Profiling/Debugging Performance: Custom validation takes more than 2 minutes
APIMF-2684 - Missing closed shape for json schema draft versions
APIMF-2607 - Wrong range in RAML example inclusion
APIMF-2241 - Float is getting validated as Long
APIMF-1994 - AnyShape facet validation makes rendering throw exception
APIMF-1796 - Missing validation for additionalProperties facet
Changes in 4.6.0
Interface Changes
Payload and parameter validator for RecursiveShape
A new ValidatorAware interface was created defining common payload and parameter validation methods which where defined in AnyShape. RecursiveShape now extends this interface.
Added
- amf.client.model.domain.RecursiveShape.payloadValidator(..)
- amf.client.model.domain.RecursiveShape.parameterValidator(..)
Dependencies Changes
Updated
- com.fasterxml.jackson.core % jackson-databind moved from 2.10.1 to 2.11.0
Removed
- org.topbraid % shacl 1.3.0
AMF Fixed issues
APIMF-2768 - Many SYAML conversions produce Exception instead of being accumulated in the ErrorHandler
APIMF-2765 - Analyze and remove unused dependencies
APIMF-2760 - Not being able to get validator from recursive shape
APIMF-2749 - Id lost with Query String
APIMF-2735 - SE: Unexpected key 'anyOf' when convert OAS with "nullable" field to RAML
APIMF-2733 - integrate stg.a.ml landing to our docs
APIMF-2770 - Integrate new stg.a.ml changes to our docs
APIMF-2712 - Syntax error in included file is duplicated when applied on resourcetype/traits
APIMF-2686 - Analysis for update jackson databind version to 2.11.x
APIMF-2588 - Wrong required value in header due to duplicate id
Changes in 4.5.1
Model changes (AMF model version 2.2.0 -> 2.3.0)
PropertySource and PropertyTarget properties in the AMF model where modified from Uri to String.
In JSON Schema definitions which use the dependencies
facet, the source and target of such dependencies were stored in the graph as Uri references to the parsed properties. Now the graph stores the raw names of such properties (as defined in the JSON Schema) rather than the ID of the parsed properties.
New Features
JSON parsing recovery
- More entries saved in case or error
- Some optimizations in SYAML JSON parser enables AMF to recover from JSON syntax errors and parse parts of a JSON file.
This translates into more entries in the model in case of syntax error and more precise error messages. - Multiline JSON strings now are validated
- According to the JSON definition, a line break in a JSON string MUST be escaped ('\n').
This was not working correctly in some cases but now a syntax error will be shown in case of a line break in a string.
JSON Schema 2019
AMF can now parse and emit JSON Schema 2019 referenced in other specs.
Caveats
- We are still waiting for validator support for JSON Schema 2019. Therefore, AMF Shapes containing fields of said draft that are incompatible with draft-7 will not be used in validation. A warning will be emitted for each incompatible field. The incompatible fields are:
- unevaluatedProperties
- unevaluatedItems
- minContains
- maxContains
Interface Changes
AML Links
Added
- amf.client.model.domain.Scope.isExternalLink(..)
- amf.client.model.domain.Scope.withIsExternalLink(..)
- amf.client.model.domain.CreativeWork.isExternalLink(..)
- amf.client.model.domain.CreativeWork.withIsExternalLink(..)
- amf.client.model.domain.MqttOperationBinding.isExternalLink(..)
- amf.client.model.domain.MqttOperationBinding.withIsExternalLink(..)
- amf.client.model.domain.CustomDomainProperty.isExternalLink(..)
- amf.client.model.domain.CustomDomainProperty.withIsExternalLink(..)
- amf.client.model.domain.ParametrizedSecurityScheme.isExternalLink(..)
- amf.client.model.domain.ParametrizedSecurityScheme.withIsExternalLink(..)
- amf.client.model.domain.Example.isExternalLink(..)
- amf.client.model.domain.Example.withIsExternalLink(..)
- amf.client.model.domain.MqttMessageBinding.isExternalLink(..)
- amf.client.model.domain.MqttMessageBinding.withIsExternalLink(..)
- amf.client.model.domain.MessageBindings.isExternalLink(..)
- amf.client.model.domain.MessageBindings.withIsExternalLink(..)
- amf.client.model.domain.Callback.isExternalLink(..)
- amf.client.model.domain.Callback.withIsExternalLink(..)
- amf.client.model.domain.ParametrizedTrait.isExternalLink(..)
- amf.client.model.domain.ParametrizedTrait.withIsExternalLink(..)
- amf.client.model.domain.Amqp091OperationBinding.isExternalLink(..)
- amf.client.model.domain.Amqp091OperationBinding.withIsExternalLink(..)
- amf.client.model.domain.KafkaOperationBinding.isExternalLink(..)
- amf.client.model.domain.KafkaOperationBinding.withIsExternalLink(..)
- amf.client.model.domain.ResourceType.isExternalLink(..)
- amf.client.model.domain.ResourceType.withIsExternalLink(..)
- amf.client.model.domain.NodeShape.isExternalLink(..)
- amf.client.model.domain.NodeShape.withIsExternalLink(..)
- amf.client.model.domain.WebApi.isExternalLink(..)
- amf.client.model.domain.WebApi.withIsExternalLink(..)
- amf.client.model.domain.TemplatedLink.isExternalLink(..)
- amf.client.model.domain.TemplatedLink.withIsExternalLink(..)
- amf.client.model.domain.SchemaShape.isExternalLink(..)
- amf.client.model.domain.SchemaShape.withIsExternalLink(..)
- amf.client.model.domain.ServerBindings.isExternalLink(..)
- amf.client.model.domain.ServerBindings.withIsExternalLink(..)
- amf.client.model.domain.KafkaMessageBinding.isExternalLink(..)
- amf.client.model.domain.KafkaMessageBinding.withIsExternalLink(..)
- amf.client.model.domain.HttpMessageBinding.isExternalLink(..)
- amf.client.model.domain.HttpMessageBinding.withIsExternalLink(..)
- amf.client.model.domain.ParametrizedDeclaration.isExternalLink(..)
- amf.client.model.domain.ParametrizedDeclaration.withIsExternalLink(..)
- amf.client.model.domain.Operation.isExternalLink(..)
- amf.client.model.domain.Operation.withIsExternalLink(..)
- amf.client.model.domain.Amqp091MessageBinding.isExternalLink(..)
- amf.client.model.domain.Amqp091MessageBinding.withIsExternalLink(..)
- amf.client.model.domain.SecurityRequirement.isExternalLink(..)
- amf.client.model.domain.SecurityRequirement.withIsExternalLink(..)
- amf.client.model.domain.Settings.isExternalLink(..)
- amf.client.model.domain.Settings.withIsExternalLink(..)
- amf.client.model.domain.VariableValue.isExternalLink(..)
- amf.client.model.domain.VariableValue.withIsExternalLink(..)
- amf.client.model.domain.DialectDomainElement.isExternalLink(..)
- amf.client.model.domain.DialectDomainElement.withIsExternalLink(..)
- amf.client.model.domain.MqttServerBinding.isExternalLink(..)
- amf.client.model.domain.MqttServerBinding.withIsExternalLink(..)
- amf.client.model.domain.OAuth2Flow.isExternalLink(..)
- amf.client.model.domain.OAuth2Flow.withIsExternalLink(..)
- amf.client.model.domain.MqttServerLastWill.isExternalLink(..)
- amf.client.model.domain.MqttServerLastWill.withIsExternalLink(..)
- amf.client.model.domain.HttpOperationBinding.isExternalLink(..)
- amf.client.model.domain.HttpOperationBinding.withIsExternalLink(..)
- amf.client.model.domain.Amqp091ChannelBinding.isExternalLink(..)
- amf.client.model.domain.Amqp091ChannelBinding.withIsExternalLink(..)
- amf.client.model.domain.Response.isExternalLink(..)
- amf.client.model.domain.Response.withIsExternalLink(..)
- amf.client.model.domain.MatrixShape.isExternalLink(..)
- amf.client.model.domain.MatrixShape.withIsExternalLink(..)
- amf.client.model.domain.TupleShape.isExternalLink(..)
- amf.client.model.domain.TupleShape.withIsExternalLink(..)
- amf.client.model.domain.XMLSerializer.isExternalLink(..)
- amf.client.model.domain.XMLSerializer.withIsExternalLink(..)
- amf.client.model.domain.Parameter.isExternalLink(..)
- amf.client.model.domain.Parameter.withIsExternalLink(..)
- amf.client.model.domain.ArrayShape.isExternalLink(..)
- amf.client.model.domain.ArrayShape.withIsExternalLink(..)
- amf.client.model.domain.NodeMapping.isExternalLink(..)
- amf.client.model.domain.NodeMapping.withIsExternalLink(..)
- amf.client.model.domain.PropertyDependencies.isExternalLink(..)
- amf.client.model.domain.PropertyDependencies.withIsExternalLink(..)
- amf.client.model.domain.License.isExternalLink(..)
- amf.client.model.domain.License.withIsExternalLink(..)
- amf.client.model.domain.DataNode.isExternalLink(..)
- amf.client.model.domain.DataNode.withIsExternalLink(..)
- amf.client.model.domain.FileShape.isExternalLink(..)
- amf.client.model.domain.FileShape.withIsExternalLink(..)
- amf.client.model.domain.DomainExtension.isExternalLink(..)
- amf.client.model.domain.DomainExtension.withIsExternalLink(..)
- amf.client.model.domain.EndPoint.isExternalLink(..)
- amf.client.model.domain.EndPoint.withIsExternalLink(..)
- amf.client.model.domain.PropertyShape.isExternalLink(..)
- amf.client.model.domain.PropertyShape.withIsExternalLink(..)
- amf.client.model.domain.ClassTerm.isExternalLink(..)
- amf.client.model.domain.ClassTerm.withIsExternalLink(..)
- amf.client.model.domain.AbstractDeclaration.isExternalLink(..)
- amf.client.model.domain.AbstractDeclaration.withIsExternalLink(..)
- amf.client.model.domain.Message.isExternalLink(..)
- amf.client.model.domain.Message.withIsExternalLink(..)
- amf.client.model.domain.ObjectNode.isExternalLink(..)
- amf.client.model.domain.ObjectNode.withIsExternalLink(..)
- amf.client.model.domain.DataArrangeShape.isExternalLink(..)
- amf.client.model.domain.DataArrangeShape.withIsExternalLink(..)
- amf.client.model.domain.WebSocketsChannelBinding.isExternalLink(..)
- amf.client.model.domain.WebSocketsChannelBinding.withIsExternalLink(..)
- amf.client.model.domain.UnionShape.isExternalLink(..)
- amf.client.model.domain.UnionShape.withIsExternalLink(..)
- amf.client.model.domain.ShapeExtension.isExternalLink(..)
- amf.client.model.domain.ShapeExtension.withIsExternalLink(..)
- amf.client.model.domain.ExternalDomainElement.isExternalLink(..)
- amf.client.model.domain.ExternalDomainElement.withIsExternalLink(..)
- amf.client.model.domain.Organization.isExternalLink(..)
- amf.client.model.domain.Organization.withIsExternalLink(..)
- amf.client.model.domain.Request.isExternalLink(..)
- amf.client.model.domain.Request.withIsExternalLink(..)
- amf.client.model.domain.AnyShape.isExternalLink(..)
- amf.client.model.domain.AnyShape.withIsExternalLink(..)
- amf.client.model.domain.Encoding.isExternalLink(..)
- amf.client.model.domain.Encoding.withIsExternalLink(..)
- amf.client.model.domain.PropertyMapping.externallyLinkable(..)
- amf.client.model.domain.PropertyMapping.isExternalLink(..)
- amf.client.model.domain.PropertyMapping.withExternallyLinkable(..)
- amf.client.model.domain.PropertyMapping.withIsExternalLink(..)
- amf.client.model.domain.RecursiveShape.isExternalLink(..)
- amf.client.model.domain.RecursiveShape.withIsExternalLink(..)
- amf.client.model.domain.Server.isExternalLink(..)
- amf.client.model.domain.Server.withIsExternalLink(..)
- amf.client.model.domain.SecurityScheme.isExternalLink(..)
- amf.client.model.domain.SecurityScheme.withIsExternalLink(..)
- amf.client.model.domain.OperationBindings.isExternalLink(..)
- amf.client.model.domain.OperationBindings.withIsExternalLink(..)
- amf...
Changes in 4.5.0
New Features
AsyncAPI 2.0 final release
We are releasing AsyncAPI 2.0 to GA! All previous updates had the beta
tag. Now it's finally here!
New domain element emitters
Two interfaces have been added to the public interface that allow users to render individual elements parsed by AMF. The output of the emission is stored in the provided document builder.
amf.client.render.WebApiDomainElementEmitter
For webapi elements, the vendor of the specific web api spec must be provided.
emitToBuilder[T](element: DomainElement,
emissionStructure: Vendor,
eh: ClientErrorHandler,
builder: DocBuilder[T]): Unit
amf.client.render.AmlDomainElementEmitter
For the case of AML elements, current only DialectDomainElement's are handled. The Dialect from which the element was parsed must be provided.
emitToBuilder[T](element: DomainElement,
emissionStructure: Dialect,
eh: ClientErrorHandler,
builder: DocBuilder[T]): Unit
Interface Changes
JSON Schema draft 2019 (beta)
Added
- amf.core.remote.Vendor.JSONSCHEMA(..)
- amf.client.model.domain.ArrayShape.maxContains(..)
- amf.client.model.domain.ArrayShape.minContains(..)
- amf.client.model.domain.ArrayShape.unevaluatedItemsSchema(..)
- amf.client.model.domain.ArrayShape.unevaluatedItems(..)
- amf.client.model.domain.ArrayShape.withMaxContains(..)
- amf.client.model.domain.ArrayShape.withMinContains(..)
- amf.client.model.domain.ArrayShape.withUnevaluatedItemsSchema(..)
- amf.client.model.domain.ArrayShape.withUnevaluatedItems(..)
- amf.client.model.domain.NodeShape.schemaDependencies(..)
- amf.client.model.domain.NodeShape.unevaluatedPropertiesSchema(..)
- amf.client.model.domain.NodeShape.unevaluatedProperties(..)
- amf.client.model.domain.NodeShape.withSchemaDependencies(..)
- amf.client.model.domain.NodeShape.withUnevaluatedPropertiesSchema(..)
- amf.client.model.domain.NodeShape.withUnevaluatedProperties(..)
- amf.client.model.domain.WebApi.copy(..)
- amf.client.model.domain.ScalarShape.encoding(..)
- amf.client.model.domain.ScalarShape.mediaType(..)
- amf.client.model.domain.ScalarShape.schema(..)
- amf.client.model.domain.ScalarShape.withEncoding(..)
- amf.client.model.domain.ScalarShape.withMediaType(..)
- amf.client.model.domain.ScalarShape.withSchema(..)
- amf.client.model.domain.MatrixShape.maxContains(..)
- amf.client.model.domain.MatrixShape.minContains(..)
- amf.client.model.domain.MatrixShape.unevaluatedItemsSchema(..)
- amf.client.model.domain.MatrixShape.unevaluatedItems(..)
- amf.client.model.domain.MatrixShape.withMaxContains(..)
- amf.client.model.domain.MatrixShape.withMinContains(..)
- amf.client.model.domain.MatrixShape.withUnevaluatedItemsSchema(..)
- amf.client.model.domain.MatrixShape.withUnevaluatedItems(..)
Async (GA release!)
Added
- amf.client.model.domain.Message.headerExamples(..)
- amf.client.model.domain.Message.headerSchema(..)
- amf.client.model.domain.Message.withHeaderExamples(..)
- amf.client.model.domain.Message.withHeaderSchema(..)
- amf.client.model.domain.Response.headerExamples(..)
- amf.client.model.domain.Response.headerSchema(..)
- amf.client.model.domain.Response.withHeaderExamples(..)
- amf.client.model.domain.Response.withHeaderSchema(..)
- amf.client.model.domain.Request.headerExamples(..)
- amf.client.model.domain.Request.headerSchema(..)
- amf.client.model.domain.Request.withHeaderExamples(..)
- amf.client.model.domain.Request.withHeaderSchema(..)
Validation Changes
JSON Schema improvements
We made some improvements on JSON Schema parsing that ended in some minor validation changes.
Default JSON versions for different specs
Before, the $schema
entry of a JSON Schema object defaulted to draft-4 if it wasn't present. It was updated to use the default for each spec.
The defaults are:
- RAML 1.0, OAS 2.0 and OAS 3.0 -> Draft 4
- ASYNC API 2.0 -> Draft 7
"required" boolean facet in properties for draft 4 and up
The severity of this validation was downgraded from violation to warning. Although it throws a warning, this field will be parsed and set in the model correctly in any draft. We advise against doing so as it goes against the JSON Schema spec for draft's 4 and beyond.
This can be set to violation again in AMF's next major version.
Example of incorrect use that will result in a warning:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"property1": {
"type": "string",
"required": true
}
}
}
Non-sequence "required" key at Object level
The key required
in the root level of an object MUST be an array of strings.
In certain cases when this key wasn't an array, we ignored that key (it wasn't parsed or set in the model). Now it always will show an error if it is present and its value is not an array of strings.
Example of incorrect use that will result in an error:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"properties": {
"property1": {
"type": "string"
}
},
"required": true
}
Model Changes
API level added
Now you can differentiate between webapi and asyncapi searching apiContract:WebAPI
or apiContract:AsyncAPI
@type in the root of the encodes of your API.
Example
(...)
"doc:encodes": [
{
"@id": "#23",
"@type": [
"apiContract:AsyncAPI",
"apiContract:API",
"doc:RootDomainElement",
"doc:DomainElement"
],
(...)
AsyncAPI HeaderScheme
AsyncApi header scheme used to be modeled as a single header with a schema object. That is not correct according to the specification as it says that message header property should be a schema object in which each one of schema properties is a valid header.
In order to be complaint with the spec and respect the fact that the schema is just a way to express a group of headers, for now on we will parse that property as a new HeaderSchema field at the MessageModel that contains an Object Schema.
Message example with header identifier MUST conform against that schema in order to the AsyncApi be valid.
AMF Fixed issues
- APIMF-2679 - Async api model: add header object field at Message Object
- APIMF-2677 - Incorporate model changes to differentiate between Async Apis and WebApis
- APIMF-2668 - Enable Draft-7 Json Schema parsing for all specs
- APIMF-2620 - Analysis: JSON Schema support cross spec
- APIMF-2611 - Typings error with toJsonSchema method in AnyShape Github Issue #696
- APIMF-2606 - RAML data type fragment resolves type defined in async api
- APIMF-2596 - Recursive shape fixpoint has incorrect value
- APIMF-2593 - Implement $base directive in AML
- APIMF-2587 - High memory consumption/timeout at resolution time
- APIMF-2586 - Review Json Schema draft-8-patch-1 Github Milestone
- APIMF-2579 - Fix examples facet in async Message Object
- APIMF-2568 - SE: Missing error for invalid Security Scheme Types
- APIMF-2566 - Improve/add annotations tests for RAML 1.0
- APIMF-2558 - Create client interfaces for domain element emitters (webapi and aml)
- APIMF-2553 - Support "contentEncoding" and "contentSchema" parsing and emission.
- APIMF-2547 - Add parsing and emission of "duration" and "uuid" formats.
- APIMF-2546 - Support "unevaluatedItems" and unevaluatedProperties"
- APIMF-2545 - Support "dependentSchemas" and "dependentRequired"
- APIMF-2544 - Support "$defs" keyword instead of "definitions"
- APIMF-2536 - Missing validation on CLI for invalid reference on Resource Type usage Github Issue #637
- APIMF-2527 - Many warnings are being grouped in one single entry
- APIMF-2513 - Emission of reference for inlined elements
- APIMF-2258 - core.Vendor constants are not exported to JS Github Issue #372
- APIMF-2187 - Method toRamlDatatype produces invalid date type format Github Issue #358
- APIMF-1865 - Valid recursive scheme returns "Error recursive shape"
Changes in 4.4.0
AML 5.0.x adopted
This release adopts AML 5.0.x
. This AML release includes an amf-validation
module split which is now part of the AML project.
For amf-client
/amf-webapi
adopters there is no action required to adopt these change unless you are manually initializing validation.
All the datails in: AML 5.0.x release notes
Interface Changes
OAS Compacted Emission
New parameter in client interface RenderOptions to disable compact emission in OAS (2.0 and 3.0)
Added
- amf.client.render.RenderOptions.isWithCompactedEmission
- amf.client.render.RenderOptions.withCompactedEmission
AsyncAPI (still beta) updated kafka bindings
Changed
- amf.client.model.domain.KafkaMessageBinding.messageKey(..) changed its return type from amf.core.model.StrField to amf.client.model.domain.Shape
- amf.client.model.domain.KafkaMessageBinding.withKey(..) now receives amf.client.model.domain.Shape instead of String
- amf.client.model.domain.KafkaOperationBinding.clientId(..) changed its return type from amf.client.model.StrField to amf.client.model.domain.Shape
- amf.client.model.domain.KafkaOperationBinding.groupId(..) changed its return type from amf.client.model.StrField to amf.client.model.domain.Shape
- amf.client.model.domain.KafkaOperationBinding.withClientId(..) now receives amf.client.model.domain.Shape instead of String
- amf.client.model.domain.KafkaOperationBinding.withGroupId(..) now receives amf.client.model.domain.Shape instead of String
Validation Changes
AsyncAPI (still beta) kafka operation and message binding change type value for keys 'groupId', 'clientId', and 'key'
These keys where parsed as string values, and are now defined as Schema Object's.
Kafka operation binding with modified 'groupId' and 'clientId' values:
publish:
bindings:
kafka:
groupId:
type: string
pattern: '^[\w]+\.[\w]+\.[\w]+\.[\d]+$'
clientId:
type: string
enum: ['myClientId']
Kafka message binding with modified 'key' value:
message:
bindings:
kafka:
key:
type: string
maxLength: 20
AsyncAPI (still beta) allow reference to external RAML data types
Three new mechanisms have been introduced to enable referencing RAML data types present in fragments, libraries, or external files. The ‘$ref’ facet may only be used at the root of the payload definition, and its target content must be valid structurally according to the RAML specification.
Referencing external RAML data type fragments. Relative pointer is not support for this use case.
message:
schemaFormat: application/vnd.rai.raml;version=1.0
payload:
$ref: external-data-type.raml
Referencing types present in libraries, the following fixed pointer must be used “{lib}#/types/{typeName}”.
message:
schemaFormat: application/vnd.rai.raml;version=1.0
payload:
$ref: external-library.raml#/types/User
RAML content present in external yaml files can be referenced and the use of relative json pointers may be used.
message:
schemaFormat: application/vnd.rai.raml;version=1.0
payload:
$ref: external-yaml.yaml#/nestedContent/User
Within the definition of RAML content, it is not possible to directly reference content defined in the async api. The following example is invalid as the type 'User' will result in an unresolved reference.
components:
schemas:
User:
type: string
channels:
users/signup:
subscribe:
message:
schemaFormat: application/vnd.rai.raml;version=1.0
payload:
type: User
File Order Inconsistency
We changed the way file references were added to the BaseUnit. Before, files didn't respect the order in which the API author added them. Now, the order of the files in the references() node respects the original API order. This helps keeping consistency between API parsing processes.
Note: although we make reference to "order", order is not guaranteed in AMF as AMF is a graph and graph edges don't have a specific order.
For the api:
#%RAML 1.0
types:
a: !include datatypes/a.raml
b: !include datatypes/b.raml
c: !include datatypes/c.raml
h: !include datatypes/h.raml
Before a possible json-ld with inconsistent reference order could be:
{
"doc:references": [
{
"id": "./datatypes/c.raml",
...
},
{
"id": "./datatypes/h.raml",
...
},
{
"id": "./datatypes/a.raml",
...
},
{
"id": "./datatypes/b.raml",
...
}
]
}
Now, it respects the ordering in the API:
{
"doc:references": [
{
"id": "./datatypes/a.raml",
...
},
{
"id": "./datatypes/b.raml",
...
},
{
"id": "./datatypes/c.raml",
...
},
{
"id": "./datatypes/d.raml",
...
}
]
}
AMF Fixed issues
- APIMF-2561 - Add ability to disable OAS compacted emission
- APIMF-2543 - Emitter | nodes with links are loosing the inclusion tag when emitting
- APIMF-2542 - Emitter | Node links are not rendered correctly in SecuritySchemes, Traits, ResourceTypes, AnnotationTypes
- APIMF-2541 - Remove SingleValueArray emission support for OAS spec emission
- APIMF-2512 - Example json gets parsed as Expanded JSON-LD
- APIMF-2504 - Violation when referencing types outside of raml context
- APIMF-2497 - Support $ref at root of raml payload
- APIMF-2455 - Async - AMF invalid validation for "key" inside kafka Message Binding Object
- APIMF-2453 - Implementation of flaky files possible solution
- APIMF-1651 - Limit amount of violations that are present in validation report
Changes in 4.3.1
Interface Changes
AsyncAPI (still beta) updated bindings
Deleted
- amf.client.model.domain.DynamicBinding
Added
From: [APIMF-2412 - AsyncAPI - AMF invalid validation MQTT server binding with "message" property]
- amf.client.model.domain.MqttServerLastWill.message()
Validation Changes
RAML
RAML unions
APIMF-2324 - RAML Expressions are losing shapes when uniting unions
Fixed an invalid validation under specifics conditions with unions, for example, the following API is now valid:
#%RAML 1.0
title: Secrets Provider
version: v1
baseUri: https://test.com/provider/
types:
EncryptedResponse:
type: object
properties:
encryptedKey:
type: string
sharedSecretUsernamePassword:
type: object
properties:
username:
type: string
sharedSecretSymmetricKey:
type: object
properties:
key:
type: string
SharedSecret: sharedSecretUsernamePassword | sharedSecretSymmetricKey
/path:
get:
responses:
200:
body:
application/json:
type: SharedSecret | EncryptedResponse
examples:
encrypted: |
{
"encryptedKey": "encryptedKey",
"cipherText": "cipherText"
}
RAML version base URI parameter
APIMF-2415 - Missing validations of the "version" reserved base URI parameter
Added validation for missing version definition for baseUri, for example, the following API is now invalid:
#%RAML 1.0
title: Brown Google Admin Directory API
baseUri: https://localhost/services/cis/brown-google-admin-directory-api/v{version}
AsyncAPI (still beta)
Async components invalid names
APIMF-2451 - Async - Missing validation for component objects naming
Added validation for invalid component names, for example, the following component definition is now invalid:
asyncapi: 2.0.0
info:
title: title
version: 0.1.0
components:
schemas:
inval#d:
type: object
Async examples structure
APIMF-2476 - Async - AMF Validation "examples" facet should be handled as JSON Schema, not OAS 3
Examples validation for Message Object were modified from a [Map[string
, any
]] to [any
] & correspondent for the value for the schema specified in "payload".
For example the following api is now invalid:
channels:
/user/signedup:
subscribe:
message:
payload:
type: object
properties:
email:
type: string
format: email
examples:
- one:
email: [email protected]
This one becomes valid:
channels:
/user/signedup:
subscribe:
message:
payload:
type: object
properties:
email:
type: string
format: email
examples:
- email: [email protected]
AMF Fixed issues
- APIMF-2515 - Add lexical information on invalid AML Dialects
- APIMF-2507 - Keep empty maps in Dialect instances
- APIMF-2469 - Error 500 when convert raml to oas
- APIMF-2415 - Missing validations of the "version" reserved base URI parameter
- APIMF-2408 - Slow performance when handling large amount of validations
- APIMF-2400 - \n is valid in integer value
- APIMF-2387 - AMF Flattened render produce invalid JSON-LD
- APIMF-2369 - No warning messages are thrown for a JSON file that has duplicate keys
- APIMF-2357 - Unresolved reference in amf-service using paths with './' in JSON refs
- APIMF-2324 - RAML Expressions are loosing shapes when uniting unions
- APIMF-2323 - RAML Expressions are using duplicated ID in generated links
- APIMF-2174 - Not validating that RAML 1.0 documentation must not have empty strings in its attributes. Github Issue #349
- APIMF-1975 - schema' field is required in a body parameter
- APIMF-1962 - Check closed-shape validation in objects
- APIMF-1960 - missing "items" field validation inside parameter object
- APIMF-1880 - RAML 10 - Using invalid allowed targets doesnt trigger validation