Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 6, 2025

The includeModels and excludeModels configuration options were already implemented in the codebase but lacked comprehensive test coverage to verify their functionality. This PR adds a complete test suite to ensure these model filtering features work correctly.

What was added

Comprehensive Test Suite (tests/model-filtering.test.ts)

includeModels Configuration Tests:

  • Include only specified models (includeModels: "User,Post")
  • Include single model (includeModels: "User")
  • Handle whitespace in model names (includeModels: " User , Post ")
  • Handle non-existent models gracefully
  • Include all models when empty string or undefined

excludeModels Configuration Tests:

  • Exclude specified models (excludeModels: "Profile")
  • Exclude multiple models (excludeModels: "Profile,Post")
  • Handle whitespace in model names
  • Handle non-existent models gracefully
  • Include all models when empty string

Combined Configuration Tests:

  • Apply includeModels first, then excludeModels
  • Handle complex filtering scenarios

Example Usage

The includeModels option can be used in schema.prisma to generate OpenAPI specs for only specific models:

generator openapi {
  provider = "prisma-openapi"
  output   = "./openapi"
  includeModels = "User,Post"  // Only generate OpenAPI for these models
}

Test Results

All 27 tests pass (14 existing + 13 new model filtering tests), confirming that:

  • The implementation correctly filters models based on configuration
  • Enum references are properly handled in filtered models
  • Edge cases like non-existent models and whitespace are handled gracefully
  • Combined includeModels and excludeModels work as expected

Fixes #24.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • binaries.prisma.sh
    • Triggering command: node /home/REDACTED/work/prisma-openapi/prisma-openapi/node_modules/.bin/../prisma/build/index.js generate (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits August 6, 2025 20:48
…tion

Co-authored-by: nitzano <16689354+nitzano@users.noreply.github.com>
Co-authored-by: nitzano <16689354+nitzano@users.noreply.github.com>
Copilot AI changed the title [WIP] Support includeModels option in cofiguration Add comprehensive tests for includeModels and excludeModels configuration options Aug 6, 2025
Copilot finished work on behalf of nitzano August 6, 2025 20:51
Copilot AI requested a review from nitzano August 6, 2025 20:51
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.

Support includeModels option in cofiguration

2 participants