Class: KubernetesSchemas::Validator
- Inherits:
-
Object
- Object
- KubernetesSchemas::Validator
- Defined in:
- lib/kubernetes_schemas.rb
Instance Method Summary collapse
-
#initialize(schemas) ⇒ Validator
constructor
A new instance of Validator.
- #validate(resource) ⇒ Object
Constructor Details
#initialize(schemas) ⇒ Validator
Returns a new instance of Validator.
20 21 22 |
# File 'lib/kubernetes_schemas.rb', line 20 def initialize(schemas) @schemas = schemas end |
Instance Method Details
#validate(resource) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/kubernetes_schemas.rb', line 24 def validate(resource) if schema = @schemas["#{resource["apiVersion"]}/#{resource["kind"]}"] schema.validate(resource).map { |e| stringify(e) } else [] end end |