Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 6, 2025

This PR implements OpenAPI 3.0.3 schema generation from the parsed Mastodon entities and API methods. The implementation converts the parsed documentation into a complete OpenAPI specification output in JSON format.

Key Features

  • OpenAPI Schema Generation: New OpenAPIGenerator class that converts parsed entities and methods into OpenAPI 3.0.3 format
  • Entity Conversion: Transforms 64 Mastodon entities into OpenAPI schema components with proper type mapping
  • API Method Conversion: Converts 165 API methods across 40 method files into OpenAPI paths with operations, parameters, and security
  • Type System: Intelligent type parsing that converts Mastodon documentation types to OpenAPI types (String → string, Integer → integer, Boolean → boolean, etc.)
  • Parameter Handling: Supports both path parameters and form data parameters with proper OpenAPI structure
  • Security Integration: Automatically adds OAuth2 security requirements based on method documentation

Usage

npm run generate

This now outputs a complete OpenAPI JSON specification instead of console logging the parsed data.

Output Structure

The generated schema includes:

  • OpenAPI 3.0.3 specification with proper info and servers
  • 64 entity schemas in components.schemas
  • 144 API paths with complete operation definitions
  • OAuth2 and Bearer token security schemes
  • Proper parameter handling for both query and form data

Testing

Added comprehensive test coverage for the OpenAPI generator including:

  • Entity to schema conversion validation
  • API method to path operation conversion
  • Type parsing and mapping
  • JSON output validation

Fixes #18.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@abraham abraham marked this pull request as ready for review June 6, 2025 23:21
@abraham abraham merged commit c8a6413 into main Jun 6, 2025
1 check passed
@abraham abraham deleted the copilot/fix-18 branch June 6, 2025 23:21
Copilot AI changed the title [WIP] Generate OpenAPI schema file Generate OpenAPI schema file from parsed entities and methods Jun 6, 2025
Copilot AI restored the copilot/fix-18 branch June 6, 2025 23:21
Copilot AI requested a review from abraham June 6, 2025 23:21
Copilot finished work on behalf of abraham June 6, 2025 23:21
@abraham abraham deleted the copilot/fix-18 branch June 8, 2025 21:12
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.

Generate OpenAPI schema file

2 participants