New Feature: openApiSpec() を config-based デフォルトに変更#13
Merged
Conversation
Replace the abstract openApiSpec() method with a concrete method that reads from Laravel config, allowing users to set a project-wide default spec via the openapi-contract-testing.default_spec config key. Add a service provider with publishable config for Laravel auto-discovery.
Add namespace-level config() mock helper and unit tests verifying that the default openApiSpec() method reads from Laravel config, returns an empty string when unconfigured, and fails with a clear message when the spec name is empty.
- Validate config() return type with is_string guard for type safety - Improve error message to mention config key and override option - Update CLAUDE.md Laravel Integration section for new architecture - Improve LaravelConfigMock docblock (correct package attribution, explain namespace mocking rationale, warn about use function imports) - Extract shared CreatesTestResponse trait from duplicated helpers - Add null config value test and update error message assertions - Add explicit config() ignore in phpstan.neon.dist for trait file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
ValidatesOpenApiSchematrait のopenApiSpec()を abstract メソッドから Laravel config ベースの具象メソッドに変更。openapi-contract-testing.default_specconfig キーでプロジェクト全体のデフォルト spec を設定可能にし、必要な場合のみオーバーライドする形にする。変更内容
openApiSpec()を abstract メソッドからconfig('openapi-contract-testing.default_spec', '')を返す具象メソッドに変更OpenApiContractTestingServiceProviderを新規追加(mergeConfigFrom/publishesによる config 管理)config.phpを新規追加(default_specキー、デフォルト値は空文字)composer.jsonにextra.laravel.providersを追加し、Laravel Package Auto-Discovery を有効化config()モックを用いた新規テスト 4 件を追加関連情報
feat!: replace openApiSpec property with abstract method)