rspec-openapi 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48caaf42c5ceaca30f18251c5bf29f427e71385d188f5abcc01295de3eab55b4
4
- data.tar.gz: 171aacce0afccc800c6f5fb1e696dcd2f7d124ad0d09044e7797eb0a353452da
3
+ metadata.gz: 43c486a798aeae6de0f9ecbec34ab2b69a11bb2b1ff053011110c611e5151fc0
4
+ data.tar.gz: f483a6aca96935df40e9b34386b34548f3322982935c3801bab33ee72d20746e
5
5
  SHA512:
6
- metadata.gz: 9a6f77ff9446f74a56bc49576c6340176a58a6a0097e5d96a6b0a5f4334e06dfae55704a2e7dee3f1e12e160cea2a59933616ce2be8e60466f2c9ff10df460ac
7
- data.tar.gz: f75d0f697a19d72408033e8e538643334649c2a7dab832c09e96d47f53f5be2660571d7a2b8b05cc5fdcb1d43fe86e9851f9d5d8e33a4fde8375d12120aa1c2f
6
+ metadata.gz: 7860f7a5030487e9671ee926bcf27967c827a4d80f6119eca70c8e9b330c296a5813bc8412d3b210e679700baef2d8710bcd9c9ca24c8b5890a14d90823f8c36
7
+ data.tar.gz: c2d9e3aaab37b25acc4d1ce563076a2fcb151f33a699268d9035d1559b428f75a75dab52394d0810a0443f031e9f3f338e9996320e5c258b598d0262a71bf1a0
@@ -327,16 +327,30 @@ class << RSpec::OpenAPI::SchemaBuilder
327
327
 
328
328
  def build_merged_schema_from_variations(variations)
329
329
  return {} if variations.empty?
330
- return variations.first if variations.size == 1
331
330
 
332
- types = variations.map { |v| v[:type] }.compact.uniq
333
- return variations.first unless types.size == 1 && types.first == 'object'
331
+ # Drop empty `{}` schemas (e.g. items of an empty array) — they carry no
332
+ # type info and would otherwise spuriously mark every property of their
333
+ # populated siblings as nullable via the missing-key nullable rule.
334
+ non_empty = variations.reject(&:empty?)
335
+ return {} if non_empty.empty?
336
+ return non_empty.first if non_empty.size == 1
334
337
 
335
- {
336
- type: 'object',
337
- properties: merge_property_variations(variations, allow_recursive_merge: true),
338
- required: variations.map { |v| v[:required] || [] }.reduce(:&) || [],
339
- }
338
+ types = non_empty.map { |v| v[:type] }.compact.uniq
339
+ return one_of_schema(non_empty) if types.size > 1
340
+
341
+ case types.first
342
+ when 'object'
343
+ {
344
+ type: 'object',
345
+ properties: merge_property_variations(non_empty, allow_recursive_merge: true),
346
+ required: non_empty.map { |v| v[:required] || [] }.reduce(:&) || [],
347
+ }
348
+ when 'array'
349
+ items_variations = non_empty.map { |v| v[:items] }.compact
350
+ { type: 'array', items: build_merged_schema_from_variations(items_variations) }
351
+ else
352
+ non_empty.first
353
+ end
340
354
  end
341
355
 
342
356
  # Merge the per-key property schemas of multiple object variations.
@@ -377,10 +391,8 @@ class << RSpec::OpenAPI::SchemaBuilder
377
391
  merged =
378
392
  if prop_variations.size == 1
379
393
  prop_variations.first.dup
380
- elsif allow_recursive_merge
381
- merge_multi_recursive(prop_variations)
382
394
  else
383
- merge_multi_array_items(prop_variations)
395
+ merge_multi(prop_variations)
384
396
  end
385
397
 
386
398
  return merged unless merged.is_a?(Hash)
@@ -397,13 +409,16 @@ class << RSpec::OpenAPI::SchemaBuilder
397
409
  merged
398
410
  end
399
411
 
400
- # Array-items mode: combine multiple variations of the same property without
401
- # recursing into nested objects/arrays beyond one level.
402
- def merge_multi_array_items(prop_variations)
403
- unique_types = prop_variations.map { |p| p[:type] }.compact.uniq
404
- return one_of_schema(prop_variations) if unique_types.size > 1
412
+ # Combine multiple variations of the same property: flatten existing oneOf
413
+ # entries, recurse into objects and arrays, and combine divergent types into
414
+ # oneOf. Scalar variations of a single type collapse to the first schema.
415
+ def merge_multi(prop_variations)
416
+ return { oneOf: flatten_one_of(prop_variations) } if prop_variations.any? { |p| p.key?(:oneOf) }
405
417
 
406
- case unique_types.first
418
+ prop_types = prop_variations.map { |p| p[:type] }.compact.uniq
419
+ return one_of_schema(prop_variations) if prop_types.size > 1
420
+
421
+ case prop_types.first
407
422
  when 'array'
408
423
  items_variations = prop_variations.map { |p| p[:items] }.compact
409
424
  { type: 'array', items: build_merged_schema_from_variations(items_variations) }
@@ -414,17 +429,6 @@ class << RSpec::OpenAPI::SchemaBuilder
414
429
  end
415
430
  end
416
431
 
417
- # Recursive-merge mode (used inside build_merged_schema_from_variations):
418
- # additionally flattens existing oneOf entries and recurses into objects.
419
- def merge_multi_recursive(prop_variations)
420
- return { oneOf: flatten_one_of(prop_variations) } if prop_variations.any? { |p| p.key?(:oneOf) }
421
-
422
- prop_types = prop_variations.map { |p| p[:type] }.compact.uniq
423
- return one_of_schema(prop_variations) if prop_types.size > 1
424
-
425
- prop_types.first == 'object' ? build_merged_schema_from_variations(prop_variations) : prop_variations.first.dup
426
- end
427
-
428
432
  def flatten_one_of(prop_variations)
429
433
  prop_variations.each_with_object([]) do |prop, options|
430
434
  clean = without_nullable(prop)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module OpenAPI
5
- VERSION = '0.27.0'
5
+ VERSION = '0.28.0'
6
6
  end
7
7
  end
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
22
22
  }
23
23
 
24
24
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ `git ls-files -z`.split("\x0").select do |f|
26
+ f.start_with?('lib/') || ['LICENSE.txt', 'README.md', 'rspec-openapi.gemspec'].include?(f)
27
+ end
26
28
  end
27
- spec.bindir = 'exe'
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ['lib']
30
30
 
31
31
  spec.add_dependency 'actionpack', '>= 5.2.0'
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  - TATSUNO Yasuhiro
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
11
  date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
@@ -60,26 +60,8 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".github/dependabot.yml"
64
- - ".github/release.yaml"
65
- - ".github/workflows/codeql-analysis.yml"
66
- - ".github/workflows/create_release.yml"
67
- - ".github/workflows/publish.yml"
68
- - ".github/workflows/rubocop.yml"
69
- - ".github/workflows/test.yml"
70
- - ".github/workflows/validate-openapi.yml"
71
- - ".gitignore"
72
- - ".rspec"
73
- - ".rubocop.yml"
74
- - ".rubocop_todo.yml"
75
- - ".simplecov_spawn.rb"
76
- - CHANGELOG.md
77
- - Gemfile
78
63
  - LICENSE.txt
79
64
  - README.md
80
- - Rakefile
81
- - bin/console
82
- - bin/setup
83
65
  - lib/rspec/openapi.rb
84
66
  - lib/rspec/openapi/components_updater.rb
85
67
  - lib/rspec/openapi/default_schema.rb
@@ -104,18 +86,14 @@ files:
104
86
  - lib/rspec/openapi/schema_sorter.rb
105
87
  - lib/rspec/openapi/shared_hooks.rb
106
88
  - lib/rspec/openapi/version.rb
107
- - redocly.yaml
108
89
  - rspec-openapi.gemspec
109
- - scripts/rspec
110
- - scripts/rspec_with_simplecov
111
- - test.png
112
90
  homepage: https://github.com/exoego/rspec-openapi
113
91
  licenses:
114
92
  - MIT
115
93
  metadata:
116
94
  homepage_uri: https://github.com/exoego/rspec-openapi
117
95
  source_code_uri: https://github.com/exoego/rspec-openapi
118
- changelog_uri: https://github.com/exoego/rspec-openapi/releases/tag/v0.27.0
96
+ changelog_uri: https://github.com/exoego/rspec-openapi/releases/tag/v0.28.0
119
97
  rubygems_mfa_required: 'true'
120
98
  rdoc_options: []
121
99
  require_paths:
