Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String keys and Symbol keys mixed up, leading to invalid schema merge #198

Merged
merged 3 commits into from
Mar 28, 2024

Conversation

exoego
Copy link
Owner

@exoego exoego commented Mar 28, 2024

During #196, I found string and symbols are mixed up.

String keys come from the base file (YAML.safe_load(File.read(@path))) and Symbol keys come from the generate specs.
Since String != Symbol, merge is buggy, as seen in c941c62

This PR symbolizes all keys during processing.
Keys are transformed to String back when dumping into YAML file.

@exoego exoego mentioned this pull request Mar 28, 2024
lib/rspec/openapi/schema_file.rb Fixed Show fixed Hide fixed
lib/rspec/openapi/schema_file.rb Fixed Show fixed Hide fixed
lib/rspec/openapi/schema_file.rb Fixed Show fixed Hide fixed
lib/rspec/openapi/schema_merger.rb Fixed Show fixed Hide fixed
lib/rspec/openapi/schema_merger.rb Fixed Show fixed Hide fixed
Copy link

codecov bot commented Mar 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.09%. Comparing base (d8ea652) to head (e5f1549).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #198      +/-   ##
==========================================
+ Coverage   97.02%   97.09%   +0.06%     
==========================================
  Files          14       15       +1     
  Lines         505      516      +11     
  Branches      119      125       +6     
==========================================
+ Hits          490      501      +11     
  Misses         15       15              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@exoego exoego marked this pull request as ready for review March 28, 2024 06:00
@exoego exoego changed the title Add failing test Fixes invalid merge logic Mar 28, 2024
@exoego exoego added the bug Something isn't working label Mar 28, 2024
@exoego exoego merged commit 5c875d7 into master Mar 28, 2024
13 checks passed
@exoego exoego deleted the sym branch March 28, 2024 06:20
@exoego exoego changed the title Fixes invalid merge logic String keys and Symbol keys mixed up, leading to invalid schema merge Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant