Convert Figma logo to code with AI

raml-org logoraml-spec

RAML Specification

3,867
858
3,867
226

Top Related Projects

The OpenAPI Specification Repository

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API

API Blueprint

4,104

The AsyncAPI specification allows you to create machine-readable definitions of your asynchronous APIs.

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v3.1, v3.0, and v2.0 as well as AsyncAPI v2.x.

Quick Overview

The raml-org/raml-spec repository contains the official specification for RAML (RESTful API Modeling Language). RAML is a YAML-based language for describing RESTful APIs, allowing developers to define API structures, endpoints, request/response formats, and more. This repository serves as the central location for the RAML specification, its versions, and related documentation.

Pros

  • Provides a standardized, human-readable format for API documentation
  • Supports code generation and API mocking based on the specification
  • Enables better collaboration between API designers, developers, and consumers
  • Offers a wide range of tooling support due to its popularity in the API community

Cons

  • Learning curve for those unfamiliar with YAML or API specification languages
  • May require additional tools or plugins for full functionality in development environments
  • Some developers prefer alternative API specification formats like OpenAPI (Swagger)
  • Maintaining large RAML files can become complex for extensive APIs

Getting Started

To start using RAML for your API documentation:

  1. Familiarize yourself with the RAML specification at https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md

  2. Create a new file with a .raml extension (e.g., api.raml)

  3. Begin your RAML document with the RAML version declaration and basic API information:

#%RAML 1.0
title: My API
version: v1
baseUri: https://api.example.com/{version}
  1. Define your API endpoints, methods, and responses:
/users:
  get:
    description: Retrieve a list of users
    responses:
      200:
        body:
          application/json:
            example: |
              {
                "users": [
                  {"id": 1, "name": "John Doe"},
                  {"id": 2, "name": "Jane Smith"}
                ]
              }
  1. Use RAML tools like API designers, documentation generators, or code generators to work with your RAML files and integrate them into your development workflow.

Competitor Comparisons

The OpenAPI Specification Repository

Pros of OpenAPI-Specification

  • Wider industry adoption and tooling support
  • JSON/YAML format is more familiar to developers
  • Supports more detailed request/response modeling

Cons of OpenAPI-Specification

  • More verbose syntax compared to RAML
  • Steeper learning curve for beginners
  • Less focus on reusability and modularity

Code Comparison

RAML example:

#%RAML 1.0
title: Example API
/users:
  get:
    responses:
      200:
        body:
          application/json:
            type: User[]

OpenAPI example:

openapi: 3.0.0
info:
  title: Example API
paths:
  /users:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'

Both RAML-Spec and OpenAPI-Specification are popular API description languages. RAML offers a more concise syntax and emphasizes reusability, while OpenAPI provides more detailed modeling capabilities and enjoys broader industry support. The choice between them often depends on specific project requirements and team preferences.

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API

Pros of swagger-core

  • Wider adoption and larger community support
  • Better tooling ecosystem and integration with various programming languages
  • More extensive documentation and examples

Cons of swagger-core

  • More verbose syntax compared to RAML
  • Steeper learning curve for beginners
  • Less flexibility in describing complex API structures

Code Comparison

RAML (raml-spec):

#%RAML 1.0
title: Example API
/users:
  get:
    description: Get all users
    responses:
      200:
        body:
          application/json:
            type: User[]

Swagger (swagger-core):

openapi: 3.0.0
info:
  title: Example API
paths:
  /users:
    get:
      summary: Get all users
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'

The RAML example is more concise and easier to read at a glance, while the Swagger example provides more detailed information about the API structure. Swagger-core offers better support for OpenAPI Specification (OAS) and is more widely used in the industry. However, RAML's simplicity and readability make it attractive for smaller projects or teams that prioritize ease of use.

API Blueprint

Pros of API Blueprint

  • Simpler syntax based on Markdown, making it more accessible for non-developers
  • Better support for documentation-first API design approach
  • Wider ecosystem of tools and integrations

Cons of API Blueprint

  • Less expressive for complex API structures compared to RAML
  • Limited support for reusable components and inheritance
  • Smaller community and fewer enterprise-level adoptions

Code Comparison

API Blueprint:

# GET /users/{id}
+ Parameters
    + id: 1 (number, required) - User ID
+ Response 200 (application/json)
    + Attributes
        + name: John Doe (string)
        + email: john@example.com (string)

RAML:

/users/{id}:
  get:
    description: Retrieve a user
    uriParameters:
      id:
        type: integer
        required: true
    responses:
      200:
        body:
          application/json:
            type: !include schemas/user.raml

