riffer 0.16.0 → 0.16.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 +7 -0
- data/lib/riffer/param.rb +13 -1
- data/lib/riffer/version.rb +1 -1
- data/sig/generated/riffer/param.rbs +4 -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: dd7f9f22c84f8d3680662d9cac4b242f0425395f510b36654c910b91448dc34f
|
|
4
|
+
data.tar.gz: 1718dd3b5ca59e62f3287e7ecdfdff201de124bcd2230687a7e3d5ed554fdc95
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bda15f6aef23966f078cbae8be85dce02f177d9d51cc8fb9c08368dc113dbac8efe6ecbe356ae22a5eba043a98278622f1ddc10126eaada061b98eec849ea75c
|
|
7
|
+
data.tar.gz: 02f951011443b6ce726292be3f19ceb870b1177c03a3eb78b876170aef4d667b583def11e0242acee130c6e87654c262a0f91df366daf537060be2f88aa33283
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ 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.16.1](https://github.com/janeapp/riffer/compare/riffer/v0.16.0...riffer/v0.16.1) (2026-03-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* use anyOf for optional enum params in strict JSON Schema ([#152](https://github.com/janeapp/riffer/issues/152)) ([2c7fc4d](https://github.com/janeapp/riffer/commit/2c7fc4db4eda33f6fbcbe4b3799b602050af058d))
|
|
14
|
+
|
|
8
15
|
## [0.16.0](https://github.com/janeapp/riffer/compare/riffer/v0.15.1...riffer/v0.16.0) (2026-02-27)
|
|
9
16
|
|
|
10
17
|
|
data/lib/riffer/param.rb
CHANGED
|
@@ -67,10 +67,22 @@ class Riffer::Param
|
|
|
67
67
|
# (+["type", "null"]+) so that strict mode providers can distinguish
|
|
68
68
|
# "absent" from "present" without rejecting the schema.
|
|
69
69
|
#
|
|
70
|
+
# Optional parameters with an +enum+ use +anyOf+ to separate the enum
|
|
71
|
+
# constraint from the null type, since providers like Anthropic reject
|
|
72
|
+
# +{"type": ["string", "null"], "enum": [...]}+.
|
|
73
|
+
#
|
|
70
74
|
#: (?strict: bool) -> Hash[Symbol, untyped]
|
|
71
75
|
def to_json_schema(strict: false)
|
|
76
|
+
nullable = strict && !required
|
|
77
|
+
|
|
78
|
+
if nullable && enum
|
|
79
|
+
schema = {anyOf: [{type: type_name, enum: enum}, {type: "null"}]}
|
|
80
|
+
schema[:description] = description if description
|
|
81
|
+
return schema
|
|
82
|
+
end
|
|
83
|
+
|
|
72
84
|
type = type_name
|
|
73
|
-
type = [type, "null"] if
|
|
85
|
+
type = [type, "null"] if nullable
|
|
74
86
|
|
|
75
87
|
schema = {type: type}
|
|
76
88
|
schema[:description] = description if description
|
data/lib/riffer/version.rb
CHANGED
|
@@ -45,6 +45,10 @@ class Riffer::Param
|
|
|
45
45
|
# (+["type", "null"]+) so that strict mode providers can distinguish
|
|
46
46
|
# "absent" from "present" without rejecting the schema.
|
|
47
47
|
#
|
|
48
|
+
# Optional parameters with an +enum+ use +anyOf+ to separate the enum
|
|
49
|
+
# constraint from the null type, since providers like Anthropic reject
|
|
50
|
+
# +{"type": ["string", "null"], "enum": [...]}+.
|
|
51
|
+
#
|
|
48
52
|
# : (?strict: bool) -> Hash[Symbol, untyped]
|
|
49
53
|
def to_json_schema: (?strict: bool) -> Hash[Symbol, untyped]
|
|
50
54
|
end
|