rspec-openapi 0.21.2 → 0.21.3

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: 3d8b74f9e75f015e91e3ebc37ab353459d0a8d887fb096ad7e9fcf829898290e
4
- data.tar.gz: 1fdbc903fdb61f685ca02d63a88a82eb9a3184e00a0766f1e31e82001ed068b1
3
+ metadata.gz: d28b278fc0d9e8f0ce356103ea53e7b97392eac4f7c09fda493a9d7b1e2bfa10
4
+ data.tar.gz: 501c53f68a84d09f96f40a0e0749d65b2ceba13d16ebeb4819c989fdd7f62c2e
5
5
  SHA512:
6
- metadata.gz: eb64851800a090a4cf4d9f78921f1203456ddf8b9d4e820af73d9449a259c7d6e5dd9997e01058136b0dc7b551bc5406e2e176f2818c27b6d7e5a6a00a136fb3
7
- data.tar.gz: 82600b4917083f3b4a27f7bf4ee8b8b4314dc76a4c9c03f5143e5e182d652edea3cb6cef97f7b2f3598a2c27f143fdcb714058143d47fb44d2ccb6181fafe4fd
6
+ metadata.gz: 7e4636d3f30bb1114932aabdb6ae2ef40bb9492a08d5d7c9022f52d8b5e4a415e424abc8611a14a8f7f6d8c139947ee900bc50cdfafda19e95bcd6cb06d26142
7
+ data.tar.gz: 8a3e455ed8a022f5e9df443a14f3159665b77ca4a416b6b3f29404efd367717060f7121fd1a3ec77190d1bc426850b58faf2cc6092c7acc9c18e8f78e732aeb7
@@ -0,0 +1,79 @@
1
+ name: prepare release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: 'Version to release (e.g. 0.21.3 or v0.21.3)'
8
+ required: true
9
+
10
+ jobs:
11
+ push:
12
+ name: Prepare release PR
13
+ runs-on: ubuntu-latest
14
+
15
+ permissions:
16
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
17
+ contents: write # required to push release branch and open PR
18
+ pull-requests: write # required to create the release PR with GITHUB_TOKEN
19
+
20
+ steps:
21
+ - uses: actions/checkout@v5
22
+ with:
23
+ fetch-depth: 0
24
+
25
+ - name: Bump version.rb
26
+ run: |
27
+ set -euo pipefail
28
+ version="${{ github.event.inputs.version }}"
29
+ version="${version#v}"
30
+
31
+ echo "VERSION_NO_V=$version" >> "$GITHUB_ENV"
32
+ echo "VERSION_TAG=v$version" >> "$GITHUB_ENV"
33
+
34
+ current_version=$(ruby -e "require_relative './lib/rspec/openapi/version'; puts RSpec::OpenAPI::VERSION")
35
+ VERSION_NO_V="$version" CURRENT_VERSION="$current_version" ruby - <<'RUBY'
36
+ version = ENV.fetch('VERSION_NO_V')
37
+ unless version.match?(/\A\d+(?:\.\d+)*\z/)
38
+ warn "Invalid version format: #{version}"
39
+ exit 1
40
+ end
41
+
42
+ require 'rubygems'
43
+ new_version = Gem::Version.new(version)
44
+ current_version = Gem::Version.new(ENV.fetch('CURRENT_VERSION'))
45
+ if new_version <= current_version
46
+ warn "Given version (#{new_version}) must be newer than current version (#{current_version})"
47
+ exit 1
48
+ end
49
+ RUBY
50
+
51
+ ruby -pi -e "sub(/VERSION = .*/, \"VERSION = '$version'\")" lib/rspec/openapi/version.rb
52
+ git status --short
53
+
54
+ - name: Commit version bump
55
+ run: |
56
+ set -euo pipefail
57
+ version="$VERSION_NO_V"
58
+
59
+ release_branch="release/v${version}"
60
+ echo "RELEASE_BRANCH=${release_branch}" >> "$GITHUB_ENV"
61
+
62
+ git config user.name "github-actions[bot]"
63
+ git config user.email "github-actions[bot]@users.noreply.github.com"
64
+ git commit -am "Bump version to ${version}"
65
+ git push origin "HEAD:${release_branch}"
66
+
67
+ - name: Open release PR
68
+ uses: peter-evans/create-pull-request@v6
69
+ with:
70
+ token: ${{ secrets.GITHUB_TOKEN }}
71
+ add-paths: |
72
+ lib/rspec/openapi/version.rb
73
+ branch: ${{ env.RELEASE_BRANCH }}
74
+ title: Release v${{ env.VERSION_NO_V }}
75
+ commit-message: Bump version to ${{ env.VERSION_NO_V }}
76
+ body: |
77
+ Automated release PR created by workflow_dispatch.
78
+ - Version: v${{ env.VERSION_NO_V }}
79
+ - Triggered by: ${{ github.actor }}
@@ -0,0 +1,46 @@
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@v5
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: ruby
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@v2
43
+ with:
44
+ tag_name: ${{ github.ref_name }}
45
+ name: ${{ github.ref_name }}
46
+ generate_release_notes: true
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /Gemfile.lock
10
+ /vendor/
10
11
  .DS_Store
