Class: Skooma::Objects::OpenAPI::Keywords::OpenAPI

Inherits:
JSONSkooma::Keywords::BaseAnnotation
  • Object
show all
Defined in:
lib/skooma/objects/openapi/keywords/openapi.rb

Constant Summary collapse

MAPPING =
{
  "3.1.0" => "https://spec.openapis.org/oas/3.1/schema-base/2022-10-07",
  "3.1.1" => "https://spec.openapis.org/oas/3.1/schema-base/2025-02-13",
  "3.1.2" => "https://spec.openapis.org/oas/3.1/schema-base/2025-09-15",
  "3.2.0" => "https://spec.openapis.org/oas/3.1/schema-base/2025-09-17"
}
LATEST =
"3.2.0"

Instance Method Summary collapse

Constructor Details

#initialize(parent_schema, value) ⇒ OpenAPI

Returns a new instance of OpenAPI.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/skooma/objects/openapi/keywords/openapi.rb', line 19

def initialize(parent_schema, value)
  unless value.to_s.start_with? "3.1."
    raise Error, "Only OpenAPI version 3.1.x is supported, got #{value}"
  end

  parent_schema.metaschema_uri = MAPPING[value.to_s] || MAPPING[LATEST]

  parent_schema.json_schema_dialect_uri = "https://spec.openapis.org/oas/3.1/dialect/base"

  super
end