View mappings

Let's now take a look at the mappings between units on the pipeline we just created. Notice Xapix created three units on a pipeline:

  • Request unit

  • Data source unit

  • Endpoint unit.

Attributes in one unit are mapped to parameters in a second unit. We will look at the mappings in each of the three units.

Request unit

First, let's open the Mapping editor for the Request unit by clicking on the unit. Notice it already has a value 547290 for the property engine_id. It took this property from the data source. Hover over the property value, then click Edit Data Sample to open the Formula editor.

The Formula editor is used to enter and validate value. You can enter complex formulas using strings, numbers, Boolean values, Axel-f functions and more.

For now, we leave it as the default integer value 547290.

The default value is taken from the OpenAPI 2.0 swagger file for this tutorial.

parameters:
- name: engine_id
in: path
description: Car engine ID.
required: true
type: integer
example: 547290

Click Done to close the Mapping editor.

Data source unit

Click the findEngineById data source unit to open the Mapping editor. Xapix mapped attributes in the Request unit to path parameters in the data source. Notice two columns. On the left is the source unit while on the right is the parameters for selected data source.

Hover over the value for the parameter engine_id on the right-hand side (the data source) This opens a preview of the formula used to generate the value of the parameter. Notice Xapix used the path .request.path.engine_id to map the engine_id attribute to the respective parameter in the data source.

Mapping between the Request unit and the data source unit

Click Done to close the Mapping editor.

Notice the attribute engine_id in the Request unit is not editable. Only parameters can be edited. This is explained in Attributes and parameters in Mapping dashboard.

Endpoint unit

Click the Endpoint unit to open the Mapping editor. Xapix automatically mapped attributes in the data source to parameters in the endpoint. On the left are the attributes of findEngineById while on the right are the endpoint parameters. The lines indicated mappings between attributes and parameters.

Xapix created mappings between the attributes fuel_type, manufacturer, power_hp and price to body parameters in the endpoint. For example, Xapix mapped the engine price using .findenginebyid.body.price.

Mapping between the data source unit and the endpoint

Click Done to close the Mapping editor. We are now ready to publish the project and test the endpoint.

Next step
Next step

To continue, see Publish the project.