AI Briefing
KO

Code Generator Development Story (Part 2)

·2023.07.04 05:44

Key point

Introduces the implementation process of a tool that automatically generates React Query, Type Guard, and Schema Validator based on OAS.

Details

Inflab's Frontend Development Team implemented a Code Generator that parses OpenAPI Specification(OAS) to improve development productivity. This tool aims to flexibly respond to API schema changes and ensure data consistency between backend and frontend.

The implementation uses dependency injection via inversify, type generation utilizing json-schema-to-typescript, and schema validation logic based on Ajv. The overall process consists of three stages: preprocessing, parallel task execution (ReactQuery, TypeGuard, SchemaValidator), and file generation.

The key features are as follows:

  • ReactQueryTask: Extracts Query, URL parameters, Response, Request Body, etc. to generate React Query hooks and types.
  • Type Guard & Schema Validator: Automatically generates Type Guard functions and Ajv instances to validate the generated interfaces.
  • Automated Deployment: Introduced Release Please and commitlint to build an automated deployment environment based on Conventional Commits.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.