Skip to content
Open
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
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sorbet/rbi/annotations linguist-generated=true
sorbet/rbi/gems linguist-generated=true
sorbet/rbi/dsl linguist-generated=true
sorbet/rbi/todo.rbi linguist-generated=true
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## UNRELEASED

- Feature: Generate Sorbet declarations in schema classes.
- BREAKING CHANGE: The `initialize_from_value` method has been moved from the base class to the generated classes. You will need to regenerate your schema classes after upgrading.
- BREAKING CHANGE: The `to_h` method in the `PhobosConfig` module has been removed, as it's not used within Deimos. If for some odd reason you were still using this method, please don't (even better, please stop using `phobos.yml`).
- BREAKING CHANGE: Fields that are not optional (that don't allow null and have no default value) are now generated as a required keyword parameter instead of an optional one. Any code that isn't passing a value is probably already breaking, although you might not realize it, so if anything this should make your code better, not worse. 😄
- CHANGE: Removed generated `rbs` files in favor of `rbi` files. Sorbet has much better support than RBS and there are plans to allow for translation between the two within `tapioca`.

# 1.22.5 - 2023-07-18
- Fix: Fixed buffer overflow crash with DB producer.

Expand Down
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

source 'https://rubygems.org'

# Specify your gem's dependencies in boilerplate.gemspec
gemspec

# TODO: Remove these once they are merged

gem 'sord', git: 'https://github.com/dorner/sord', branch: 'resolve-namespaces'
gem 'parlour', git: 'https://github.com/dorner/parlour', branch: 'fix-crash-on-activesupport'
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,10 @@ One additional configuration option indicates whether nested records should be g

You can generate a tombstone message (with only a key and no value) by calling the `YourSchemaClass.tombstone(key)` method. If you're using a `:field` key config, you can pass in just the key scalar value. If using a key schema, you can pass it in as a hash or as another schema class.

### Sorbet functionality

Deimos ships with a Tapioca DSL compiler that will automatically generate `.rbi` files when you run `tapioca dsl`. Alternatively, you can set the `schema.output_sorbet` option to true to generate `sig` declarations inline within generated code.

### Consumer

The consumer interface uses the `decode_message` method to turn JSON hash into the Schemas
Expand Down
8 changes: 0 additions & 8 deletions Steepfile

This file was deleted.

27 changes: 27 additions & 0 deletions bin/tapioca
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'tapioca' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("tapioca", "tapioca")
Loading