content:"You write amazing documentation, as a senior technical writer. Your audience is non-technical team members. You have been asked to document the validations in a Rails application. The application collects social housing data for different collection years. There are validations on different fields, sometimes the validations depend on several fields.
description:"Use this function to save the complete documentation, covering given validation in the provided code.",
parameters:{
type::object,
properties:{
description:{
type::string,
description:"A human-readbale description of the validation",
},
cases:{
type::array,
description:"A list of cases that this validation triggers on, each with specific details",
items:{
type::object,
description:"Information about a single case that triggers this validation",
properties:{
case_description:{
type::string,
description:"A human-readable description of the case in which this validation triggers",
},
errors:{
type::array,
description:"The error messages that would be added if this case triggers the validation",
items:{
type::object,
description:"Information about a single error message for a specific field",
properties:{
error_message:{
type::string,
description:"A single error message",
},
field:{
type::string,
description:"The field that the error message would be added to.",
},
},
required:%w[error_message field],
},
},
validation_type:{
type::string,
enum:%w[presence format minimum maximum range inclusion length other],
description:"The type of validation that is being performed. This should be one of the following: presence (validates that the question is answered), format (validates that the answer format is valid), minimum (validates that entered value is more than minimum allowed value), maximum (validates that entered value is less than maximum allowed value), range (values must be between two values), inclusion (validates that the values that are not allowed arent selected), length (validates the length of the answer), other",
},
other_validated_models:{
type::string,
description:"Comma separated list of any other models (other than log) that were used in this validation. These are possible models (only add a value to this field if other validation models are one of these models): User, Organisation, Scheme, Location, Organisation_relationship, LaRentRange. Only leave this blank if no other models were used in this validation.",
content:"You write amazing documentation, as a senior technical writer. Your audience is non-technical team members. You have been asked to document the validations in a Rails application. The application collects social housing data for different collection years. There are validations on different fields, sometimes the validations depend on several fields.
description:"Use this function to save the complete documentation, covering given validation in the provided code.",
parameters:{
type::object,
properties:{
description:{
type::string,
description:"A human-readbale description of the validation",
},
validation_type:{
type::string,
enum:%w[presence format minimum maximum range inclusion length other],
description:"The type of validation that is being performed. This should be one of the following: presence (validates that the question is answered), format (validates that the answer format is valid), minimum (validates that entered value is more than minimum allowed value), maximum (validates that entered value is less than maximum allowed value), range (values must be between two values), inclusion (validates that the values that are not allowed arent selected), length (validates the length of the answer), other",
},
other_validated_models:{
type::string,
description:"Comma separated list of any other models (other than log) that were used in this validation. These are possible models (only add a value to this field if other validation models are one of these models): User, Organisation, Scheme, Location, Organisation_relationship, LaRentRange. Only leave this blank if no other models were used in this validation.",
Rails.logger.info("Validation #{validation_depends_on_hash.keys.first} already exists for #{page_the_validation_applied_to.questions.first.id} for start year #{form.start_date.year}")