Class: JSON::Oas::Fragment
- Inherits:
-
Array
- Object
- Array
- JSON::Oas::Fragment
- Defined in:
- lib/json-schema-oas/fragment.rb
Overview
This is a workaround for json-schema’s fragment validation which does not allow to contain forward slashes due to an attempt split(‘/’)
Class Method Summary collapse
- .response_schema_for(version, path_or_name, method = nil, code = nil) ⇒ Object
- .schema_for(version, name) ⇒ Object
Instance Method Summary collapse
Class Method Details
.response_schema_for(version, path_or_name, method = nil, code = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/json-schema-oas/fragment.rb', line 8 def response_schema_for(version, path_or_name, method = nil, code = nil) case version when Version::OAS2 raise ArgumentError unless method && code new(['#', 'paths', path_or_name, method.to_s, 'responses', code.to_s, 'schema']) when Version::OAS3 v3_response_schema_for(path_or_name, method, code) else raise Error, Error::UNKNOWN_VERSION_ERROR end end |
.schema_for(version, name) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/json-schema-oas/fragment.rb', line 21 def schema_for(version, name) case version when Version::OAS2 new(['#', 'definitions', name.to_s]) when Version::OAS3 new(['#', 'components', 'schemas', name.to_s]) else raise Error, Error::UNKNOWN_VERSION_ERROR end end |
Instance Method Details
#split(_options = nil) ⇒ Object
52 53 54 |
# File 'lib/json-schema-oas/fragment.rb', line 52 def split( = nil) dup end |