@@ -1,8 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: "github-actions"
4
- directory: "/"
5
- schedule:
6
- interval: "monthly"
7
- labels:
8
- - "chore"
data/.github/release.yaml DELETED
@@ -1,24 +0,0 @@
1
- changelog:
2
- exclude:
3
- labels:
4
- - ignore-for-release
5
- authors:
6
- - octocat
7
- categories:
8
- - title: 🛠 Breaking Changes
9
- labels:
10
- - semver-major
11
- - breaking-change
12
- - title: 🎉 Exciting New Features
13
- labels:
14
- - semver-minor
15
- - enhancement
16
- - title: 🐞 Bugfixes
17
- labels:
18
- - bug
19
- - title: 📄 Documentation
20
- labels:
21
- - documentation
22
- - title: 📦 Other Changes
23
- labels:
24
- - "*"
@@ -1,39 +0,0 @@
1
- name: "CodeQL"
2
-
3
- on:
4
- push:
5
- branches: [ "master" ]
6
- pull_request:
7
- # The branches below must be a subset of the branches above
8
- branches: [ "master" ]
9
- schedule:
10
- - cron: '20 22 * * 2'
11
-
12
- jobs:
13
- analyze:
14
- name: Analyze
15
- runs-on: ubuntu-latest
16
- permissions:
17
- actions: read
18
- contents: read
19
- security-events: write
20
-
21
- strategy:
22
- fail-fast: false
23
- matrix:
24
- language: [ 'ruby' ]
25
-
26
- steps:
27
- - name: Checkout repository
28
- uses: actions/checkout@v6
29
-
30
- - name: Initialize CodeQL
31
- uses: github/codeql-action/init@v4
32
- with:
33
- languages: ${{ matrix.language }}
34
-
35
- - name: Autobuild
36
- uses: github/codeql-action/autobuild@v4
37
-
38
- - name: Perform CodeQL Analysis
39
- uses: github/codeql-action/analyze@v4
@@ -1,95 +0,0 @@
1
- name: prepare release
2
-
3
- on:
4
- workflow_dispatch:
5
- inputs:
6
- version:
7
- description: 'Version to release (e.g. 0.27.1 or 0.28.0)'
8
- required: true
9
-
10
- jobs:
11
- push:
12
- name: Prepare release PR
13
- runs-on: ubuntu-latest
14
-
15
- steps:
16
- - uses: actions/checkout@v6
17
- with:
18
- fetch-depth: 0
19
- token: ${{ secrets.PREPARE_RELEASE_PAT }}
20
-
21
- - name: Bump version.rb
22
- run: |
23
- set -euo pipefail
24
- version="${{ github.event.inputs.version }}"
25
- version="${version#v}"
26
-
27
- echo "VERSION_NO_V=$version" >> "$GITHUB_ENV"
28
- echo "VERSION_TAG=v$version" >> "$GITHUB_ENV"
29
-
30
- current_version=$(ruby -e "require_relative './lib/rspec/openapi/version'; puts RSpec::OpenAPI::VERSION")
31
- VERSION_NO_V="$version" CURRENT_VERSION="$current_version" ruby - <<'RUBY'
32
- version = ENV.fetch('VERSION_NO_V')
33
- unless version.match?(/\A\d+(?:\.\d+)*\z/)
34
- warn "Invalid version format: #{version}"
35
- exit 1
36
- end
37
-
38
- require 'rubygems'
39
- new_version = Gem::Version.new(version)
40
- current_version = Gem::Version.new(ENV.fetch('CURRENT_VERSION'))
41
- if new_version <= current_version
42
- warn "Given version (#{new_version}) must be newer than current version (#{current_version})"
43
- exit 1
44
- end
45
- RUBY
46
- ruby -pi -e "sub(/VERSION = .*/, \"VERSION = '$version'\")" lib/rspec/openapi/version.rb
47
-
48
- VERSION_NO_V="$version" ruby - <<'RUBY'
49
- version = ENV.fetch('VERSION_NO_V')
50
- segments = version.split('.').map(&:to_i)
51
- unless segments.size >= 3
52
- warn "Version must have at least major.minor.patch: #{version}"
53
- exit 1
54
- end
55
-
56
- major, minor, patch = segments
57
- patch_bump = [major, minor, patch + 1].join('.')
58
- minor_bump = [major, minor + 1, 0].join('.')
59
- example = "Version to release (e.g. #{patch_bump} or #{minor_bump})"
60
-
61
- path = ".github/workflows/create_release.yml"
62
- content = File.read(path)
63
- content.sub!(/description:\s*'Version to release \(e\.g\. [^']+\)'/,
64
- "description: '#{example}'")
65
- File.write(path, content)
66
- RUBY
67
- git status --short
68
-
69
- - name: Commit version bump
70
- run: |
71
- set -euo pipefail
72
- version="$VERSION_NO_V"
73
-
74
- release_branch="release/v${version}"
75
- echo "RELEASE_BRANCH=${release_branch}" >> "$GITHUB_ENV"
76
-
77
- git config user.name "github-actions[bot]"
78
- git config user.email "github-actions[bot]@users.noreply.github.com"
79
- git commit -am "Bump version to ${version}"
80
- git push origin "HEAD:${release_branch}"
81
-
82
- - name: Open release PR
83
- uses: peter-evans/create-pull-request@v8
84
- with:
85
- token: ${{ secrets.PREPARE_RELEASE_PAT }}
86
- add-paths: |
87
- lib/rspec/openapi/version.rb
88
- .github/workflows/create_release.yml
89
- branch: ${{ env.RELEASE_BRANCH }}
90
- title: Release v${{ env.VERSION_NO_V }}
91
- commit-message: Bump version to ${{ env.VERSION_NO_V }}
92
- body: |
93
- Automated release PR created by workflow_dispatch.
94
- - Version: v${{ env.VERSION_NO_V }}
95
- - Triggered by: ${{ github.actor }}
@@ -1,46 +0,0 @@
1
- name: Publish to RubyGems
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*'
7
-
8
- jobs:
9
- publish:
10
- name: Publish gem and GitHub release
11
- runs-on: ubuntu-latest
12
-
13
- permissions:
14
- id-token: write # for RubyGems trusted publishing
15
- contents: write # to create GitHub release
16
-
17
- steps:
18
- - uses: actions/checkout@v6
19
- with:
20
- fetch-depth: 0
21
-
22
- - name: Set up Ruby
23
- uses: ruby/setup-ruby@v1
24
- with:
25
- bundler-cache: true
26
- ruby-version: '4.0'
27
-
28
- - name: Verify tag matches version.rb
29
- run: |
30
- set -euo pipefail
31
- tag="${GITHUB_REF_NAME}"
32
- version="${tag#v}"
33
- file_version=$(ruby -e "require_relative './lib/rspec/openapi/version'; puts RSpec::OpenAPI::VERSION")
34
- if [ "$version" != "$file_version" ]; then
35
- echo "Tag version ($version) does not match lib/rspec/openapi/version.rb ($file_version)" >&2
36
- exit 1
37
- fi
38
-
39
- - uses: rubygems/release-gem@v1
40
-
41
- - name: Create GitHub release
42
- uses: softprops/action-gh-release@v3
43
- with:
44
- tag_name: ${{ github.ref_name }}
45
- name: ${{ github.ref_name }}
46
- generate_release_notes: true
@@ -1,35 +0,0 @@
1
- name: "Rubocop"
2
-
3
- on:
4
- push:
5
- branches: [ "master" ]
6
- pull_request:
7
- branches: [ "master" ]
8
-
9
- jobs:
10
- rubocop:
11
- runs-on: ubuntu-latest
12
- strategy:
13
- fail-fast: false
14
-
15
- steps:
16
- - name: Checkout repository
17
- uses: actions/checkout@v6
18
-
19
- - name: Set up Ruby
20
- uses: ruby/setup-ruby@v1
21
- with:
22
- ruby-version: '4.0'
23
- bundler-cache: true
24
-
25
- - name: Rubocop run
26
- run: |
27
- bash -c "
28
- bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
29
- [[ $? -ne 2 ]]
30
- "
31
-
32
- - name: Upload Sarif output
33
- uses: github/codeql-action/upload-sarif@v4
34
- with:
35
- sarif_file: rubocop.sarif
@@ -1,50 +0,0 @@
1
- name: test
2
- on:
3
- push:
4
- branches:
5
- - master
6
- pull_request:
7
- types:
8
- - opened
9
- - synchronize
10
- - reopened
11
- jobs:
12
- test:
13
- runs-on: ubuntu-latest
14
- container: ${{ matrix.ruby }}
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- include:
19
- - ruby: ruby:2.7
20
- - ruby: ruby:3.0
21
- - ruby: ruby:3.1
22
- - ruby: ruby:3.1
23
- rails: 6.1.7
24
- - ruby: ruby:3.1
25
- rails: 7.0.8
26
- - ruby: ruby:3.3
27
- rails: 7.1.3.2
28
- - ruby: ruby:3.4
29
- rails: 8.0.2
30
- - ruby: ruby:4.0
31
- rails: 8.1.2
32
- coverage: coverage
33
- env:
34
- RAILS_VERSION: ${{ matrix.rails == '' && '6.1.6' || matrix.rails }}
35
- COVERAGE: ${{ matrix.coverage || '' }}
36
- steps:
37
- - uses: actions/checkout@v6
38
- - name: bundle install
39
- run: bundle install -j$(nproc) --retry 3
40
- - run: bundle exec rspec
41
- timeout-minutes: 1
42
- - run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
43
- name: codecov-action@v4 workaround
44
- - name: Upload coverage reports
45
- uses: codecov/codecov-action@v6
46
- if: matrix.coverage == 'coverage'
47
- with:
48
- fail_ci_if_error: true
49
- files: ./coverage/coverage.xml
50
- token: ${{ secrets.CODECOV_TOKEN }}
@@ -1,21 +0,0 @@
1
- name: validate-openapi
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
- types:
9
- - opened
10
- - synchronize
11
- - reopened
12
-
13
- jobs:
14
- redocly-lint:
15
- runs-on: ubuntu-latest
16
- steps:
17
- - uses: actions/checkout@v6
18
- - uses: actions/setup-node@v4
19
- with:
20
- node-version: '22'
21
- - run: npx --yes @redocly/cli@2.30.4 lint
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- /Gemfile.lock
10
- /vendor/
11
- .DS_Store
12
-
13
- # rspec failure tracking
14
- .rspec_status
15
-
16
- spec/apps/rails/log/
17
-
18
- /mise.toml
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --exclude-pattern spec/requests/**/*_spec.rb
2
- --format documentation
3
- --require rspec/openapi
4
- --color
data/.rubocop.yml DELETED
@@ -1,29 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- AllCops:
4
- NewCops: enable
5
- SuggestExtensions: false
6
- TargetRubyVersion: 2.7
7
- Exclude:
8
- - 'spec/apps/**/*'
9
- - 'vendor/**/*'
10
-
11
- Style/TrailingCommaInHashLiteral:
12
- EnforcedStyleForMultiline: consistent_comma
13
- Style/TrailingCommaInArguments:
14
- EnforcedStyleForMultiline: consistent_comma
15
- Style/TrailingCommaInArrayLiteral:
16
- EnforcedStyleForMultiline: consistent_comma
17
- Style/ClassAndModuleChildren:
18
- EnforcedStyle: compact
19
- Exclude:
20
- - 'lib/rspec/openapi/version.rb'
21
- Layout/FirstArrayElementIndentation:
22
- EnforcedStyle: consistent
23
- Style/SymbolArray:
24
- EnforcedStyle: brackets
25
- Style/WordArray:
26
- EnforcedStyle: brackets
27
- Metrics/BlockLength:
28
- Exclude:
29
- - 'spec/**/*'
data/.rubocop_todo.yml DELETED
@@ -1,52 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2026-05-25 01:13:29 UTC using RuboCop version 1.80.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 15
10
- # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
11
- Metrics/AbcSize:
12
- Max: 35
13
-
14
- # Offense count: 4
15
- # Configuration parameters: CountComments, CountAsOne.
16
- Metrics/ClassLength:
17
- Max: 319
18
-
19
- # Offense count: 10
20
- # Configuration parameters: AllowedMethods, AllowedPatterns.
21
- Metrics/CyclomaticComplexity:
22
- Max: 11
23
-
24
- # Offense count: 29
25
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
26
- Metrics/MethodLength:
27
- Max: 26
28
-
29
- # Offense count: 3
30
- # Configuration parameters: AllowedMethods, AllowedPatterns.
31
- Metrics/PerceivedComplexity:
32
- Max: 11
33
-
34
- # Offense count: 1
35
- # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
36
- # SupportedStyles: snake_case, normalcase, non_integer
37
- # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
38
- Naming/VariableNumber:
39
- Exclude:
40
- - 'spec/integration_tests/roda_test.rb'
41
-
42
- # Offense count: 8
43
- # Configuration parameters: AllowedConstants.
44
- Style/Documentation:
45
- Exclude:
46
- - 'spec/**/*'
47
- - 'test/**/*'
48
- - 'lib/rspec/openapi.rb'
49
- - 'lib/rspec/openapi/minitest_hooks.rb'
50
- - 'lib/rspec/openapi/result_recorder.rb'
51
- - 'lib/rspec/openapi/schema_file.rb'
52
- - 'lib/rspec/openapi/shared_hooks.rb'
data/.simplecov_spawn.rb DELETED
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- unless ENV['COVERAGE'] && ENV['COVERAGE'].empty?
4
- require 'simplecov'
5
- require 'simplecov-cobertura'
6
-
7
- SimpleCov.at_fork.call(Process.pid)
8
- SimpleCov.formatter SimpleCov::Formatter::MultiFormatter.new([
9
- SimpleCov::Formatter::CoberturaFormatter,
10
- ])
11
- SimpleCov.start do
12
- enable_coverage :branch
13
- add_filter '/spec/'
14
- add_filter '/scripts/'
15
- end
16
- end
data/CHANGELOG.md DELETED
@@ -1,290 +0,0 @@
1
- # THIS CHANGELOG IS DEPRECATED!!
2
-
3
- Refer https://github.com/exoego/rspec-openapi/releases instead.
4
-
5
- ## v0.12.0
6
-
7
- - feat: Initial support of complex schema with manually-added `oneOf`
8
- [#174](https://github.com/exoego/rspec-openapi/pull/174)
9
- - chore: Test with Ruby 3.3 and Rails 7.1.x
10
- [#169](https://github.com/exoego/rspec-openapi/pull/169)
11
-
12
- ## v0.11.0
13
- - feat: Allow path-based config overrides
14
- [#162](https://github.com/exoego/rspec-openapi/pull/162)
15
- - enhancement: Sort HTTP methods, response status codes, and contents lexicographically
16
- [#163](https://github.com/exoego/rspec-openapi/pull/163)
17
- - enhancement: Remove parameters that conflict with security schemas
18
- [#166](https://github.com/exoego/rspec-openapi/pull/166)
19
-
20
- ## v0.10.0
21
- - bugfix: Merge parameter data to preserve description in manually edited Openapi spec
22
- [#149](https://github.com/exoego/rspec-openapi/pull/149)
23
- - feat: Add ability to configure which path params to ignore
24
- [#150](https://github.com/exoego/rspec-openapi/pull/150)
25
- - feat: Add custom title
26
- [#147](https://github.com/exoego/rspec-openapi/pull/147)
27
- - feat: Add ability to define custom summary and tags builders
28
- [#148](https://github.com/exoego/rspec-openapi/pull/148)
29
- - enhancement: Sort paths lexicographically so the order of paths is more stable and predictable
30
- [#155](https://github.com/exoego/rspec-openapi/pull/155)
31
- - enhancement: requestBody should not merge requestBody from error examples
32
- [#154](https://github.com/exoego/rspec-openapi/pull/154)
33
-
34
- ## v0.9.0
35
- - bugfix: Fix engine path resolution
36
- [#113](https://github.com/exoego/rspec-openapi/pull/113)
37
- - bugfix: fix multiple uploaded files
38
- [#117](https://github.com/exoego/rspec-openapi/pull/117), [#126](https://github.com/exoego/rspec-openapi/pull/126)
39
- - feat: Add required_request_params to metadata
40
- [#114](https://github.com/exoego/rspec-openapi/pull/114)
41
- - bugfix(minitest):
42
- [#128](https://github.com/exoego/rspec-openapi/pull/128)
43
- - doc(minitest): Add instructions for minitest triggered yaml generation
44
- [#116](https://github.com/exoego/rspec-openapi/pull/116)
45
- - chore: Don't dump records into temporary file
46
- [#127](https://github.com/exoego/rspec-openapi/pull/127)
47
-
48
- ## v0.8.1
49
- - bugfix: Empty `required` array should not be present.
50
- [#111](https://github.com/exoego/rspec-openapi/pull/111)
51
-
52
- ## v0.8.0
53
- - Set `required` in request body and response body
54
- [#95](https://github.com/exoego/rspec-openapi/pull/95), [#98](https://github.com/exoego/rspec-openapi/pull/98)
55
- - Generate OpenAPI with minitest instead of RSpec
56
- [#90](https://github.com/exoego/rspec-openapi/pull/90)
57
- - Generate security schemas via RSpec::OpenAPI.security_schemes
58
- [#84](https://github.com/exoego/rspec-openapi/pull/84)
59
- - Bunch of refactorings
60
-
61
- ## v0.7.2
62
- - $ref enhancements: Support $ref in arbitrary depth
63
- [#82](https://github.com/k0kubun/rspec-openapi/pull/82)
64
-
65
- ## v0.7.1
66
- - $ref enhancements: Auto-generate components referenced in "items"
67
- [#80](https://github.com/k0kubun/rspec-openapi/pull/80)
68
- - Administration
69
- - Setup RuboCop
70
- [#73](https://github.com/k0kubun/rspec-openapi/pull/73)
71
- - Setup CodeQL
72
- [#73](https://github.com/k0kubun/rspec-openapi/pull/73)
73
- - Bump Rails v6.0.3.x to fix bundle failure
74
- [#72](https://github.com/k0kubun/rspec-openapi/pull/72)
75
-
76
- ## v0.7.0
77
- - Generate Response Headers
78
- [#69](https://github.com/k0kubun/rspec-openapi/pull/69)
79
- - Initial support for $ref
80
- [#67](https://github.com/k0kubun/rspec-openapi/pull/67)
81
- - Fixed an empty array is turned into nullable object wrongly
82
- [#70](https://github.com/k0kubun/rspec-openapi/pull/70)
83
-
84
- ## v0.6.1
85
-
86
- * Stabilize the order parameter objects and preserve newer examples
87
- [#59](https://github.com/k0kubun/rspec-openapi/pull/59)
88
-
89
- ## v0.6.0
90
-
91
- * Replace `RSpec::OpenAPI.server_urls` with `RSpec::OpenAPI.servers`
92
- [#60](https://github.com/k0kubun/rspec-openapi/pull/60)
93
-
94
- ## v0.5.1
95
-
96
- * Clarify the version requirement for actionpack
97
- [#62](https://github.com/k0kubun/rspec-openapi/pull/62)
98
-
99
- ## v0.5.0
100
-
101
- * Overwrite fields in an existing schema file instead of leaving all existing fields as is
102
- [#55](https://github.com/k0kubun/rspec-openapi/pull/55)
103
-
104
- ## v0.4.8
105
-
106
- * Fix a bug in nested parameters handling
107
- [#46](https://github.com/k0kubun/rspec-openapi/pull/46)
108
-
109
- ## v0.4.7
110
-
111
- * Add `info` config hash
112
- [#43](https://github.com/k0kubun/rspec-openapi/pull/43)
113
-
114
- ## v0.4.6
115
-
116
- * Fix "No route matched for" error in engine routes
117
- [#38](https://github.com/k0kubun/rspec-openapi/pull/38)
118
-
119
- ## v0.4.5
120
-
121
- * Fix linter issues for `tags` and `summary`
122
- [#40](https://github.com/k0kubun/rspec-openapi/pull/40)
123
-
124
- ## v0.4.4
125
-
126
- * De-duplicate parameters by a combination of `name` and `in`
127
- [#39](https://github.com/k0kubun/rspec-openapi/pull/39)
128
-
129
- ## v0.4.3
130
-
131
- * Allow customizing `schema`, `description`, and `tags` through `:openapi` metadata
132
- [#36](https://github.com/k0kubun/rspec-openapi/pull/36)
133
-
134
- ## v0.4.2
135
-
136
- * Allow using Proc as `RSpec::OpenAPI.path`
137
- [#35](https://github.com/k0kubun/rspec-openapi/pull/35)
138
-
139
- ## v0.4.1
140
-
141
- * Add `RSpec::OpenAPI.example_types` to hook types other than `type: :request`.
142
- [#32](https://github.com/k0kubun/rspec-openapi/pull/32)
143
-
144
- ## v0.4.0
145
-
146
- * Drop `RSpec::OpenAPI.output` introduced in v0.3.20
147
- * Guess whether it's JSON or not by the extension of `RSpec::OpenAPI.path`
148
-
149
- ## v0.3.20
150
-
151
- * Add `RSpec::OpenAPI.output` config to output JSON
152
- [#31](https://github.com/k0kubun/rspec-openapi/pull/31)
153
-
154
- ## v0.3.19
155
-
156
- * Add `server_urls` and `request_headers` configs
157
- [#30](https://github.com/k0kubun/rspec-openapi/pull/30)
158
-
159
- ## v0.3.18
160
-
161
- * Support nested query parameters
162
- [#29](https://github.com/k0kubun/rspec-openapi/pull/29)
163
-
164
- ## v0.3.17
165
-
166
- * Rescue NotImplementedError in the after suite hook as well
167
- [#28](https://github.com/k0kubun/rspec-openapi/pull/28)
168
-
169
- ## v0.3.16
170
-
171
- * Use `media_type` instead of `content_type` for Rails 6.1
172
- [#26](https://github.com/k0kubun/rspec-openapi/pull/26)
173
- * Avoid crashing the after suite hook when it fails to build schema
174
- [#27](https://github.com/k0kubun/rspec-openapi/pull/27)
175
-
176
- ## v0.3.15
177
-
178
- * Fix an error when Content-Disposition header is inline
179
- [#24](https://github.com/k0kubun/rspec-openapi/pull/24)
180
-
181
- ## v0.3.14
182
-
183
- * Avoid an error when an application calls `request.body.read`
184
- [#20](https://github.com/k0kubun/rspec-openapi/pull/20)
185
-
186
- ## v0.3.13
187
-
188
- * Avoid crashing when there's no request made in a spec
189
- [#19](https://github.com/k0kubun/rspec-openapi/pull/19)
190
-
191
- ## v0.3.12
192
-
193
- * Generate `nullable: true` for null fields in schema
194
- [#18](https://github.com/k0kubun/rspec-openapi/pull/18)
195
-
196
- ## v0.3.11
197
-
198
- * Show a filename as an `example` for `ActionDispatch::Http::UploadedFile`
199
- [#17](https://github.com/k0kubun/rspec-openapi/pull/17)
200
-
201
- ## v0.3.10
202
-
203
- * Add `info.version`
204
- [#16](https://github.com/k0kubun/rspec-openapi/pull/16)
205
-
206
- ## v0.3.9
207
-
208
- * Initial support for multipart/form-data
209
- [#12](https://github.com/k0kubun/rspec-openapi/pull/12)
210
-
211
- ## v0.3.8
212
-
213
- * Generate `type: 'number', format: 'float'` instead of `type: 'float'` for Float
214
- [#11](https://github.com/k0kubun/rspec-openapi/issues/11)
215
-
216
- ## v0.3.7
217
-
218
- * Classify tag names and remove controller names from summary in Rails
219
-
220
- ## v0.3.6
221
-
222
- * Fix documents generated by Rails engines
223
-
224
- ## v0.3.5
225
-
226
- * Support finding routes in Rails engines
227
-
228
- ## v0.3.4
229
-
230
- * Generate tags by controller names
231
- [#10](https://github.com/k0kubun/rspec-openapi/issues/10)
232
-
233
- ## v0.3.3
234
-
235
- * Avoid `JSON::ParserError` when a response body is no content
236
- [#9](https://github.com/k0kubun/rspec-openapi/issues/9)
237
-
238
- ## v0.3.2
239
-
240
- * Stop generating format as path parameters in Rails
241
- [#8](https://github.com/k0kubun/rspec-openapi/issues/8)
242
-
243
- ## v0.3.1
244
-
245
- * Add `RSpec::OpenAPI.description_builder` config to dynamically generate a description [experimental]
246
- [#6](https://github.com/k0kubun/rspec-openapi/issues/6)
247
-
248
- ## v0.3.0
249
-
250
- * Initial support of rack-test and non-Rails apps [#5](https://github.com/k0kubun/rspec-openapi/issues/5)
251
-
252
- ## v0.2.2
253
-
254
- * Allow disabling `example` by `RSpec::OpenAPI.enable_example = false`
255
-
256
- ## v0.2.1
257
-
258
- * Generate `example` of request body and path / query params
259
- [#4](https://github.com/k0kubun/rspec-openapi/issues/4)
260
- * Remove a wrapper param created by Rails in request body
261
- [#4](https://github.com/k0kubun/rspec-openapi/issues/4)
262
-
263
- ## v0.2.0
264
-
265
- * Generate `example` of response body [#3](https://github.com/k0kubun/rspec-openapi/issues/3)
266
-
267
- ## v0.1.5
268
-
269
- * Support detecting `float` type [#2](https://github.com/k0kubun/rspec-openapi/issues/2)
270
-
271
- ## v0.1.4
272
-
273
- * Avoid NoMethodError on nil Content-Type
274
- * Include a space between controller and action in summary
275
-
276
- ## v0.1.3
277
-
278
- * Add `RSpec::OpenAPI.comment` configuration
279
-
280
- ## v0.1.2
281
-
282
- * Generate `required: true` for path params [#1](https://github.com/k0kubun/rspec-openapi/issues/1)
283
-
284
- ## v0.1.1
285
-
286
- * Generate a path like `/{id}` instead of `/:id`
287
-
288
- ## v0.1.0
289
-
290
- * Initial release
data/Gemfile DELETED
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in rspec-openapi.gemspec
6
- gemspec
7
-
8
- gem 'rails', ENV['RAILS_VERSION'] || '6.0.6.1'
9
-
10
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
11
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('4.0.0')
12
- gem 'dry-logger', '1.2.1'
13
- gem 'hanami', ENV['HANAMI_VERSION'] || '2.3.2'
14
- else
15
- gem 'dry-logger', '1.0.3'
16
- gem 'hanami', ENV['HANAMI_VERSION'] || '2.1.0'
17
- end
18
- gem 'hanami-controller'
19
- gem 'hanami-router'
20
- end
21
-
22
- gem 'concurrent-ruby', '1.3.4'
23
-
24
- gem 'roda'
25
-
26
- gem 'rails-dom-testing', '~> 2.2'
27
- gem 'rspec-rails', '>= 5.0'
28
-
29
- group :test do
30
- gem 'simplecov', git: 'https://github.com/exoego/simplecov.git', branch: 'branch-fix'
31
- gem 'simplecov-cobertura'
32
- gem 'super_diff'
33
- end
34
-
35
- group :development do
36
- gem 'code-scanning-rubocop'
37
- gem 'pry'
38
- end
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec) do |t|
7
- t.pattern = 'spec/rspec/openapi/**/*_spec.rb'
8
- end
9
-
10
- task default: :spec
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'rspec/openapi'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require 'irb'
15
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/redocly.yaml DELETED
@@ -1,31 +0,0 @@
1
- # Config for `redocly lint` used by .github/workflows/validate-openapi.yml
2
- # to validate test-fixture OpenAPI documents shipped under spec/apps/.
3
- #
4
- # spec/apps/rails/doc/smart/openapi.yaml is intentionally excluded:
5
- # it is the input fixture for the smart-merge feature test (it contains
6
- # unresolved $refs by design), not a complete API description.
7
- extends:
8
- - minimal
9
- apis:
10
- rails-rspec-yaml:
11
- root: spec/apps/rails/doc/rspec_openapi.yaml
12
- rails-rspec-json:
13
- root: spec/apps/rails/doc/rspec_openapi.json
14
- rails-minitest-yaml:
15
- root: spec/apps/rails/doc/minitest_openapi.yaml
16
- rails-minitest-json:
17
- root: spec/apps/rails/doc/minitest_openapi.json
18
- rails-smart-expected:
19
- root: spec/apps/rails/doc/smart/expected.yaml
20
- roda-rspec-yaml:
21
- root: spec/apps/roda/doc/rspec_openapi.yaml
22
- roda-rspec-json:
23
- root: spec/apps/roda/doc/rspec_openapi.json
24
- roda-minitest-yaml:
25
- root: spec/apps/roda/doc/minitest_openapi.yaml
26
- roda-minitest-json:
27
- root: spec/apps/roda/doc/minitest_openapi.json
28
- hanami-yaml:
29
- root: spec/apps/hanami/doc/openapi.yaml
30
- hanami-json:
31
- root: spec/apps/hanami/doc/openapi.json
data/scripts/rspec DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # (The MIT License)
5
- # Copyright (c) 2012 Chad Humphries, David Chelimsky, Myron Marston
6
- # Copyright (c) 2009 Chad Humphries, David Chelimsky
7
- # Copyright (c) 2006 David Chelimsky, The RSpec Development Team
8
- # Copyright (c) 2005 Steven Baker
9
-
10
- require 'rspec/core'
11
- RSpec::Core::Runner.invoke
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # (The MIT License)
5
- # Copyright (c) 2012 Chad Humphries, David Chelimsky, Myron Marston
6
- # Copyright (c) 2009 Chad Humphries, David Chelimsky
7
- # Copyright (c) 2006 David Chelimsky, The RSpec Development Team
8
- # Copyright (c) 2005 Steven Baker
9
-
10
- # Turn on verbose to make sure we not generating any ruby warning
11
- $VERBOSE = true
12
-
13
- # So our "did they run the rspec command?" detection logic thinks
14
- # that we run `rspec`.
15
- $0 = 'rspec'
16
-
17
- # This is necessary for when `--standalone` is being used.
18
- $LOAD_PATH.unshift File.expand_path '../bundle', __dir__
19
-
20
- # For the travis build we put the bundle directory up a directory
21
- # so it can be shared among the repos for faster bundle installs.
22
- $LOAD_PATH.unshift File.expand_path '../../bundle', __dir__
23
-
24
- require 'bundler/setup'
25
-
26
- # To use simplecov while running rspec-core's test suite, we must
27
- # load simplecov _before_ loading any of rspec-core's files.
28
- # So, this executable exists purely as a wrapper script that
29
- # first loads simplecov, and then loads rspec.
30
- begin
31
- # Simplecov emits some ruby warnings when loaded, so silence them.
32
- old_verbose = $VERBOSE
33
- $VERBOSE = false
34
-
35
- unless (ENV.fetch('COVERAGE', nil) && ENV['COVERAGE'].empty?) || RUBY_VERSION < '1.9.3'
36
- require 'simplecov'
37
-
38
- SimpleCov.start do
39
- enable_coverage :branch
40
- end
41
- end
42
- rescue LoadError
43
- # simplecov is not available
44
- ensure
45
- $VERBOSE = old_verbose
46
- end
47
-
48
- load File.expand_path('rspec', __dir__)
data/test.png DELETED
Binary file