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.0.tar.gz
(19.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ramlpy_ng-0.1.0-py3-none-any.whl
(29.1 kB
view details)
File details
Details for the file ramlpy_ng-0.1.0.tar.gz.
File metadata
- Download URL: ramlpy_ng-0.1.0.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb6a30600248e435b3c0188078d8b83366f93571a4c4d86a2eefeb26a5f0df1d
|
|
| MD5 |
c53ba265fe60268a5e46a502d2bbe8fb
|
|
| BLAKE2b-256 |
fcb4ebfa3694e8146fb207f36a084ab61781c4a7d06eaa0ce056dff5a9614b84
|
File details
Details for the file ramlpy_ng-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ramlpy_ng-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4dec1aec97ea5b1617bfd0ef74594f0487989bf799c871db38bbc58db745588
|
|
| MD5 |
56d81e157763f0f53af03091e520ce96
|
|
| BLAKE2b-256 |
7fed74c3b178737a4b18295965f17cef762f895c9c0dd546a19aaf7a84785d72
|