Skip to content

kmbhm1/PyJAS

Repository files navigation

Python JSON:API Standard (PyJAS)

PyPI - Python Version Pydantic v2 GitHub License codecov PyPI - Downloads

PyJAS is a Python library that provides seamless integration of the JSON:API specification with Pydantic and FastAPI. It simplifies the process of building standards-compliant APIs, ensuring consistency and interoperability across your applications.

Features

  • Standards Compliance: Adheres strictly to the JSON:API specification.
  • Pydantic Models: Utilizes Pydantic for data validation and serialization.
  • FastAPI Integration: Easily integrates with FastAPI to build high-performance APIs.
  • Flexible Configuration: Customize behaviors to fit your project's requirements.
  • Extensible: Supports extensions and customizations for advanced use cases.

Installation

You can install PyJAS via pip:

pip install pyjas

Quick Start

Here's a simple example of how to integrate PyJAS with Pydantic & FastAPI:

from fastapi import FastAPI
from pyjas.v1_1 import Document, ResourceObject

app = FastAPI()

class Article(ResourceObject):
    type_: str = "articles"
    id_: str
    attributes: dict

@app.get("/articles/{article_id}", response_model=Document)
async def get_article(article_id: str):
    article = Article(id_=article_id, attributes={"title": "PyJAS"})
    return Document(data=article)

For a complete example, visit our Documentation Site.

Documentation

Comprehensive documentation is available on our MkDocs site.

Contributing

Contributions are welcome! Please see our Contributing Guide for more information.

License

This project is licensed under the MIT License.

Contact

For questions or support, please open an issue on GitHub.

Acknowledgements

About

A Python tool to implement JSON-API Standard Responses.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •