AMF (API Modeling Framework)

website·Indexed 33 days ago

https://a.ml/docs/

A framework for parsing, modeling, validating, and emitting API specifications. AMF supports various API specifications, JSON Schema, and GraphQL Subgraph APIs, utilizing AML (Anything Modeling Language) for defining metadata documents. The documentation covers versions 4.x.x and v5.x.x, including guides on payload validation, model resolution pipelines, and conversion goals.

Tokens
25K
Snippets
80
Records
143
Agent score
68%

What's inside AMF

  1. Introduction to AMF (AML Modeling Framework)

    AMF is an open-source library written in Scala.js used for parsing and validating AML metadata documents. It can be executed in the JVM, Node.js, or a web browser, and is available as both a standalone command-line tool and a library for Scala, Java, and JavaScript/Node.js applications.
  2. Overview of AMF Parsing capabilities

    v4

    AMF (v4.x.x) parses AML dialects and several common API specifications into a model graph. It uses SYAML to read JSON or YAML files and generate an Abstract Syntax Tree (AST), which is then converted into a BaseUnit object. This BaseUnit can be a Fragment, Module, Document, or other type, representing either a Web API model or an AML document model.

    Supported specifications include:

    • RAML 0.8 and 1.0
    • OpenAPI Specification (OAS) 2.0 and 3.0
    • AsyncAPI 2.0
  3. Overview of the AMF Custom Validator

    Starting with AMF version 5.x.x, the Custom Validation feature is no longer part of the AMF core and has been moved to a standalone project: AMF Custom Validator. The validator operates by taking AMF JSON-LD output as the data input and a Ruleset (formerly known as a Validation Profile) as the constraints to generate a validation report.
  4. Overview of Anything Modeling Language (AML)

    v4
    AML (Anything Modeling Language) is a declarative language used to define metadata documents that are parsed into graphs of information. It allows developers to describe existing YAML/JSON metadata or create new metadata formats with formal semantics, explicit schemas for validation, and support for W3C recommendations. AML documents can be published as linked data on the web or via APIs and are typically translated into JSON-LD for storage in graph databases.
  5. Overview of AMF (AML Modeling Framework)

    v4
    AMF is an open-source library written in Scala.js used for parsing and validating AML metadata documents. It allows developers to describe syntactic models (language-specific) and semantic models (industry/domain-specific), storing them in a unified data graph. AMF can be executed in the JVM, Node.js, or a browser, and is available as both a standalone CLI tool and a library for Scala, Java, and JavaScript/TypeScript applications.
  6. Overview of Anything Modeling Language (AML)

    AML (Anything Modeling Language) is a declarative language used to define metadata documents that parse into graphs of information. It allows developers to describe existing YAML/JSON metadata or define new metadata formats with formal semantics, explicit schemas for validation, and support for W3C web recommendations. AML documents can be published as APIs or linked on the web and are designed to be stored in and queried by graph databases.
  7. Overview of AML Modeling Framework (AMF)

    AMF (AML Modeling Framework) is an open-source library used to parse, transform, validate, and render arbitrary models. It provides specialized out-of-the-box support for API models, specifically working with RAML, OAS (OpenAPI Specification), and AsyncAPI. For non-API models, users can define custom models using AML Vocabularies and Dialects.
  8. Overview of AMF model validation

    v4

    Validation in AMF 4.x.x is the process of checking if a model complies with defined constraints. Validation is performed after the model has been parsed and resolved. There are two primary types of validations:

    1. Web API validations: Programmatic constraints validated against the WebApi model. These include general validations and specification-specific validations for every API spec supported by AMF.
    2. SHACL validations: Uses Shapes Constraint Language (SHACL) to validate conditions against RDF graphs (such as the AMF Graph). This is primarily used for validating AML dialect instances.
  9. Use AMF with Apollo Federation v2

    AMF (v5.x.x) supports APIs defined as GraphQL Subgraph APIs compliant with the Apollo Federation v2 specification. To get started with Federation in AMF, use the GraphQLFederationConfiguration.
  10. Convert API specifications using AMF

    AMF supports cross-parsing and rendering of API specifications. This process involves parsing a source specification into an AMF API Contract Model and then using a 'Compatibility resolution' pipeline to adapt that model to meet the requirements of a target specification. The primary goal is to output a valid API Contract Model for the target spec while minimizing information loss.
  11. Understand AMF JSON Schema Draft 2019-09 to Draft 7 translation

    v4
    AMF 4.x.x supports parsing and emission of JSON Schema Draft 2019-09 (required for OpenAPI 3.1). However, because the underlying validators (Ajv for JS and Everit for JVM) do not support Draft 2019-09, AMF cross-emits these schemas to Draft 7 for validation purposes. This translation may result in different schema paths in error messages compared to the original Draft 2019-09 schema.
  12. Use AVRO Schemas in AMF

    AMF v5.x.x supports the AVRO Schema 1.9.0 specification. AVRO schemas are supported in two primary contexts:

    1. Standalone Documents: Defined as .json or .avsc files. These require the use of AvroConfiguration and the AvroSchemaDocument type for parsing.
    2. AsyncAPI Message Payloads: Supported inline or via $ref within a message payload. The schemaFormat key must be explicitly declared to specify the AVRO payload version.

    Unsupported: AVRO Schemas are NOT supported inside the components/schemas section of an AsyncAPI document because AMF cannot reliably determine the schema type in that location.