AEP-0140 Linter Rules
Rules for AEP-140- Field Names
# Rules for AEP-140: Field Namesaep-140-boolean-property-naming
Section titled “aep-140-boolean-property-naming”Rule: Boolean properties should omit the prefix “is”.
This rule enforces that all boolean properties don’t start with the prefix “is”.
Details
Section titled “Details”This rule looks for “boolean” properties and complains if the ‘boolean’ field name starts with the prefix “is”.
Examples
Section titled “Examples”Incorrect code for this rule:
schemas: { 'book': { 'type': 'object', 'properties': { 'isbn': { 'type': 'array', 'items': { 'type': 'string' } }, 'is_published': { 'type': 'boolean' }
Correct code for this rule:
schemas: { 'book': { 'type': 'object', 'properties': { 'isbn': { 'type': 'array', 'items': { 'type': 'string' } }, 'published': { 'type': 'boolean' }
Disabling
Section titled “Disabling”If you need to violate this rule for a specific operation, add an “override” to the Spectral rule file for the specific file and fragment.
overrides: - files: - 'openapi.json#/components/schemas/book/properties/is_published' rules: aep-140-boolean-field-naming: 'off'
aep-140-uri-property-naming
Section titled “aep-140-uri-property-naming”Rule: Properties representing URLs or URIs should be named “uri” rather than “url”.
This rule checks that all “url” properties are named in accordance with the AEP-140 ruleset.
Details
Section titled “Details”This rule complains if there are any string properties named “url”.
Examples
Section titled “Examples”Incorrect code for this rule:
schemas: { 'book': { 'type': 'object', 'properties': { 'url': { 'type': 'string', 'readOnly': true }, 'published': { 'type': 'boolean' }
Correct code for this rule:
schemas: { 'book': { 'type': 'object', 'properties': { 'uri': { 'type': 'string', 'readOnly': true }, 'published': { 'type': 'boolean' }
Disabling
Section titled “Disabling”If you need to violate this rule for a specific operation, add an “override” to the Spectral rule file for the specific file and fragment.
overrides: - files: - 'openapi.json#/components/schemas/book/properties/url' rules: aep-140-uri-field-naming: 'off'