Integrate Orval for OpenAPI-based Fetch Generation in React#202
Merged
lbroudoux merged 6 commits intomicrocks:masterfrom Jan 19, 2026
Merged
Integrate Orval for OpenAPI-based Fetch Generation in React#202lbroudoux merged 6 commits intomicrocks:masterfrom
lbroudoux merged 6 commits intomicrocks:masterfrom
Conversation
Add Orval configuration for generating API clients from OpenAPI specs. Update package.json to include Orval command in prepare script and enhance path mappings in tsconfig.json for better module resolution. Signed-off-by: Paul PLANCQ <paul.plancq@outlook.fr>
Renamed mock handler and server files for clarity. Updated tsconfig to include new mock paths and added orval.config.ts to the include list. Signed-off-by: Paul PLANCQ <paul.plancq@outlook.fr>
Add a generic API fetch utility with automatic type conversion and error handling. Includes constants for HTTP methods, headers, and MIME types. Also introduces tests for various fetch scenarios to ensure reliability. Signed-off-by: Paul PLANCQ <paul.plancq@outlook.fr>
Signed-off-by: Paul PLANCQ <paul.plancq@outlook.fr>
Implement MicrocksHubService to handle API package and version fetching, along with unit tests to ensure functionality and correctness of the service methods. Signed-off-by: Paul PLANCQ <paul.plancq@outlook.fr>
Signed-off-by: Paul PLANCQ <paul.plancq@outlook.fr>
|
This pull request has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 30 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation. There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. Microcks is a Cloud Native Computing Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Pull Request:
Associated Issue:
Closes #196
Context:
This PR addresses the need to generate type-safe fetch functions from the OpenAPI specification using Orval. This improves developer experience by enabling automatic API client generation, reducing manual API integration code, and ensuring consistency between the API contract and React client implementation.
Proposed Changes:
react/package.jsonwith all required peer dependencies (@apidevtools/swagger-parser,@asyncapi/specs,@commander-js/extra-typings, etc.)react/orval.config.tsto generate fetch functions fromapi/microcks-hub-openapi-v1.0.yamlinto./.api/microcksHub/index.tsfetchApihelper insrc/shared/helpers/fetchApi/fetchApi.tswith error handling and type safety (supports both JSON and text responses).api/microcksHub/index.tswith TypeScript interfaces for all OpenAPI schemas (APIPackage, APIVersion, APIPackageFull, etc.)MicrocksHubServiceinsrc/services/microcksHubService/MicrocksHubService.tsas an abstraction layer for API operations with methods:getPackages(),getPackageDetails(),getAPIVersions(),getAPIVersionDetails()operationId: GetAPIVersionsto the OpenAPI spec for better generated function namingmise.tomlfor consistent tool versioning (npm 11.7.0, node 24.12.0)Checklist:
Additional Information:
fetchApihelper is designed to work as a custom mutator for Orval, ensuring all generated functions use consistent error handling and request/response processing