skooma 0.3.5 → 0.3.7

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.
@@ -0,0 +1,25 @@
1
+ {
2
+ "$id": "https://spec.openapis.org/oas/3.1/schema-base/2025-02-13",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "description": "The description of OpenAPI v3.1.x Documents using the OpenAPI JSON Schema dialect",
5
+ "$ref": "https://spec.openapis.org/oas/3.1/schema/2025-02-13",
6
+ "properties": {
7
+ "jsonSchemaDialect": {
8
+ "$ref": "#/$defs/dialect"
9
+ }
10
+ },
11
+ "$defs": {
12
+ "dialect": {
13
+ "const": "https://spec.openapis.org/oas/3.1/dialect/2024-11-10"
14
+ },
15
+ "schema": {
16
+ "$dynamicAnchor": "meta",
17
+ "$ref": "https://spec.openapis.org/oas/3.1/dialect/2024-11-10",
18
+ "properties": {
19
+ "$schema": {
20
+ "$ref": "#/$defs/dialect"
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$id": "https://spec.openapis.org/oas/3.1/schema-base/2025-09-15",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "description": "The description of OpenAPI v3.1.x Documents using the OpenAPI JSON Schema dialect",
5
+ "$ref": "https://spec.openapis.org/oas/3.1/schema/2025-09-15",
6
+ "properties": {
7
+ "jsonSchemaDialect": {
8
+ "$ref": "#/$defs/dialect"
9
+ }
10
+ },
11
+ "$defs": {
12
+ "dialect": {
13
+ "const": "https://spec.openapis.org/oas/3.1/dialect/2024-11-10"
14
+ },
15
+ "schema": {
16
+ "$dynamicAnchor": "meta",
17
+ "$ref": "https://spec.openapis.org/oas/3.1/dialect/2024-11-10",
18
+ "properties": {
19
+ "$schema": {
20
+ "$ref": "#/$defs/dialect"
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$id": "https://spec.openapis.org/oas/3.2/schema-base/2025-09-17",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "description": "The description of OpenAPI v3.2.x Documents using the OpenAPI JSON Schema dialect",
5
+ "$ref": "https://spec.openapis.org/oas/3.2/schema/2025-09-17",
6
+ "properties": {
7
+ "jsonSchemaDialect": {
8
+ "$ref": "#/$defs/dialect"
9
+ }
10
+ },
11
+ "$defs": {
12
+ "dialect": {
13
+ "const": "https://spec.openapis.org/oas/3.2/dialect/2025-09-17"
14
+ },
15
+ "schema": {
16
+ "$dynamicAnchor": "meta",
17
+ "$ref": "https://spec.openapis.org/oas/3.2/dialect/2025-09-17",
18
+ "properties": {
19
+ "$schema": {
20
+ "$ref": "#/$defs/dialect"
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
@@ -40,6 +40,7 @@ module Skooma
40
40
  status, headers, body = response.to_a
41
41
  full_body = +""
42
42
  body.each { |chunk| full_body << chunk }
43
+
43
44
  {
44
45
  "status" => status,
45
46
  "headers" => headers.to_h,
@@ -5,7 +5,17 @@ module Skooma
5
5
  class ConformResponseSchema < ConformRequestSchema
6
6
  def initialize(skooma, mapped_response, expected)
7
7
  super(skooma, mapped_response)
8
+
8
9
  @expected = expected
10
+
11
+ case expected
12
+ when Symbol
13
+ @expected_code = Rack::Utils::SYMBOL_TO_STATUS_CODE.fetch(expected)
14
+ when Integer
15
+ @expected_code = expected
16
+ else
17
+ raise ArgumentError, "Expected symbol or number, got expected=#{expected.inspect}"
18
+ end
9
19
  end
10
20
 
11
21
  def description
@@ -9,12 +9,12 @@ module Skooma
9
9
  "schemas" => JSONSkooma::JSONSchema,
10
10
  "responses" => Response,
11
11
  "parameters" => Parameter,
12
- # "examples" => Example,
12
+ "examples" => JSONSkooma::JSONNode,
13
13
  "requestBodies" => RequestBody,
14
14
  "headers" => Header,
15
15
  "securitySchemes" => JSONSkooma::JSONNode,
16
16
  "links" => JSONSkooma::JSONNode,
17
- # "callbacks" => Callback,
17
+ "callbacks" => JSONSkooma::JSONNode,
18
18
  "pathItems" => PathItem
19
19
  }
20
20
 
@@ -7,12 +7,22 @@ module Skooma
7
7
  class OpenAPI < JSONSkooma::Keywords::BaseAnnotation
8
8
  self.key = "openapi"
9
9
 
10
+ MAPPING = {
11
+ "3.1.0" => "https://spec.openapis.org/oas/3.1/schema-base/2022-10-07",
12
+ "3.1.1" => "https://spec.openapis.org/oas/3.1/schema-base/2025-02-13",
13
+ "3.1.2" => "https://spec.openapis.org/oas/3.1/schema-base/2025-09-15",
14
+ "3.2.0" => "https://spec.openapis.org/oas/3.1/schema-base/2025-09-17"
15
+ }
16
+
17
+ LATEST = "3.2.0"
18
+
10
19
  def initialize(parent_schema, value)
11
20
  unless value.to_s.start_with? "3.1."
12
21
  raise Error, "Only OpenAPI version 3.1.x is supported, got #{value}"
13
22
  end
14
23
 
15
- parent_schema.metaschema_uri = "https://spec.openapis.org/oas/3.1/schema-base/2022-10-07"
24
+ parent_schema.metaschema_uri = MAPPING[value.to_s] || MAPPING[LATEST]
25
+
16
26
  parent_schema.json_schema_dialect_uri = "https://spec.openapis.org/oas/3.1/dialect/base"
17
27
 
18
28
  super
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Skooma
4
- VERSION = "0.3.5"
4
+ VERSION = "0.3.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skooma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svyatoslav Kryukov
@@ -47,10 +47,20 @@ files:
47
47
  - CHANGELOG.md
48
48
  - LICENSE.txt
49
49
  - README.md
50
+ - data/oas-3.1/dialect/2024-11-10.json
51
+ - data/oas-3.1/dialect/2025-09-17.json
50
52
  - data/oas-3.1/dialect/base.json
53
+ - data/oas-3.1/meta/2024-11-10.json
54
+ - data/oas-3.1/meta/2025-09-17.json
51
55
  - data/oas-3.1/meta/base.json
52
56
  - data/oas-3.1/schema-base/2022-10-07.json
57
+ - data/oas-3.1/schema-base/2025-02-13.json
58
+ - data/oas-3.1/schema-base/2025-09-15.json
59
+ - data/oas-3.1/schema-base/2025-09-17.json
53
60
  - data/oas-3.1/schema/2022-10-07.json
61
+ - data/oas-3.1/schema/2025-02-13.json
62
+ - data/oas-3.1/schema/2025-09-15.json
63
+ - data/oas-3.1/schema/2025-09-17.json
54
64
  - lib/skooma.rb
55
65
  - lib/skooma/body_parsers.rb
56
66
  - lib/skooma/coverage.rb
@@ -166,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
176
  - !ruby/object:Gem::Version
167
177
  version: '0'
168
178
  requirements: []
169
- rubygems_version: 3.6.7
179
+ rubygems_version: 3.6.9
170
180
  specification_version: 4
171
181
  summary: Validate API implementations against OpenAPI documents.
172
182
  test_files: []