riffer 0.47.0 → 0.47.1
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 +4 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +8 -0
- data/docs/AGENTS.md +1 -1
- data/lib/riffer/params/param.rb +21 -2
- data/lib/riffer/params.rb +2 -0
- data/lib/riffer/version.rb +1 -1
- data/sig/generated/riffer/params/param.rbs +10 -1
- data/sig/generated/riffer/params.rbs +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ac69c8c20b892c53242b0fb792aee2ee1ce5da1ab02b1c53536fa8d1c006f08
|
|
4
|
+
data.tar.gz: 0fa02ebc739e1968167e517a41d4f0a2cabff5a5845862ac78980d207638c6cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5c0363ce9dad27ccfc899d6c7f4e71123eaa9ae5ceec8e50387575f0642c7696f07de37cb987c45099aee999fe5ac39c8635f07f36efb784c3341bd8a4c6a6aa
|
|
7
|
+
data.tar.gz: 4b5d6209255a46d9abd52275021709740bf0e87676c20c3bd9240f12acddc7768a050391530970c2a2ed407dbdd27fb50a1b03e43caff8361ad6f28cc67884db
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.47.1](https://github.com/janeapp/riffer/compare/riffer/v0.47.0...riffer/v0.47.1) (2026-09-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **params:** keep optional Hash params nullable in strict JSON Schema ([#433](https://github.com/janeapp/riffer/issues/433)) ([c7308fd](https://github.com/janeapp/riffer/commit/c7308fd15a3293877510e74c41662a68fac942df))
|
|
14
|
+
* **params:** raise for bare Hash and Array params under strict schemas ([#434](https://github.com/janeapp/riffer/issues/434)) ([174ad92](https://github.com/janeapp/riffer/commit/174ad92e7c765dc8833695ded9d2920f1ab27337))
|
|
15
|
+
|
|
8
16
|
## [0.47.0](https://github.com/janeapp/riffer/compare/riffer/v0.46.1...riffer/v0.47.0) (2026-09-11)
|
|
9
17
|
|
|
10
18
|
|
data/docs/AGENTS.md
CHANGED
|
@@ -247,7 +247,7 @@ end
|
|
|
247
247
|
|
|
248
248
|
#### Limitations
|
|
249
249
|
|
|
250
|
-
Using both `of:` and a block raises `Riffer::ArgumentError`. Using `of:` with a non-primitive type (e.g. `of: Hash`) also raises `Riffer::ArgumentError`.
|
|
250
|
+
A `Hash` param requires a block, and an `Array` param requires a block or `of:`. Using both `of:` and a block raises `Riffer::ArgumentError`. Using `of:` with a non-primitive type (e.g. `of: Hash`) also raises `Riffer::ArgumentError`.
|
|
251
251
|
|
|
252
252
|
Structured output is not compatible with streaming — calling `stream` on an agent with structured output configured raises `Riffer::ArgumentError`.
|
|
253
253
|
|
data/lib/riffer/params/param.rb
CHANGED
|
@@ -140,10 +140,14 @@ class Riffer::Params::Param
|
|
|
140
140
|
# params are made nullable (<tt>["type", "null"]</tt>) so strict providers
|
|
141
141
|
# distinguish absent from present; optional params with an +enum+ use +anyOf+
|
|
142
142
|
# instead, since providers like Anthropic reject
|
|
143
|
-
# <tt>{"type": ["string", "null"], "enum": [...]}</tt>.
|
|
143
|
+
# <tt>{"type": ["string", "null"], "enum": [...]}</tt>. Raises
|
|
144
|
+
# Riffer::ArgumentError when +strict+ and a Hash param has no block or an
|
|
145
|
+
# Array param has neither a block nor <tt>of:</tt>, since strict providers
|
|
146
|
+
# reject objects without +properties+ and arrays without +items+.
|
|
144
147
|
#--
|
|
145
148
|
#: (?strict: bool) -> Hash[Symbol, untyped]
|
|
146
149
|
def to_json_schema(strict: false)
|
|
150
|
+
validate_strict_shape! if strict
|
|
147
151
|
nullable = strict && !required
|
|
148
152
|
|
|
149
153
|
if nullable && enum
|
|
@@ -168,9 +172,24 @@ class Riffer::Params::Param
|
|
|
168
172
|
elsif self.type == Array && item_type
|
|
169
173
|
schema[:items] = { type: TYPE_MAPPINGS[item_type] }
|
|
170
174
|
elsif self.type == Hash && nested_params
|
|
171
|
-
schema
|
|
175
|
+
# The nested schema carries its own type: "object", which would clobber a nullable union.
|
|
176
|
+
schema.merge!(nested_params.to_json_schema(strict: strict).except(:type))
|
|
172
177
|
end
|
|
173
178
|
|
|
174
179
|
schema
|
|
175
180
|
end
|
|
181
|
+
|
|
182
|
+
private
|
|
183
|
+
|
|
184
|
+
#--
|
|
185
|
+
#: () -> void
|
|
186
|
+
def validate_strict_shape!
|
|
187
|
+
if type == Hash && nested_params.nil?
|
|
188
|
+
raise Riffer::ArgumentError,
|
|
189
|
+
"#{name}: a Hash param requires a block defining its properties under strict schemas"
|
|
190
|
+
elsif type == Array && nested_params.nil? && item_type.nil?
|
|
191
|
+
raise Riffer::ArgumentError,
|
|
192
|
+
"#{name}: an Array param requires a block or of: defining its items under strict schemas"
|
|
193
|
+
end
|
|
194
|
+
end
|
|
176
195
|
end
|
data/lib/riffer/params.rb
CHANGED
|
@@ -128,6 +128,8 @@ class Riffer::Params
|
|
|
128
128
|
# Converts all parameters to JSON Schema format. When +strict+ is true, every
|
|
129
129
|
# property is listed in +required+ and optional ones are made nullable
|
|
130
130
|
# instead, satisfying providers that enforce strict structured output schemas.
|
|
131
|
+
# Raises Riffer::ArgumentError when +strict+ and a Hash param (at any depth)
|
|
132
|
+
# has no block or an Array param has neither a block nor <tt>of:</tt>.
|
|
131
133
|
#--
|
|
132
134
|
#: (?strict: bool) -> Hash[Symbol, untyped]
|
|
133
135
|
def to_json_schema(strict: false)
|
data/lib/riffer/version.rb
CHANGED
|
@@ -74,8 +74,17 @@ class Riffer::Params::Param
|
|
|
74
74
|
# params are made nullable (<tt>["type", "null"]</tt>) so strict providers
|
|
75
75
|
# distinguish absent from present; optional params with an +enum+ use +anyOf+
|
|
76
76
|
# instead, since providers like Anthropic reject
|
|
77
|
-
# <tt>{"type": ["string", "null"], "enum": [...]}</tt>.
|
|
77
|
+
# <tt>{"type": ["string", "null"], "enum": [...]}</tt>. Raises
|
|
78
|
+
# Riffer::ArgumentError when +strict+ and a Hash param has no block or an
|
|
79
|
+
# Array param has neither a block nor <tt>of:</tt>, since strict providers
|
|
80
|
+
# reject objects without +properties+ and arrays without +items+.
|
|
78
81
|
# --
|
|
79
82
|
# : (?strict: bool) -> Hash[Symbol, untyped]
|
|
80
83
|
def to_json_schema: (?strict: bool) -> Hash[Symbol, untyped]
|
|
84
|
+
|
|
85
|
+
private
|
|
86
|
+
|
|
87
|
+
# --
|
|
88
|
+
# : () -> void
|
|
89
|
+
def validate_strict_shape!: () -> void
|
|
81
90
|
end
|
|
@@ -54,6 +54,8 @@ class Riffer::Params
|
|
|
54
54
|
# Converts all parameters to JSON Schema format. When +strict+ is true, every
|
|
55
55
|
# property is listed in +required+ and optional ones are made nullable
|
|
56
56
|
# instead, satisfying providers that enforce strict structured output schemas.
|
|
57
|
+
# Raises Riffer::ArgumentError when +strict+ and a Hash param (at any depth)
|
|
58
|
+
# has no block or an Array param has neither a block nor <tt>of:</tt>.
|
|
57
59
|
# --
|
|
58
60
|
# : (?strict: bool) -> Hash[Symbol, untyped]
|
|
59
61
|
def to_json_schema: (?strict: bool) -> Hash[Symbol, untyped]
|