valid-property-value-type
Overview
This rule belongs to the raml-validation
ruleset and states that:
Value of a RAML standard property must be in accordance with the type set by the standard for that property.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Blocking |
Message | Property value has an invalid/unexpected type. |
Code | RAML_V004 |
Type | Validation |
Rule System | Semantic |
Broad Category | Basic Structure |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | raml semantic validation type property value property |
Suggested Fixes
- If an array is expected, ensure that the array items are defined below the property key. Ensure that all items are preceded by a dash '-' followed by a single space. They all must also be indented by two spaces or any consistent amount of whitespace.
- Since RAML uses YAML, the indentation level determines the nesting level and it is important to take care of that to avoid any kind of trouble.
- If an array is not expected, ensure that your value contains a single item only.
- If a numeric value is expected, ensure that your value is a valid number and it is not surrounded by single or double quotes.
- If a string value is expected, ensure that it is escaped properly and surrounded by quotes if necessary. For multi-line strings, ensure you make the correct use of '|' or '>' characters.
- If an object is expected, ensure that your value is a key-value map where each key-value pair is indented in a consistent manner. The key-value pairs should start below the property key.