Skip to main content
Version: AMF v5.x.x

Transformation

'Transformation' is the process of applying incremental transformations to the AMF semantic graph model. AMF provides several 'transformation pipelines'. The base pipeline comprises the following stages:

resolution pipeline

Transformation allows you to flatten and simplify the AMF semantic graph model by:

  • Resolving links and inheritances
  • Applying RAML traits and resourceTypes
  • Normalization of shapes and parameters

You'll also find these pipelines are important when converting from one API specification to another. For example, when converting a RAML API to OAS the 'Compatibility' pipeline makes changes to the API Contract Model to have a valid, OAS-compliant API.

Pipelines

Depending on your needs, you can use one of the following AMF provided transformation pipelines:

  • Default
    • Keeps only the parsed graph model and deletes all information no longer relevant, such as document.declares
  • Editing
    • Keeps all information in already parsed nodes, such as the source and the declarations
    • Use when someone is editing the API, such as an interactive API designer that uses AMF in the background
  • Compatibility
    • Must be used when converting an API to a different specification
    • Includes additional AMF-specific information to aid in specification conversion
    • You can find more information about this in the Conversion documentation.

Transformation examples


Code extracted from the examples GitHub repository.

Custom pipelines

You may also implement your own pipelines, see the example in the code snippet: How to create a Transformation Pipeline.