grape-oas 1.6.0 → 1.6.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/CHANGELOG.md +15 -0
- data/lib/grape_oas/api_model_builders/request_params_support/schema_enhancer.rb +10 -2
- data/lib/grape_oas/exporter/concerns/enum_normalizer.rb +1 -1
- data/lib/grape_oas/introspectors/entity_introspector.rb +6 -2
- data/lib/grape_oas/introspectors/entity_introspector_support/property_extractor.rb +1 -0
- data/lib/grape_oas/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 227e4af89b7cb81a143484c1fd2fcb151952990c4f2870806f4416d32f88c987
|
|
4
|
+
data.tar.gz: 314d241a0e48262a34c259ec0dd25d1b48c21139eb423b93a715fcd21dfd5c77
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce885918700d0ef1122d03129722237b64e8d4e61c30be842920060425176ee9466bc60254c159c776ca92b0f105dc78dfec352ce8f291d4a92cd2465d4f5c2a
|
|
7
|
+
data.tar.gz: a61d84e0d561663861df04dd63eb98f3ba6a2b50f228aa9193c7552e6dc6bcda12e1da6a742ba2892b625d47e2a04dd7e1efdaec3c5ba26138bed3fd4271b2ff
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ 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
|
+
|
|
9
|
+
## [1.6.1] - 2026-11-06
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [#175](https://github.com/numbata/grape-oas/pull/175): Apply entity-level `example` documentation to the generated schema, matching grape-swagger - [@numbata](https://github.com/numbata).
|
|
14
|
+
- [#176](https://github.com/numbata/grape-oas/pull/176): Keep the danger PR check running in CI by pinning `git` below 6 - [@numbata](https://github.com/numbata).
|
|
15
|
+
- [#180](https://github.com/numbata/grape-oas/pull/180): Automate releases with verified packaging, gem publication and a draft GitHub release - [@numbata](https://github.com/numbata).
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- [#166](https://github.com/numbata/grape-oas/pull/166): Serialize Symbol enum values as strings so `type: Symbol` parameters with `values:` keep their `enum` in OAS 3.0/3.1 - [@numbata](https://github.com/numbata).
|
|
20
|
+
- [#173](https://github.com/numbata/grape-oas/pull/173): Omit lambda/proc parameter defaults, in `default:` and `documentation: { default: }`, from the generated spec instead of emitting `Proc#inspect`; a static `documentation: { default: }` still documents a callable `default:` - [@olivier-thatch](https://github.com/olivier-thatch).
|
|
21
|
+
- [#178](https://github.com/numbata/grape-oas/pull/178): Stop entity exposures named like root-level documentation keys (`example`, `additional_properties`, `description`, `nullable`, ...) from leaking into the entity schema - [@numbata](https://github.com/numbata).
|
|
22
|
+
|
|
8
23
|
## [1.6.0] - 2026-09-21
|
|
9
24
|
|
|
10
25
|
### Added
|
|
@@ -43,13 +43,21 @@ module GrapeOAS
|
|
|
43
43
|
def apply_default(schema, spec, doc)
|
|
44
44
|
return unless schema.respond_to?(:default=)
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
# Unlike `values:`, defaults are not evaluated: Grape runs a Proc default per
|
|
47
|
+
# request, so there is no static value to document. Use
|
|
48
|
+
# `documentation: { default: }` instead.
|
|
49
|
+
if spec.key?(:default) && static_default?(spec[:default])
|
|
47
50
|
schema.default = spec[:default]
|
|
48
|
-
elsif doc.key?(:default)
|
|
51
|
+
elsif doc.key?(:default) && static_default?(doc[:default])
|
|
49
52
|
schema.default = doc[:default]
|
|
50
53
|
end
|
|
51
54
|
end
|
|
52
55
|
|
|
56
|
+
# Any callable is skipped, not only Proc, because the exporters cannot serialize it.
|
|
57
|
+
def static_default?(value)
|
|
58
|
+
!value.respond_to?(:call)
|
|
59
|
+
end
|
|
60
|
+
|
|
53
61
|
def apply_format_and_example(schema, doc)
|
|
54
62
|
schema.format = doc[:format] if doc[:format] && schema.respond_to?(:format=)
|
|
55
63
|
schema.examples = doc[:example] if doc.key?(:example) && schema.respond_to?(:examples=)
|
|
@@ -16,7 +16,7 @@ module GrapeOAS
|
|
|
16
16
|
normalized_value = case base_type
|
|
17
17
|
when Constants::SchemaTypes::INTEGER then value.to_i if value.respond_to?(:to_i)
|
|
18
18
|
when Constants::SchemaTypes::NUMBER then value.to_f if value.respond_to?(:to_f)
|
|
19
|
-
else value
|
|
19
|
+
else value.is_a?(Symbol) ? value.to_s : value
|
|
20
20
|
end
|
|
21
21
|
values << normalized_value unless normalized_value.nil?
|
|
22
22
|
end
|
|
@@ -118,9 +118,13 @@ module GrapeOAS
|
|
|
118
118
|
schema.extensions = root_ext if root_ext
|
|
119
119
|
end
|
|
120
120
|
|
|
121
|
+
# Grape::Entity.documentation is a per-exposure aggregate, not root-level
|
|
122
|
+
# documentation; only an entity's own override counts as the latter.
|
|
121
123
|
def entity_doc
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
return {} unless @entity_class.respond_to?(:documentation)
|
|
125
|
+
return {} if @entity_class.method(:documentation).owner == Grape::Entity.singleton_class
|
|
126
|
+
|
|
127
|
+
DocKeyNormalizer.normalize(@entity_class.documentation || {})
|
|
124
128
|
rescue NoMethodError
|
|
125
129
|
{}
|
|
126
130
|
end
|
|
@@ -35,6 +35,7 @@ module GrapeOAS
|
|
|
35
35
|
def apply_entity_level_properties(schema, doc)
|
|
36
36
|
schema.additional_properties = doc[:additional_properties] if doc.key?(:additional_properties)
|
|
37
37
|
schema.unevaluated_properties = doc[:unevaluated_properties] if doc.key?(:unevaluated_properties)
|
|
38
|
+
schema.examples = doc[:example] if doc.key?(:example)
|
|
38
39
|
|
|
39
40
|
defs = doc[:defs] || doc[:$defs]
|
|
40
41
|
schema.defs = defs if defs.is_a?(Hash)
|
data/lib/grape_oas/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: grape-oas
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Subbota
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: grape
|
|
@@ -151,7 +150,6 @@ metadata:
|
|
|
151
150
|
documentation_uri: https://github.com/numbata/grape-oas#readme
|
|
152
151
|
bug_tracker_uri: https://github.com/numbata/grape-oas/issues
|
|
153
152
|
rubygems_mfa_required: 'true'
|
|
154
|
-
post_install_message:
|
|
155
153
|
rdoc_options: []
|
|
156
154
|
require_paths:
|
|
157
155
|
- lib
|
|
@@ -166,8 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
166
164
|
- !ruby/object:Gem::Version
|
|
167
165
|
version: '0'
|
|
168
166
|
requirements: []
|
|
169
|
-
rubygems_version: 3.
|
|
170
|
-
signing_key:
|
|
167
|
+
rubygems_version: 3.6.9
|
|
171
168
|
specification_version: 4
|
|
172
169
|
summary: OpenAPI (Swagger) v2 and v3 documentation for Grape APIs
|
|
173
170
|
test_files: []
|