Skip to content

Conversation

@bivex
Copy link

@bivex bivex commented Dec 16, 2025

Summary

Adds a comprehensive OpenAPI 3.1.0 specification generator that automatically creates split YAML specifications for the Keygen API by parsing Rails application code. Supports both Community Edition (CE) and Enterprise Edition (EE) with full API versioning.

Features

Core Functionality

  • AST Parsing: Extracts parameter definitions from typed_params blocks in controllers
  • JSONAPI Serializer Integration: Automatically generates response schemas from serializer definitions
  • Split YAML Architecture: Uses $ref references for maintainable, modular specifications
  • Multi-Version Support: Generates specs for all API versions (1.0 through 1.7)
  • Edition Separation: Creates separate CE and EE specifications with feature filtering

Developer Experience

  • Rake Tasks: keygen:openapi:generate, keygen:openapi:validate, keygen:openapi:clean
  • Environment Configuration: Flexible output directory and edition targeting
  • Built-in Validation: Ensures generated specs conform to OpenAPI 3.1.0 standards
  • Comprehensive Documentation: Detailed README with usage examples and troubleshooting

Technical Implementation

  • Route Parsing: Extracts API routes from Rails application
  • Parameter Schema Building: Converts typed_params AST to OpenAPI parameter schemas
  • Response Schema Building: Transforms serializers to proper JSONAPI response schemas
  • Version Resolution: Handles version conditionals in parameter definitions
  • EE Feature Filtering: Automatically excludes enterprise features from CE specs

Usage

Generate all specifications

bundle exec rake keygen:openapi:generate

Generate only CE specs

EDITION=ce bundle exec rake keygen:openapi:generate

Validate generated specs

bundle exec rake keygen:openapi:validate

@CLAassistant
Copy link

CLAassistant commented Dec 16, 2025

CLA assistant check
All committers have signed the CLA.

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.

2 participants