AEP-0144 Linter Rules
Rules for AEP-144- Array fields
# Rules for AEP-144: Array fieldsaep-144-operation-id
Section titled “aep-144-operation-id”Rule: The operation ID must begin with the word add or remove.
This rule enforces that all standard UpdateArray
methods have an operationId
field with a value that begins with “add” or “remove” prefix.
Details
Section titled “Details”This rule looks for “UpdateArray” operations and complains if the ‘operationId’ field is not present or if the value does not begin with “add” or “remove”.
Examples
Section titled “Examples”Incorrect code for this rule:
paths: # Missing operationId '/books:addBook': post: summary: Add book responses: # operationId present but does not start with "remove" '/publishers:removePublisher': post: summary: Delete publisher operationId: deletePublisher
Correct code for this rule:
paths: '/books:removeBook': post: summary: Remove book operationId: removeBook
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#/books:removeBook/post/operationId' rules: aep-144-operation-id: 'off'
aep-144-http-method
Section titled “aep-144-http-method”Rule: An Update Array operation must be POST.
This rule enforces that all UpdateArray
operations use POST method.
Details
Section titled “Details”This rule looks for “UpdateArray” operations and complains if operation uses anything except POST method.
Examples
Section titled “Examples”Incorrect code for this rule:
paths: '/books:removeBook': delete: summary: Remove book
Correct code for this rule:
paths: '/books:removeBook': post: summary: Remove book responses:
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#/books:removeBook/delete/operationId' rules: aep-144-http-method: 'off'