Skip to main content

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

Project description

ramlpy-ng

PyPI version PyPI - Python Version PyPI - Downloads

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
  • Route-scoped validation: Build reusable validators for body, path, query, and header inputs
  • Type coercion: Automatically coerce validated values into Python types
  • Developer-friendly errors: Structured validation error reports
  • Python 3.6+ support: Works with Python 3.6 through 3.14+

Installation

pip install ramlpy-ng

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)

Building A Route Validator

validator = api.validator_for("/users", "GET")
result = validator.validate(
    query_params={"limit": "50"},
    headers={"Accept": "application/json"},
)

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.3.tar.gz (29.5 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.3-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ramlpy_ng-0.1.3.tar.gz
  • Upload date:
  • Size: 29.5 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.3.tar.gz
Algorithm Hash digest
SHA256 e4fec5f2521f02044f3de2fd9197d255a2783258a0a14eae603e8b7547b3d446
MD5 2c6ce6a1b85f5f9087baea7190aa537e
BLAKE2b-256 5b3414c74be46ea71b3b024fca13d124fbfcfafbff1d36b8b0fbd645b52d9751

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ramlpy_ng-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 38.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 994d75cf1fffd4ad28163851d5efc2c21f3095e78744b2332edb21e83847c381
MD5 cde07643713d1ab24f528c5dcfeced59
BLAKE2b-256 1d060eef88c911801dba4d9939894ec2dfd99090a500ba8d741ac98f3f31dfd3

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