-
Notifications
You must be signed in to change notification settings - Fork 238
Description
We currently have excellent support for OpenAPI integration with Express using libraries like express-openapi, which streamline the development of APIs by providing features such as validation, routing, and documentation based on OpenAPI specifications. However, there is a lack of a similar robust framework for the Fastify ecosystem, which is a fast, lightweight, and developer-friendly alternative to Express.
This feature request is for developing or integrating a library that offers similar OpenAPI capabilities for Fastify.
Key Features
- Schema-Driven Development
• Generate routes, request validation, and response validation based on OpenAPI specifications.
• Ensure that API implementations strictly follow the OpenAPI spec. - Middleware & Hook Support
• Ability to easily integrate with Fastify’s hooks, schema validation, and plugins for additional flexibility. - Documentation Integration
• Automatically generate API documentation (e.g., Swagger UI) based on the OpenAPI spec.
• Support exporting the OpenAPI spec dynamically. - Error Handling
• Standardized error responses based on OpenAPI definitions. - Extensibility
• Provide hooks or extension points to customize the behavior, such as modifying schema or adding custom middleware. - Compatibility with Fastify Ecosystem
• Support Fastify’s plugin system and align with its performance and lightweight nature.
Benefits
• Improved developer productivity and consistency when building APIs with Fastify.
• Easier migration paths for teams moving from Express to Fastify while maintaining OpenAPI-based workflows.
• Streamlined process for adhering to API design-first principles.
Possible Implementation Considerations
• Base the architecture on existing Fastify plugins and schema validation features.
• Leverage existing OpenAPI parsers like swagger-parser or openapi-schema-validator.
• Include robust TypeScript support for type inference and validation.
References
• express-openapi: The existing library for Express.
• Fastify Documentation: Explore plugin and validation capabilities of Fastify.
Looking for Feedback
• Are there existing solutions or plugins that partially address this need?
• Suggestions for additional features or use cases to consider?
• Volunteers to help design or implement the library?
By creating this feature, we can empower the Fastify community to build OpenAPI-compliant APIs more efficiently while retaining the performance benefits of Fastify.