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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 11 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- next
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/finch-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
Expand All @@ -25,8 +27,9 @@ jobs:
- name: Run lints
run: ./scripts/lint
test:
timeout-minutes: 10
name: test
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/finch-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
*.gem
.idea/
.ignore
.prism.log
.ruby-lsp/
.yardoc/
Brewfile.lock.json
bin/tapioca
Brewfile.lock.json
doc/
sorbet/*
!/sorbet/config
sorbet/tapioca/*
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.1.0-alpha.12"
".": "0.1.0-alpha.13"
}
12 changes: 12 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,19 @@ Layout/MultilineMethodParameterLineBreaks:
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

Lint/BooleanSymbol:
Enabled: false

# This option occasionally mangles identifier names
Lint/DeprecatedConstants:
Exclude:
- "**/*.rbi"

# We use pattern assertion in tests to ensure correctness.
Lint/DuplicateMatchPattern:
Exclude:
- "test/**/*"

# Fairly useful in tests for pattern assertions.
Lint/EmptyInPattern:
Exclude:
Expand Down Expand Up @@ -119,6 +127,9 @@ Metrics/ParameterLists:
Metrics/PerceivedComplexity:
Enabled: false

Naming/AccessorMethodName:
Enabled: false

# Need to preserve block identifier for documentation.
Naming/BlockForwarding:
Enabled: false
Expand Down Expand Up @@ -244,6 +255,7 @@ Style/SafeNavigation:
Style/SignalException:
Exclude:
- Rakefile
- "**/*.rake"

# We use these sparingly, where we anticipate future branches for the
# inner conditional.
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.0
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 46
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-46640c1b468813b828be61b1af5cb5450f9555c4c757c5a740189906a8d56672.yml
openapi_spec_hash: 1d5845ae61d2c0a143db43d579b048c5
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-e5ab676f0996530fe4c702d8cbb88862ab8382792d01197a9576e06f5a359d00.yml
openapi_spec_hash: 5c0dec3d2e1fea26d5f99560b226aedd
config_hash: 53778a0b839c4f6ad34fbba051f5e8a6
2 changes: 2 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--type-name-tag generic:Generic
--default-return void
--markup markdown
--markup-provider redcarpet
--exclude /rbi
Expand Down
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog

## 0.1.0-alpha.13 (2025-04-29)

Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/Finch-API/finch-api-ruby/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)

### Features

