Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
branches:
- '**'
- '!integrated/**'
- '!stl-preview-head/**'
- '!stl-preview-base/**'
- '!generated'
- '!codegen/**'
- 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
Expand All @@ -22,7 +24,7 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/openlayer-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/openlayer-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork)
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.idea/
.ignore
.prism.log
.stdy.log
.ruby-lsp/
.yardoc/
bin/tapioca
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.11.1"
".": "0.11.2"
}
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## 0.11.2 (2026-04-01)

Full Changelog: [v0.11.1...v0.11.2](https://github.com/openlayer-ai/openlayer-ruby/compare/v0.11.1...v0.11.2)

### Bug Fixes

* align path encoding with RFC 3986 section 3.3 ([a90bfa7](https://github.com/openlayer-ai/openlayer-ruby/commit/a90bfa710bb3a147c4fd3111277b68b90c01c045))
* **internal:** correct multipart form field name encoding ([c24ad06](https://github.com/openlayer-ai/openlayer-ruby/commit/c24ad0620d508c3cfd145cf19d2d40ab901b35eb))
* variable name typo ([19d1897](https://github.com/openlayer-ai/openlayer-ruby/commit/19d189791f600b61eccf061d440082f4e382b2e7))


### Chores

* **ci:** skip lint on metadata-only changes ([8e5f101](https://github.com/openlayer-ai/openlayer-ruby/commit/8e5f1015976b3ba55d72f9e5cb39325f2811f344))
* **ci:** support opting out of skipping builds on metadata-only commits ([13a5bb1](https://github.com/openlayer-ai/openlayer-ruby/commit/13a5bb13c5a0a2c3faf30f8411275f3738270084))
* **internal:** tweak CI branches ([b95bc79](https://github.com/openlayer-ai/openlayer-ruby/commit/b95bc79023ccd19d272e07135656e0aa07d6fecb))
* **internal:** update gitignore ([505f7b6](https://github.com/openlayer-ai/openlayer-ruby/commit/505f7b6bd6324aec3272ce3b03926211d9e8f1bf))
* **tests:** bump steady to v0.19.4 ([1768e99](https://github.com/openlayer-ai/openlayer-ruby/commit/1768e99b6ae5cfd9fd4c9629c075e0a1f9cbf5b8))
* **tests:** bump steady to v0.19.5 ([95ea180](https://github.com/openlayer-ai/openlayer-ruby/commit/95ea180eb1948e3825c33762ad3f9a056d613868))
* **tests:** bump steady to v0.19.6 ([0223b02](https://github.com/openlayer-ai/openlayer-ruby/commit/0223b0225c2fb18f91d84dca822e43481157dd3a))
* **tests:** bump steady to v0.19.7 ([f4894d6](https://github.com/openlayer-ai/openlayer-ruby/commit/f4894d67465dd4630515906b439420b7dd435c22))
* **tests:** bump steady to v0.20.1 ([825869e](https://github.com/openlayer-ai/openlayer-ruby/commit/825869e4c7e722a3ae8460289498c59e584702f3))
* **tests:** bump steady to v0.20.2 ([e576f39](https://github.com/openlayer-ai/openlayer-ruby/commit/e576f39c822911696172907d72ece4033534529d))


### Refactors

* **tests:** switch from prism to steady ([80fd726](https://github.com/openlayer-ai/openlayer-ruby/commit/80fd7262b08c8b30a1e639ccfc9e53a3534542c7))

## 0.11.1 (2026-03-08)

Full Changelog: [v0.11.0...v0.11.1](https://github.com/openlayer-ai/openlayer-ruby/compare/v0.11.0...v0.11.1)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $ bundle exec rake

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests.

```sh
$ ./scripts/mock
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
openlayer (0.11.1)
openlayer (0.11.2)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "openlayer", "~> 0.11.1"
gem "openlayer", "~> 0.11.2"
```

<!-- x-release-please-end -->
Expand Down
25 changes: 19 additions & 6 deletions lib/openlayer/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def coerce_hash!(input)
in Hash | nil => coerced
coerced
else
message = "Expected a #{Hash} or #{Openlayer::Internal::Type::BaseModel}, got #{data.inspect}"
message = "Expected a #{Hash} or #{Openlayer::Internal::Type::BaseModel}, got #{input.inspect}"
raise ArgumentError.new(message)
end
end
Expand Down Expand Up @@ -237,6 +237,11 @@ def dig(data, pick, &blk)
end
end

# @type [Regexp]
#
# https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/

class << self
# @api private
#
Expand All @@ -247,6 +252,15 @@ def uri_origin(uri)
"#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
end

# @api private
#
# @param path [String, Integer]
#
# @return [String]
def encode_path(path)
path.to_s.gsub(Openlayer::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
end

# @api private
#
# @param path [String, Array<String>]
Expand All @@ -259,7 +273,7 @@ def interpolate_path(path)
in []
""
in [String => p, *interpolations]
encoded = interpolations.map { ERB::Util.url_encode(_1) }
encoded = interpolations.map { encode_path(_1) }
format(p, *encoded)
end
end
Expand Down Expand Up @@ -571,16 +585,15 @@ def encode_query_params(query)
y << "Content-Disposition: form-data"

unless key.nil?
name = ERB::Util.url_encode(key.to_s)
y << "; name=\"#{name}\""
y << "; name=\"#{key}\""
end

case val
in Openlayer::FilePart unless val.filename.nil?
filename = ERB::Util.url_encode(val.filename)
filename = encode_path(val.filename)
y << "; filename=\"#{filename}\""
in Pathname | IO
filename = ERB::Util.url_encode(::File.basename(val.to_path))
filename = encode_path(::File.basename(val.to_path))
y << "; filename=\"#{filename}\""
else
end
Expand Down
2 changes: 1 addition & 1 deletion lib/openlayer/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Openlayer
VERSION = "0.11.1"
VERSION = "0.11.2"
end
8 changes: 8 additions & 0 deletions rbi/openlayer/internal/util.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,20 @@ module Openlayer
end
end

# https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)

class << self
# @api private
sig { params(uri: URI::Generic).returns(String) }
def uri_origin(uri)
end

# @api private
sig { params(path: T.any(String, Integer)).returns(String) }
def encode_path(path)
end

# @api private
sig { params(path: T.any(String, T::Array[String])).returns(String) }
def interpolate_path(path)
Expand Down
26 changes: 13 additions & 13 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,34 @@ fi

echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
# Run steady mock on the given spec
if [ "$1" == "--daemon" ]; then
# Pre-install the package so the download doesn't eat into the startup timeout
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version
npm exec --package=@stdy/cli@0.20.2 -- steady --version

npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log &

# Wait for server to come online (max 30s)
# Wait for server to come online via health endpoint (max 30s)
echo -n "Waiting for server"
attempts=0
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do
if ! kill -0 $! 2>/dev/null; then
echo
cat .stdy.log
exit 1
fi
attempts=$((attempts + 1))
if [ "$attempts" -ge 300 ]; then
echo
echo "Timed out waiting for Prism server to start"
cat .prism.log
echo "Timed out waiting for Steady server to start"
cat .stdy.log
exit 1
fi
echo -n "."
sleep 0.1
done

if grep -q "✖ fatal" ".prism.log"; then
cat .prism.log
exit 1
fi

echo
else
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL"
fi
16 changes: 8 additions & 8 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function prism_is_running() {
curl --silent "http://localhost:4010" >/dev/null 2>&1
function steady_is_running() {
curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1
}

kill_server_on_port() {
Expand All @@ -25,7 +25,7 @@ function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}

if ! is_overriding_api_base_url && ! prism_is_running ; then
if ! is_overriding_api_base_url && ! steady_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT

Expand All @@ -36,19 +36,19 @@ fi
if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
elif ! prism_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
elif ! steady_is_running ; then
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server"
echo -e "running against your OpenAPI spec."
echo
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo -e "spec to the steady command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.2 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}"
echo

exit 1
else
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}"
echo
fi

Expand Down
4 changes: 4 additions & 0 deletions sig/openlayer/internal/util.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ module Openlayer
-> top?
} -> top?

RFC_3986_NOT_PCHARS: Regexp

def self?.uri_origin: (URI::Generic uri) -> String

def self?.encode_path: (String | Integer path) -> String

def self?.interpolate_path: (String | ::Array[String] path) -> String

def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
Expand Down