11
12
 
12
13
  # rspec failure tracking
data/README.md CHANGED
@@ -410,9 +410,10 @@ Existing RSpec plugins which have OpenAPI integration:
410
410
 
411
411
  ## Releasing
412
412
 
413
- 1. Bump version in `lib/rspec/openapi/version.rb`
414
- 2. Run `bundle exec rake release`
415
- 3. Push tag
413
+ 1. Ensure RubyGems trusted publishing is configured for this repo and gem ownership (see [Trusted publishing](https://guides.rubygems.org/trusted-publishing/)).
414
+ 2. In GitHub Actions, run the `prepare release` workflow manually. It bumps `lib/rspec/openapi/version.rb`, pushes `release/v<version>` to origin, and opens a PR.
415
+ 3. Review and merge the release PR into the default branch.
416
+ 4. Create and push a tag `v<version>` on the merged commit (via the GitHub UI or `git tag v<version>; git push origin v<version>`). Tag creation triggers the `Publish to RubyGems` workflow, which publishes the gem and creates the GitHub release notes automatically.
416
417
 
417
418
  ## License
418
419
 
@@ -311,7 +311,9 @@ class << RSpec::OpenAPI::SchemaBuilder = Object.new
311
311
 
312
312
  has_nullable = all_prop_variations.any?(&:nil?) || nullable_only.any?
313
313
 
314
- if prop_variations.size == 1
314
+ if prop_variations.empty? && has_nullable
315
+ merged[:properties][key] = { nullable: true }
316
+ elsif prop_variations.size == 1
315
317
  merged[:properties][key] = prop_variations.first.dup
316
318
  merged[:properties][key][:nullable] = true if has_nullable
317
319
  elsif prop_variations.size > 1
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module OpenAPI
5
- VERSION = '0.21.2'
5
+ VERSION = '0.21.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.2
4
+ version: 0.21.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -63,6 +63,8 @@ files:
63
63
  - ".github/dependabot.yml"
64
64
  - ".github/release.yaml"
65
65
  - ".github/workflows/codeql-analysis.yml"
66
+ - ".github/workflows/create_release.yml"
67
+ - ".github/workflows/publish.yml"
66
68
  - ".github/workflows/rubocop.yml"
67
69
  - ".github/workflows/test.yml"
68
70
  - ".gitignore"
@@ -108,7 +110,7 @@ licenses:
108
110
  metadata:
109
111
  homepage_uri: https://github.com/exoego/rspec-openapi
110
112
  source_code_uri: https://github.com/exoego/rspec-openapi
111
- changelog_uri: https://github.com/exoego/rspec-openapi/releases/tag/v0.21.2
113
+ changelog_uri: https://github.com/exoego/rspec-openapi/releases/tag/v0.21.3
112
114
  rubygems_mfa_required: 'true'
113
115
  rdoc_options: []
114
116
  require_paths: