DEV Community

Mr Fatalyst
Mr Fatalyst

Posted on

3 1 1 1 1

FastOpenAPI: A Reason to Believe in Open Source Community

FastOpenAPI

Links


About a month ago, I decided to share my project, FastOpenAPI, with the Hacker News community. FastOpenAPI is a library designed to simplify working with OpenAPI schemas and integrating them with various Python frameworks. My goal was to create a user-friendly solution, inspired by FastAPI, for developers using Falcon, AioHTTP, Tornado, and other popular frameworks.

Why did I create FastOpenAPI?

If you've ever had to maintain API documentation for multiple Python frameworks simultaneously, you know how cumbersome it can be. Each framework often requires a unique approach. Appreciating FastAPI’s simplicity and intuitive design, I wanted to bring that same convenience and efficiency to other platforms.

How does FastOpenAPI work?

FastOpenAPI acts as a universal layer providing consistent creation and validation of OpenAPI schemas across multiple frameworks. It implements a unified interface alongside tools to streamline integration, documentation, and data validation.

Request processing flow in FastOpenAPI

Request processing flow in FastOpenAPI:

Receiving Request

  • The client sends an HTTP request to a specific route.
  • The web framework (Flask, Falcon, AioHTTP, Starlette, Sanic, Quart, Tornado) receives the request.

Forwarding Request

  • The framework delegates the request to the handler registered by FastOpenAPI.
  • The router extracts URL path parameters, query parameters, and the request body (JSON).

Validating Data

  • The router analyzes the signature of the user-defined function.
  • Input data is transformed based on type annotations.
  • Pydantic models (if used) are validated.

Calling User Function

  • The router passes validated arguments to the user-defined function, supporting synchronous and asynchronous operations.

Handling Result

  • The function returns a result.
  • The router serializes the result, especially for Pydantic models, and adds metadata like HTTP status codes.

Forming Response

  • The router converts the serialized result into a format compatible with the specific framework.
  • The framework sends back an HTTP response.

Handling Errors

  • Any exceptions are caught by the router.
  • Errors are standardized into a JSON response with an appropriate HTTP status code.

This architecture provides:

  • Consistent route definitions across frameworks.
  • Automatic validation and transformation of data.
  • Standardized error handling.
  • Automatic OpenAPI documentation generation.

The core of FastOpenAPI allows developers to concentrate on business logic instead of worrying about integration specifics.

Community Feedback and Improvements

I shared FastOpenAPI on Hacker News to get constructive criticism and recommendations, a platform known for its candid and professional audience.

Hacker News activity chart

My post received a very positive response: it remained on the front page for over 12 hours, garnered approximately 150 upvotes, and sparked valuable discussions. The community suggested essential improvements, such as:

  • Class-level schema caching for better performance.
  • Standardized error handling.
  • Support for basic Python data types as response models.

Version 0.5.0 – A Major Milestone

Thanks to community feedback, version 0.5.0 featured highly anticipated enhancements:

  • Integration with AioHTTP.
  • Implementation of class-level schema caching.
  • Improved error handling mechanisms.
  • Support for simple data types as response models.
  • Comprehensive documentation overhaul (fastopenapi.fatalyst.dev).

A significant pull request also ensured consistent use of aliases from Pydantic during serialization and schema generation.

The community response surpassed my expectations, providing actionable suggestions and motivating further project development.

What's next?

Future releases will focus on simplifying the API, removing deprecated solutions, enhancing performance, and expanding framework support. Continuous documentation improvements and more usage examples will remain a priority.

Acknowledgments

I'm incredibly grateful to everyone who participated in discussions on Hacker News and other platforms. Your valuable contributions have significantly improved FastOpenAPI, reinforcing my belief in the strength and future of open source communities!

Heroku

Deploy with ease. Manage efficiently. Scale faster.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (2)

Collapse
 
nevodavid profile image
Nevo David

man, seeing feedback turn into real updates is always cool - you think the best community ideas come outta folks using it hands-on or does it take just one loud voice to spark change?

Collapse
 
mr_fatalyst profile image
Mr Fatalyst

Depends. A dozen quiet builders can do wonders. But sometimes it takes just one loud, right voice to say: "wait, why isn’t this simpler?" and boom, the roadmap shifts.

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay