Open
Description
Description
Implement a GitHub Actions workflow to automatically generate schemas and Data Transfer Object (DTO) files using QuickType. This will help keep our data models up-to-date and synchronized with our data sources, streamlining the development process.
Why We Need This
- Automation: Automatically generating schemas and DTO files ensures they are always up-to-date with the latest changes, reducing manual effort and the risk of inconsistencies.
- Consistency: Using a consistent tool like QuickType across the team helps maintain uniform data models and reduces errors.
- Efficiency: Integrating schema generation into our CI/CD pipeline will speed up development and ensure that data models are always accurate.
Tech Notes
-
QuickType Integration:
- QuickType can generate schemas and DTO files from JSON, TypeScript, or other data formats.
- We need to set up QuickType to run as part of our GitHub Actions workflow.
-
GitHub Actions Workflow Setup:
- Create a new workflow file in
.github/workflows
directory, e.g.,generate-schemas.yml
. - Define a job in the workflow to install QuickType and run it to generate the required files.
- Create a new workflow file in
-
Workflow File Example:
name: Generate Schemas/DTO Files on: push: branches: - main pull_request: branches: - main jobs: generate: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Node.js uses: actions/setup-node@v3 with: node-version: "14" - name: Install QuickType run: npm install -g quicktype - name: Generate Schemas/DTO Files run: quicktype -s json -o src/schemas.ts data/example.json - name: Commit generated files run: | git config --global user.name 'GitHub Actions' git config --global user.email 'actions@github.com' git add src/schemas.ts git commit -m 'Update generated schemas/DTO files' git push
-
QuickType Command Details:
- Customize the
quicktype
command based on your data source and output requirements. - Refer to QuickType CLI documentation for additional options and configurations.
- Customize the
-
File Management:
- Ensure that the generated files are correctly placed in the repository and managed according to your project’s file structure.
- Set up
.gitignore
if there are any temporary files or outputs that should not be committed.
Additional Notes
- Ensure that the workflow is tested in a staging environment before deploying it to production.
- Consider adding tests to verify the accuracy of generated schemas/DTO files.
- Document the process and any configurations in the repository’s README or contributing guidelines.
Metadata
Metadata
Assignees
Labels
GitHub Actions for automation and CI/CDContinuous Integration / PipelineCode QualityPull requests that update a dependency fileA enhancement to the projectExamplesGitAuto label to trigger the app in a issue.A issue for someone self assign and help me =DParticipation in the Hacktoberfest eventFeel free to take this issue for you and help me!Request of new schema/modelTasks related to writing or updating documentationWork in progress
Activity