Skip to content

Conversation

@ipepe
Copy link
Contributor

@ipepe ipepe commented Jun 12, 2025

Fixes #249 by adding Date to permitted_classes of YAML.safe_load in RSpec::OpenAPI::SchemaFile#read.

Changes

  • allow Date and Time when reading YAML schema files
  • add regression test for SchemaFile

@ipepe ipepe force-pushed the fix-psych--disallowedclass-error-in-ruby-3.1 branch from a1d3f9b to ac89c4c Compare June 12, 2025 18:53
@codecov
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.27%. Comparing base (099958e) to head (ac389d0).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #256   +/-   ##
=======================================
  Coverage   97.26%   97.27%           
=======================================
  Files          20       20           
  Lines         658      660    +2     
  Branches      148      148           
=======================================
+ Hits          640      642    +2     
  Misses         18       18           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +6 to +7
require 'date'
require 'time'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nits]
require 'yaml' also loads Date. Time is available without requiring anything explicitly.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require 'spec_helper'

RSpec.describe RSpec::OpenAPI::SchemaFile do
describe '#read' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[imho]
How about adding unquoted dates or times to the OpenAPI schema in spec/apps/ instead of writing tests for the private method?

What should be tested is not whether unquoted dates or times are loaded, but whether the resulting OpenAPI schema output is correct—and whether it can be successfully loaded.

@exoego exoego added the bug Something isn't working label Sep 3, 2025
@exoego
Copy link
Owner

exoego commented Sep 3, 2025

LGTM
Aafter merging this, I am going to address some enhancements coined by rhiroe

@exoego exoego merged commit 0c8867e into exoego:master Sep 3, 2025
14 checks passed
@exoego exoego added enhancement New feature or request and removed bug Something isn't working labels Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem loading openapi.yml after ruby update to 3.2.7

3 participants