Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add OpenAPI spec validation action and configure Spring profiles #31

Merged
merged 10 commits into from
Nov 19, 2024

Conversation

egekocabas
Copy link
Contributor

@egekocabas egekocabas commented Nov 17, 2024

Motivation

Prevent manual changes to autogenerated client code and ensure REST endpoint updates are reflected in the OpenAPI YAML and client code automatically.

Description

Workflow Changes:

  • Added a GitHub Actions workflow named Validate OpenAPI Spec and Generated Client Code
    • Validates changes in openapi.yaml, server and client-generated code.
    • Automatically posts comments on pull requests when validation fails.
    • Removes sticky comments when validation passes.

Gradle Changes

  • Added a new bootRunDev task to simplifies running the Spring Boot application in the dev profile
  • Configured openApi Gradle plugin to set/use the openapi profile.
  • Dynamically adds the H2 database dependency during the OpenAPI generation task (while generating the openapi yml file, the PostgreSQL connection is not necessary anymore).
  • New task enforces an active Spring profile to be set before executing bootRun.

Application server config changes

  • application-dev.yml added for local development
  • application-openapi.yml added for openapi.yml generation task
  • application.yml simplified for base usage

Testing Instructions

  • Run ./gradlew bootRunDev to verify the dev profile works as intended.
  • Execute ./gradlew generateOpenApiDocs to ensure OpenAPI specs are generated correctly.

@egekocabas egekocabas linked an issue Nov 17, 2024 that may be closed by this pull request
@github-actions github-actions bot added size:XL and removed size:L labels Nov 17, 2024
@github-actions github-actions bot added size:L and removed size:XL labels Nov 17, 2024
@egekocabas egekocabas changed the title feat(ci): Add validation for OpenAPI spec and generated client code feat: Add action to validate OpenAPI spec and generated client code Nov 17, 2024
@egekocabas egekocabas marked this pull request as ready for review November 17, 2024 21:31
@egekocabas egekocabas requested a review from a team as a code owner November 17, 2024 21:31
@egekocabas egekocabas changed the title feat: Add action to validate OpenAPI spec and generated client code feat: Add OpenAPI spec validation action and configure Spring profiles Nov 18, 2024
@TurkerKoc TurkerKoc merged commit f72189d into main Nov 19, 2024
7 checks passed
@TurkerKoc TurkerKoc deleted the 19-create-a-workflow-for-openapi branch November 19, 2024 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a workflow for OpenAPI
2 participants