diff --git a/Sources/OpenAPIKit/Validator/Validation+Builtins.swift b/Sources/OpenAPIKit/Validator/Validation+Builtins.swift index 2316b3890..55af772fb 100644 --- a/Sources/OpenAPIKit/Validator/Validation+Builtins.swift +++ b/Sources/OpenAPIKit/Validator/Validation+Builtins.swift @@ -13,7 +13,7 @@ extension Validation { /// Validate the OpenAPI Document has at least one path in its /// `PathItem.Map`. /// - /// The OpenAPI Specifcation does not require that the document + /// The OpenAPI Specification does not require that the document /// contain any paths for [security reasons](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#security-filtering) /// or even because it only contains webhooks, but authors may still /// want to protect against an empty `PathItem.Map` in some cases. @@ -29,7 +29,7 @@ extension Validation { /// Validate the OpenAPI Document's `PathItems` all have at least /// one operation. /// - /// The OpenAPI Specifcation does not require that path items + /// The OpenAPI Specification does not require that path items /// contain any operations for [security reasons](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#security-filtering) /// but documentation that is public in nature might only ever have /// a `PathItem` with no operations in error. @@ -45,7 +45,7 @@ extension Validation { /// Validate the OpenAPI Document's `JSONSchemas` all have at least /// one defining characteristic. /// - /// The JSON Schema Specifcation does not require that components + /// The JSON Schema Specification does not require that components /// have any defining characteristics. An "empty" schema component can /// be written as follows: /// @@ -160,7 +160,7 @@ extension Validation { /// Validate the OpenAPI Document's `Operations` all have at least /// one response. /// - /// The OpenAPI Specifcation does not require that Responses Objects + /// The OpenAPI Specification does not require that Responses Objects /// contain at least one response but you may wish to validate that all /// operations contain at least one response in your own API. /// @@ -182,7 +182,7 @@ extension Validation { /// Validate that the OpenAPI Document's `Tags` all have unique names. /// - /// The OpenAPI Specifcation requires that tag names on the Document + /// The OpenAPI Specification requires that tag names on the Document /// [are unique](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#openapi-object). /// /// - Important: This is included in validation by default. @@ -435,7 +435,7 @@ extension Validation { /// /// - Important: This is included in validation by default. /// - public static var serverVarialbeEnumIsValid: Validation { + public static var serverVariableEnumIsValid: Validation { .init( description: "Server Variable's enum is either not defined or is non-empty (if defined).", check: { context in @@ -445,12 +445,22 @@ extension Validation { ) } + /// Validate that `enum` must not be empty in the document's + /// Server Variable. + /// + /// - Important: This is included in validation by default. + /// + @available(*, deprecated, renamed: "serverVariableEnumIsValid") + public static var serverVarialbeEnumIsValid: Validation { + return serverVariableEnumIsValid + } + /// Validate that `default` must exist in the enum values in the document's /// Server Variable, if such values (enum) are defined. /// /// - Important: This is included in validation by default. /// - public static var serverVarialbeDefaultExistsInEnum : Validation { + public static var serverVariableDefaultExistsInEnum : Validation { .init( description: "Server Variable's default must exist in enum, if enum is defined.", check: { context in @@ -459,6 +469,16 @@ extension Validation { } ) } + + /// Validate that `default` must exist in the enum values in the document's + /// Server Variable, if such values (enum) are defined. + /// + /// - Important: This is included in validation by default. + /// + @available(*, deprecated, renamed: "serverVariableDefaultExistsInEnum") + public static var serverVarialbeDefaultExistsInEnum : Validation { + return serverVariableDefaultExistsInEnum + } } /// Used by both the Path Item parameter check and the diff --git a/Sources/OpenAPIKit/Validator/Validator.swift b/Sources/OpenAPIKit/Validator/Validator.swift index 812a9b1ab..251183d16 100644 --- a/Sources/OpenAPIKit/Validator/Validator.swift +++ b/Sources/OpenAPIKit/Validator/Validator.swift @@ -123,7 +123,7 @@ extension OpenAPI.Document { /// `where` clause both examine the same type (i.e. `OpenAPI.Document.Info` /// from the previous example and `OpenAPI.Document` from the next example). /// -/// The next example also uses `take()` in its `where` caluse. This allows you to +/// The next example also uses `take()` in its `where` clause. This allows you to /// dig into a value based on its KeyPath just like the previous example but you can /// use it for more complicated criteria than equality/inequality. /// @@ -191,8 +191,8 @@ public final class Validator { .init(.headerReferencesAreValid), .init(.linkReferencesAreValid), .init(.pathItemReferencesAreValid), - .init(.serverVarialbeEnumIsValid), - .init(.serverVarialbeDefaultExistsInEnum) + .init(.serverVariableEnumIsValid), + .init(.serverVariableDefaultExistsInEnum) ]) }