Sha256: 6c42b1d9fe2634ab25d035d64c336076daa22f1588c4d93056660b750e21096f
Contents?: true
Size: 1.52 KB
Versions: 7
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true require "mihari/schemas/analyzer" require "mihari/schemas/emitter" require "mihari/schemas/enricher" module Mihari module Schemas Rule = Dry::Schema.Params do required(:id).value(:string) required(:title).value(:string) required(:description).value(:string) optional(:tags).value(array[:string]).default([]) optional(:author).value(:string) optional(:references).value(array[:string]) optional(:related).value(array[:string]) optional(:status).value(:string) optional(:created_on).value(:date) optional(:updated_on).value(:date) required(:queries).value(:array).each { Analyzer } # rubocop:disable Lint/Void optional(:emitters).value(:array).each { Emitter }.default(DEFAULT_EMITTERS) # rubocop:disable Lint/Void optional(:enrichers).value(:array).each { Enricher }.default(DEFAULT_ENRICHERS) # rubocop:disable Lint/Void optional(:data_types).value(array[Types::DataTypes]).default(Mihari::Types::DataTypes.values) optional(:falsepositives).value(array[:string]).default([]) optional(:artifact_lifetime).value(:integer) optional(:artifact_ttl).value(:integer) end # # Rule schema contract # class RuleContract < Dry::Validation::Contract include Mihari::Mixins::FalsePositive params(Rule) rule(:falsepositives) do value.each do |v| key.failure("#{v} is not a valid format.") unless valid_falsepositive?(v) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems