Skip to main content

A modern Python library for parsing and validating RAML 0.8 and 1.0 files

Project description

ramlpy-ng

A modern Python library for parsing and validating RAML 0.8 and 1.0 files.

Features

  • Dual version support: Parse both RAML 0.8 and 1.0 files
  • Normalized internal model: Both versions compile into a shared object model
  • Request validation: Validate path, query, header, and body inputs
  • Type coercion: Automatically coerce validated values into Python types
  • Flask integration: Easy-to-use decorators for request validation
  • Developer-friendly errors: Structured validation error reports
  • Python 3.6+ support: Works with Python 3.6 through 3.14+

Installation

pip install ramlpy-ng

With Flask Integration

pip install ramlpy-ng[flask]

Development Dependencies

pip install ramlpy-ng[dev]

Quick Start

Parsing a RAML File

from ramlpy import parse

api = parse("api.raml")
print(api.title)       # "My API"
print(api.version)     # "v1"
print(api.base_uri)    # "https://api.example.com/{version}"

Parsing from String

from ramlpy import parse_string

raml_text = """
#%RAML 1.0
title: My API
version: v1

/users:
  get:
    queryParameters:
      limit:
        type: integer
        default: 10
        minimum: 1
        maximum: 100
"""

api = parse_string(raml_text)

Validating a Request

result = api.validate_request(
    path="/users",
    method="GET",
    path_params={},
    query_params={"limit": "50"},
    headers={"Accept": "application/json"},
    body=None,
    content_type=None,
)

if result.ok:
    print(result.data)
else:
    for error in result.errors:
        print(f"{error['pointer']}: {error['message']}")

CLI

ramlpy-ng validate api.raml
ramlpy-ng info api.raml

Documentation

See the full documentation for detailed guides and API reference.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ramlpy_ng-0.1.1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ramlpy_ng-0.1.1-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file ramlpy_ng-0.1.1.tar.gz.

File metadata

  • Download URL: ramlpy_ng-0.1.1.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for ramlpy_ng-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6ed6cf3afeb1112f0fb8196cf7d80bb06ee68b34535e1e9ac1d8795701309d58
MD5 a91772e1be63fb52e56efc8516015c33
BLAKE2b-256 5f98e8fd1dbc2546954124a1590b159307b5521c721322b4c1a77658666b0fe2

See more details on using hashes here.

File details

Details for the file ramlpy_ng-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ramlpy_ng-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for ramlpy_ng-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2bbb98bf46fc269953ca6743979b0e52f9d14aa2616c6f5c097b8632de20687c
MD5 c01b190683f0934d4b397120a20dec89
BLAKE2b-256 4e66ca88a4587db5c5b8e322bad44fa003f2bf67969034918ce5d19f7ee8cbbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page