We now announce support in API Transformer for API components that have no specific type or in other words are said to have any
type. Until now, a default type (string
/object
) was assumed for all such cases.
What's New?
Upon transformation of API description files containing components using any
type, you can now expect the following changes:
JSON schema allows skipping
type
information to indicate that the schema has no fixed type. This is supported by all API description formats that make use of JSON schema whether as a subset or directly, including OpenAPI (v2.0
,v3.x
), RAML (v0.8
,v1.0
), API Blueprint, etc. In APIMatic, all such cases were exported with a default type assumed asobject
but will now be exported with typeany
. A few exceptions to this behavior include the following:- For OpenAPI
v3.x
parameter import, the default type for an empty schema was assumed asstring
but will now be imported/exported asany
. See an example of such a parameter below:
"paths": {
"/message": {
"get": {
"parameters": [
{
"name": "value",
"schema": {
},
"in": "query"
}
]
}
}
}- For OpenAPI
v3.1
form parameters, an empty schema will still be imported/exported as a file type schema as per the rules defined here.
- For OpenAPI
RAML
v1.0
has an explicitany
type which until now was exported as typeobject
but will now be exported as typeany
.For XML schema export (relevant to export of WSDL and WADL), both
object
(one with no explicit property declarations) andany
types were exported with the native typexsd:anyType
. However, now theobject
type will be exported as a complex type containing<xsd:any>
as a sequence element which allows extending the schema with elements not explicitly declared. An example is given below:Before:
<xsd:element name="value" type="xsd:anyType"/>
Now:
<xsd:element name="value">
<xsd:complexType>
<xsd:sequence>
<xsd:any/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
How to Avoid Changes in Output?
If you want to avoid any kind of changes to output that are discussed in the previous section, you will need to upload a metadata file along with your API description file with the following configuration settings:
- An export setting
ExportAnyType
set tofalse
. - If you are using OpenAPI
v3
, especially with parameters having empty schemas (excluding form parameters), you will need an additional import settingImportOpenApi3EmptySchema
set tofalse
as well.
Example:
{
"ImportSettings": {
"ImportOpenApi3EmptySchema": false
},
"ExportSettings": {
"ExportAnyType": false
}
}