Skip to content

🎯 Add unified shared types across databases and OpenAPI sources#183

Merged
oyvindberg merged 2 commits intomainfrom
adapter-type-field-names
Jan 11, 2026
Merged

🎯 Add unified shared types across databases and OpenAPI sources#183
oyvindberg merged 2 commits intomainfrom
adapter-type-field-names

Conversation

@oyvindberg
Copy link
Collaborator

@oyvindberg oyvindberg commented Jan 6, 2026

🚀 Summary

This PR introduces unified shared types that align TypeDefinitions across multiple data sources!

✨ Features

  • 🏷️ Add SourceKind ADT to distinguish Database vs OpenAPI sources in type alignment
  • 📍 Add ApiFieldKind to track model properties vs API parameters
  • 📝 Generate shared types with documentation showing all aligned sources
  • 🔗 Support TypeDefinitions matching across PostgreSQL, MariaDB, and OpenAPI
  • 🎛️ Add fieldTypeOverrides for explicit field→type mappings in OpenAPI
  • 🗺️ Include detailed location paths (e.g., Customer.firstName, /customers.isActive)

📋 Example Output

/** Shared type `IsActive` aligned across sources:
  *   - postgres (PostgreSQL): purchasing.vendor.activeflag, humanresources.employee.currentflag
  *   - mariadb (MariaDB): warehouses.is_active, payment_methods.is_active, ...
  *   - api (OpenAPI): CustomerUpdate.isActive, Customer.isActive, /customers.isActive, ...
  */
public record IsActive(@JsonValue Boolean value) { ... }

🎉 What This Enables

  • 🔄 Single type definition shared across multiple databases AND OpenAPI specs
  • 📊 Full traceability of where each type is used
  • 🛡️ Type-safe code generation that spans your entire stack

✅ Test plan

  • Verify shared types generate correctly with multi-source documentation
  • Verify OpenAPI model properties and parameters are distinguished in paths
  • Verify type alignment works across PostgreSQL, MariaDB, and OpenAPI

🤖 Generated with Claude Code

@oyvindberg oyvindberg changed the title Add unified shared types across databases and OpenAPI sources 🎯 Add unified shared types across databases and OpenAPI sources Jan 6, 2026
@oyvindberg oyvindberg force-pushed the adapter-type-field-names branch 5 times, most recently from 4874934 to ee75cce Compare January 11, 2026 04:05
- Add SourceKind ADT to distinguish Database vs OpenAPI sources
- Add ApiFieldKind to track model properties vs API parameters
- Generate shared types with proper documentation showing all aligned sources
- Support TypeDefinitions matching across PostgreSQL, MariaDB, and OpenAPI
- Add fieldTypeOverrides for explicit field→type mappings in OpenAPI
- Include detailed location paths (e.g., Customer.firstName, /customers.isActive)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@oyvindberg oyvindberg force-pushed the adapter-type-field-names branch from ee75cce to 81d3b5b Compare January 11, 2026 10:58
FirstName now wraps Name which wraps String, so use FirstName(Name("name"))
instead of FirstName("name").

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@oyvindberg oyvindberg merged commit 02da489 into main Jan 11, 2026
12 checks passed
@oyvindberg oyvindberg deleted the adapter-type-field-names branch January 11, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant