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.2.tar.gz (19.3 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.2-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ramlpy_ng-0.1.2.tar.gz
  • Upload date:
  • Size: 19.3 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.2.tar.gz
Algorithm Hash digest
SHA256 3f1a6ff13f2ef472b349bd7f7f21c69b9cf54ca6ee7a7682251ad1060c7d985c
MD5 93cd32f27d317fa0baeacaa6cce7bb3c
BLAKE2b-256 f84a7e4aced9c4f77727000033df3cf526125d7f4262187b859bf6369029795b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ramlpy_ng-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 29.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6c2b288f509bdfaa9d9f4c35debed94815bc70c46e32806f8f228db3bf8c42d9
MD5 2ac982b1991c66ff373045ff8088355b
BLAKE2b-256 c0694c6a15a0671d6f47a9e1782f98482e35b8ffcc3dbe25273c94ffdcf07246

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