Skip to content

ci: add API and database Schema validation workflow#9710

Merged
likhinbopanna merged 18 commits intomainfrom
api_and_db_comp
Dec 15, 2025
Merged

ci: add API and database Schema validation workflow#9710
likhinbopanna merged 18 commits intomainfrom
api_and_db_comp

Conversation

@itsharshvb
Copy link
Copy Markdown
Contributor

@itsharshvb itsharshvb commented Oct 7, 2025

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Added automated validation workflows to detect breaking changes in API schemas and database migrations.
New Workflows:

  • api-compatibility.yml - Validates API schema compatibility using oasdiff and checks migrations for breaking SQL operations

Configuration:

  • Added oasdiff config files to .github/oasdiff/ (.oasdiff-err-ignore.yaml, .oasdiff-warn-ignore.yaml, .oasdiff-severity-levels.yaml)

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

As the API evolves, we need automated checks to:

  • Detect breaking changes in API contracts before production deployment
  • Prevent dangerous database operations (DROP COLUMN, TRUNCATE, DELETE FROM)
  • Maintain backward compatibility for API consumers
  • Provide clear, actionable feedback on compatibility issues

The workflow validates:

  • API Changes: Removed endpoints, new required fields, type changes, response schema modifications
  • Migration Safety: DROP operations, TRUNCATE commands, potentially dangerous DELETE statements