* **api:** api update ([2763397](https://github.com/Finch-API/finch-api-ruby/commit/2763397ba5fb250521e2670796fac35dab3e479d))
* **api:** api update ([e8ea0b2](https://github.com/Finch-API/finch-api-ruby/commit/e8ea0b2f1288158944ee787612d3a7840212e728))
* **api:** api update ([a8916c9](https://github.com/Finch-API/finch-api-ruby/commit/a8916c92f39f9cce9b8b1718e1651d9609b16bb8))
* **api:** api update ([b5ceabb](https://github.com/Finch-API/finch-api-ruby/commit/b5ceabb5157f3cb177c292ac1db38fe2ee2398ed))
* **api:** api update ([9f9b600](https://github.com/Finch-API/finch-api-ruby/commit/9f9b600482ef6c4c257877fab587338311202d1d))
* **api:** api update ([9c98649](https://github.com/Finch-API/finch-api-ruby/commit/9c986495c3111434466d972f42477322385a7794))
* **api:** api update ([7dcee57](https://github.com/Finch-API/finch-api-ruby/commit/7dcee57d8114c3c871e79f660bbf3d6d0aade886))
* **api:** api update ([b0bc9bb](https://github.com/Finch-API/finch-api-ruby/commit/b0bc9bbb1660ee83252d2d646af79cf55dee8ce9))
* **api:** api update ([106335f](https://github.com/Finch-API/finch-api-ruby/commit/106335f11705616838e59a848551c51ca73fec8d))


### Bug Fixes

* invalid enum names ([89de302](https://github.com/Finch-API/finch-api-ruby/commit/89de3026ca9a44c9b038caf0239d5eb1e04c17a1))


### Chores

* add generator safe directory ([7e8da29](https://github.com/Finch-API/finch-api-ruby/commit/7e8da298f02a5cfe40012daffd18ac439c426ff6))
* **internal:** annotate request options with type aliases in sorbet ([6f63db8](https://github.com/Finch-API/finch-api-ruby/commit/6f63db86081f88b411261a50028c95ca16a29e65))
* **internal:** remove unnecessary `rbi/lib` folder ([2238283](https://github.com/Finch-API/finch-api-ruby/commit/2238283c857c1a425133f6ff2f1b4f0ae8b1b84a))
* loosen rubocop rules that don't always make sense ([6699ec0](https://github.com/Finch-API/finch-api-ruby/commit/6699ec06493bd11bd15ef59bdc5c0ba0413f6dba))
* more accurate type annotations and aliases ([b6d3a80](https://github.com/Finch-API/finch-api-ruby/commit/b6d3a804a617710558f198d26947d57fdfefef14))

## 0.1.0-alpha.12 (2025-04-18)

Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/Finch-API/finch-api-ruby/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
Expand Down
125 changes: 125 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
## Setting up the environment

This repository contains a `.ruby-version` file, which should work with either [rbenv](https://github.com/rbenv/rbenv) or [asdf](https://github.com/asdf-vm/asdf) with the [ruby plugin](https://github.com/asdf-vm/asdf-ruby).

Please follow the instructions for your preferred version manager to install the Ruby version specified in the `.ruby-version` file.

To set up the repository, run:

```bash
$ ./scripts/bootstrap
```

This will install all the required dependencies.

## Modifying/Adding code

Most of the SDK is generated code. Modifications to code will be persisted between generations, but may result in merge conflicts between manual patches and changes from the generator. The generator will never modify the contents of `lib/finch_api/helpers/` and `examples/` directory.

## Adding and running examples

All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.

```ruby
#!/usr/bin/env ruby
# frozen_string_literal: true

require_relative "../lib/finch_api"

# ...
```

```bash
$ chmod +x './examples/<your-example>.rb'

# run the example against your api
$ ruby './examples/<your-example>.rb'
```

## Using the repository from source

If you’d like to use the repository from source, you can either install from git or reference a cloned repository:

To install via git in your `Gemfile`:

```ruby
gem "finch-api", git: "https://www.github.com/Finch-API/finch-api-ruby"
```

Alternatively, reference local copy of the repo:

```bash
$ git clone -- 'https://www.github.com/Finch-API/finch-api-ruby' '<path-to-repo>'
```

```ruby
gem "finch-api", path: "<path-to-repo>"
```

## Running commands

Running `rake` by itself will show all runnable commands.

```bash
$ 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.

```bash
$ npx prism mock path/to/your/openapi.yml
```

```bash
$ bundle exec rake test
```

## Linting and formatting

This repository uses [rubocop](https://github.com/rubocop/rubocop) for linting and formatting of `*.rb` and `*.rbi` files. [syntax_tree](https://github.com/ruby-syntax-tree/syntax_tree) is used for formatting `*.rbs` files.

There are two separate type checkers supported by this library: [sorbet](https://github.com/sorbet/sorbet) and [steep](https://github.com/soutaro/steep) are used for verifying `*.rbi` and `*.rbs` files respectively.

To lint and typecheck:

```bash
$ bundle exec rake lint
```

To format and fix all lint issues automatically:

```bash
$ bundle exec rake format
```

## Editor Support

### Ruby LSP

[Ruby LSP](https://github.com/Shopify/ruby-lsp) has quite good support for go to definition, but not auto-completion.

This can be installed along side Solargraph.

### Solargraph

[Solargraph](https://solargraph.org) has quite good support for auto-completion, but not go to definition.

This can be installed along side Ruby LSP.

### Sorbet

[Sorbet](https://sorbet.org) should mostly work out of the box when editing this library directly. However, there are a some caveats due to the colocation of `*.rb` and `*.rbi` files in the same project. These issues should not otherwise manifest when this library is used as a dependency.

1. For go to definition usages, sorbet might get confused and may not always navigate to the correct location.

2. For each generic type in `*.rbi` files, a spurious "Duplicate type member" error is present.

## Documentation Preview

To preview the documentation, run:

```bash
$ bundle exec rake docs:preview [PORT=8808]
```
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ group :development, :test do
gem "minitest-hooks"
gem "minitest-proveit"
gem "minitest-rg"
gem "webmock"
end

group :development, :docs do
Expand Down
15 changes: 14 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
finch-api (0.1.0.pre.alpha.11)
finch-api (0.1.0.pre.alpha.12)
connection_pool

GEM
Expand All @@ -29,6 +29,8 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.3)
async (2.23.1)
console (~> 1.29)
Expand All @@ -45,6 +47,9 @@ GEM
fiber-annotation
fiber-local (~> 1.1)
json
crack (1.0.0)
bigdecimal
rexml
csv (3.3.3)
drb (2.2.1)
erubi (1.13.1)
Expand All @@ -54,6 +59,7 @@ GEM
fiber-storage
fiber-storage (1.0.0)
fileutils (1.7.3)
hashdiff (1.1.2)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-event (1.10.0)
Expand Down Expand Up @@ -82,6 +88,7 @@ GEM
racc
prettier_print (1.2.1)
prism (1.4.0)
public_suffix (6.0.1)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
Expand All @@ -96,6 +103,7 @@ GEM
logger
redcarpet (3.6.1)
regexp_parser (2.10.0)
rexml (3.4.1)
rubocop (1.75.1)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
Expand Down Expand Up @@ -165,6 +173,10 @@ GEM
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
webmock (3.25.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.9.1)
yard (0.9.37)
yard-sorbet (0.9.0)
Expand All @@ -191,6 +203,7 @@ DEPENDENCIES
syntax_tree
syntax_tree-rbs!
tapioca
webmock
webrick
yard

Expand Down
Loading