test(openapi): assert the yaml export structurally, not by key order - #8464
Merged
Merged
Conversation
testExecuteWithYaml matched rendered YAML blocks that assumed operationId came directly after get:. symfony/serializer 8.2.x-dev emits the Operation properties in a different order -- responses first -- so the blocks no longer matched even though every key is present with the same value. Object key order carries no meaning in YAML, so assert the parsed structure for the paths and keep separate string assertions for the formatting this test is actually about: block sequences and inline empty arrays. Verified on symfony/yaml 8.1.2 and 8.2.x-dev.
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.
Fixes the last blocking failure on 4.3:
OpenApiCommandTest::testExecuteWithYamlon thePHPUnit (PHP 8.5) (Symfony dev)job.Cause
The test matched rendered YAML blocks that assume
operationIdcomes directly afterget::Under
symfony/serializer8.2.x-dev the Operation properties are emitted in a different order —responsesfirst:Nothing is missing.
operationIdandtagsare still there with the same values, just later in the mapping. I verified every individual fragment the test expects is present in the dev output; only the multi-key blocks fail. Object key order is not meaningful in YAML, so this is a test that over-specifies rather than a bug in the export.Note the failure was not YAML formatting drift, which is what the symptom initially suggested.
Fix
Assert the parsed structure for the paths, and keep separate string assertions for the formatting this test genuinely covers — block sequences and inline empty arrays:
The remaining assertions — literal-style multiline description, quoted title, the nested
securityblock — are unchanged; they were already order-independent and still pass.Verification
Reproduced locally with CI's recipe (
composer config minimum-stability dev), which installssymfony/yaml,symfony/serializerandsymfony/framework-bundleat 8.2.x-dev. The full file then passes:(The 6
riskynotices about exception handlers are pre-existing and appear on both.)