Working with other API specs
Language Interoperability
Overview
Taxi is designed to work alongside your existing schema languages and API specifications rather than replace them. By adding semantic metadata to your existing specs, you create a semantic layer that connects data across different systems and formats.
Enhancement, Not Replacement
Supported Formats
OpenAPI/Swagger
Add semantic types to your REST APIs using x-taxi-type
extensions:
paths:
/customers/{id}:
get:
parameters:
- name: id
schema:
type: string
x-taxi-type:
name: acme.CustomerId
Protocol Buffers
Enhance protocol buffer messages using the taxi.dataType
extension:
message Customer {
optional string id = 1 [(taxi.dataType)="acme.CustomerId"];
optional string email = 2 [(taxi.dataType)="acme.EmailAddress"];
}
Avro
Add semantic meaning to Avro schemas via the taxi.dataType
attribute:
{
"type": "record",
"name": "Customer",
"fields": [
{
"name": "id",
"type": "string",
"taxi.dataType": "acme.CustomerId"
}
]
}
SOAP/WSDL
Enhance SOAP services using the taxi:type
attribute:
<xs:element name="GetCustomerRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="customerId" type="xs:string"
> taxi:type="acme.CustomerId"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Data Formats
Taxi also provides annotations for common data formats.
Taxi includes annotations for common data formats like CSV and XML, enabling schema definitions for formats that may not have formal specifications.
While Taxi defines these formats, the actual reading and writing of data is handled by TaxiQL query engines, such as Orbital
CSV
@Csv(delimiter = "|")
model CustomerExport {
id: CustomerId
email: EmailAddress
}
XML
@Xml
model CustomerImport {
@XmlAttribute
id: CustomerId
email: EmailAddress
}