API Blueprint uses a more human-readable Markdown syntax, while RAML employs a YAML-based structure. RAML offers more advanced features like including external schemas, which can be beneficial for larger, more complex APIs. API Blueprint's simplicity makes it easier to get started, but RAML provides more flexibility and power for extensive API definitions.

4,104

The AsyncAPI specification allows you to create machine-readable definitions of your asynchronous APIs.

Pros of AsyncAPI spec

  • Specifically designed for event-driven and asynchronous APIs
  • Supports multiple protocols (e.g., AMQP, MQTT, Kafka)
  • More extensive tooling ecosystem for code generation and documentation

Cons of AsyncAPI spec

  • Less mature and widespread adoption compared to RAML
  • Limited support for RESTful API design patterns
  • Steeper learning curve for developers familiar with traditional API specs

Code comparison

RAML spec example:

#%RAML 1.0
title: My API
/users:
  get:
    responses:
      200:
        body:
          application/json:

AsyncAPI spec example:

asyncapi: 2.0.0
info:
  title: My API
channels:
  users:
    subscribe:
      message:
        payload:
          type: object

The RAML spec focuses on HTTP-based APIs with a clear resource structure, while the AsyncAPI spec emphasizes message-driven interactions and supports various protocols. RAML uses a more straightforward syntax for defining endpoints and methods, whereas AsyncAPI introduces concepts like channels and message payloads to describe asynchronous communication patterns.

Both specifications aim to provide a standardized way to describe APIs, but they cater to different architectural styles and use cases. The choice between RAML and AsyncAPI depends on the specific requirements of the API project and the preferred communication patterns.

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v3.1, v3.0, and v2.0 as well as AsyncAPI v2.x.

Pros of Spectral

  • More flexible and customizable, supporting multiple API description formats (OpenAPI, AsyncAPI, JSON Schema)
  • Actively maintained with regular updates and a growing community
  • Provides a powerful, extensible linting system for API descriptions

Cons of Spectral

  • Steeper learning curve due to its more complex ruleset system
  • Requires additional setup and configuration compared to RAML's simpler approach
  • May have higher resource usage for large API descriptions due to its extensive ruleset

Code Comparison

RAML-spec (RAML 1.0):

#%RAML 1.0
title: Example API
version: v1
/users:
  get:
    description: Get all users

Spectral (OpenAPI 3.0):

openapi: 3.0.0
info:
  title: Example API
  version: 1.0.0
paths:
  /users:
    get:
      summary: Get all users

While both examples define a simple API endpoint, Spectral's approach using OpenAPI allows for more detailed specifications and is more widely adopted in the industry. RAML-spec offers a concise syntax but may be less flexible for complex API designs.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

The RESTful API Modeling Language (RAML) Spec

Build Status

The current version of the RAML specification is 1.0 - and you can find it here.

RAML is a language for the definition of HTTP-based APIs that embody most or all of the principles of Representational State Transfer (REST). The RAML specification (this document) defines an application of the YAML 1.2 specification that provides mechanisms for the definition of practically-RESTful APIs, while providing provisions with which source code generators for client and server source code and comprehensive user documentation can be created.

Why not pay us a visit on raml.org? You will find tons of information around RAML such as a tutorial, what the RAML Workgroup is, RAML projects, a forum, and a lot more.

What is the fastest way to get started?

All you need is an editor of your choice - we recommend either MuleSoft's API Designer or API Workbench; but any text editor will do just fine.

Now you only need to do is to write the design for your first endpoint

#%RAML 1.0
title: Hello world # required title

/greeting: # optional resource
  get: # HTTP method declaration
    responses: # declare a response
      200: # HTTP status code
        body: # declare content of response
          application/json: # media type
            # structural definition of a response (schema or type)
            type: object
            properties:
              message: string
            example: # example how a response looks like
              message: "Hello world"

Interested? Learn more about the syntax in the RAML 1.0 specification or take a look at some examples.

How do I learn more?

How can I contribute?

We welcome any contributions from the community! You can contribute or provide feedback for the RAML Specification in different ways depending on your intentions. The following table illustrates the different ways to help us not only to improve the documentation of the specification, but also RAML itself.

Your IntentionWhat to do?
You see a spelling or grammar mistake, or an error in our examples?Fork this repository, make edits, and then submit a pull request. We will respond to your request as quickly as possible.
You want to suggest a new feature, improve existing features, ask questions, or things in general around the RAML specification?File an issue. Please be as specific as possible about your intentions or what you’d like to see.

How can I get in touch?

Licensing

Branding Guidelines