How did you test it?

  1. Created intentional breaking changes to test detection:

    • Added required field organization_email to organization API
    • Removed organization_details from response schema
    • Changed endpoint path (breaking route change)
    • Added DROP COLUMN migrations in both v1 and v2
  2. Verified workflow triggers on:

    • Changes to crates/api_models/**, crates/openapi/**, crates/router/**
    • Migration file changes in migrations/** , v2_migrations/** and v2_compatible_migrations/**
Screenshot 2025-10-15 at 11 38 12 PM Screenshot 2025-12-03 at 12 20 09 PM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@itsharshvb itsharshvb requested a review from a team as a code owner October 7, 2025 10:14
@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com bot commented Oct 7, 2025

@itsharshvb itsharshvb self-assigned this Oct 7, 2025
@itsharshvb itsharshvb added the A-CI-CD Area: Continuous Integration/Deployment label Oct 7, 2025
Comment thread .github/workflows/api-migrations-compatibility.yml Fixed
Comment thread .github/workflows/api-migrations-compatibility.yml Fixed
Comment thread .github/oasdiff/.oasdiff-severity-levels.yaml Outdated
Comment thread .github/api-migration-compatibility/.oasdiff-severity-levels.yaml
Comment thread .github/oasdiff/.oasdiff-severity-levels.yaml Outdated
Comment thread .github/oasdiff/.oasdiff-severity-levels.yaml Outdated
Comment thread .github/workflows/api-compatibility.yml Outdated
Comment thread .github/workflows/api-compatibility.yml Outdated
- name: Install oasdiff
run: |
go install github.com/oasdiff/oasdiff@latest
echo "$HOME/go/bin" >> $GITHUB_PATH
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go installs binaries into $HOME/go/bin, which is user-specific . so explicitly add it

Comment thread .github/workflows/api-compatibility.yml Outdated
Comment thread .github/workflows/api-compatibility.yml Outdated
Comment thread .github/workflows/api-compatibility.yml Outdated
Comment thread .github/workflows/api-compatibility.yml Fixed
Comment thread .github/workflows/api-migrations-compatibility.yml Fixed
@itsharshvb itsharshvb requested review from a team as code owners October 15, 2025 17:58
@hyperswitch-bot hyperswitch-bot bot added M-database-changes Metadata: This PR involves database schema changes M-api-contract-changes Metadata: This PR involves API contract changes labels Oct 15, 2025
@hyperswitch-bot hyperswitch-bot bot removed M-database-changes Metadata: This PR involves database schema changes M-api-contract-changes Metadata: This PR involves API contract changes labels Oct 15, 2025
pixincreate
pixincreate previously approved these changes Oct 24, 2025
Comment thread .github/oasdiff/.oasdiff-severity-levels.yaml Outdated
@itsharshvb itsharshvb removed request for a team October 27, 2025 02:34
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@219dee3). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9710   +/-   ##
=======================================
  Coverage        ?    6.44%           
=======================================
  Files           ?     1254           
  Lines           ?   313676           
  Branches        ?        0           
=======================================
  Hits            ?    20208           
  Misses          ?   293468           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread .github/workflows/api-compatibility.yml Outdated
Comment thread .github/workflows/api-compatibility.yml Outdated
Comment thread .github/workflows/api-compatibility.yml Outdated
Comment thread .github/workflows/api-compatibility.yml Outdated
Comment thread .github/workflows/api-migrations-compatibility.yml
itsharshvb and others added 2 commits November 14, 2025 11:59
…er , relaxed drop column for v2_migrationsm, renamed workflow and reorder block
SanchithHegde
SanchithHegde previously approved these changes Nov 27, 2025
SanchithHegde
SanchithHegde previously approved these changes Nov 27, 2025
pixincreate
pixincreate previously approved these changes Nov 27, 2025
Comment thread .github/workflows/api-migrations-compatibility.yml Outdated
itsharshvb and others added 2 commits December 3, 2025 12:23
…ttern for changes migration parsing, improved step failure detection for easier POF detection
@itsharshvb itsharshvb dismissed stale reviews from SanchithHegde and pixincreate via 3eaeea1 December 3, 2025 06:58
Comment thread .github/api-migration-compatibility/migration-rules.yaml
Comment thread .github/api-migration-compatibility/migration-rules.yaml
Comment thread .github/workflows/api-migrations-compatibility.yml Outdated
hrithikesh026
hrithikesh026 previously approved these changes Dec 11, 2025
Copy link
Copy Markdown
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that, looks good to me!

Comment thread .github/scripts/validate_migrations.sh Outdated
Comment thread .github/scripts/validate_migrations.sh Outdated
@likhinbopanna likhinbopanna added this pull request to the merge queue Dec 15, 2025
Merged via the queue into main with commit dea49de Dec 15, 2025
26 of 27 checks passed
@likhinbopanna likhinbopanna deleted the api_and_db_comp branch December 15, 2025 16:53
pixincreate added a commit that referenced this pull request Dec 17, 2025
…aysafe-flow-correction

* 'main' of github.com:juspay/hyperswitch: (47 commits)
  fix: implement is_pre_authentication_flow_required function for nmi (#10692)
  chore(version): 2025.12.17.0
  fix: Corrected the mapping of metadata fields in HS<>UCS tunnel (#10626)
  fix(users): Check if the inviter role info entity type is greater than invitee (#10667)
  feat(payouts): [WorldpayWPG] Implement fast access feature of worldpaywpg for payouts (#10647)
  fix(oidc): registration of oidc paths (#10678)
  feat(connector): [Peach Payments] Add Pre-Auth Flow With Full Reversal (#10590)
  fix(payouts): add fallback for names for payout via Psp token (#10502)
  feat(euclid): support for issuer_country based routing (#10638)
  feat: implement granular authentication flow for UCS gateway interfaces (#10622)
  feat(euclid): support for transaction_initiator based routing (#10658)
  feat(gsm): add standardised error fields to GSM models and database schema (#10600)
  feat(payments): change lookup for find gsm code and message (#10585)
  feat: Added Paypal Post Auth Flow for HS<>UCS tunnel (#10640)
  feat: Added PreAuthenticate Flow for Nmi HS<>UCS tunnel (#10632)
  chore(version): 2025.12.16.0
  feat: implement generic Locker api handler (#10242)
  fix(user-role): add entity type validation in user role lineage queries (#10608)
  ci: add API and database Schema validation workflow (#9710)
  feat(oidc): Add OIDC infrastructure and discovery endpoints (#10145)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI-CD Area: Continuous Integration/Deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants