Skip to content

Conversation

@rambleraptor
Copy link
Member

This change modifies the linter to only test methods on paths that have the x-aep-resource extension. Methods on paths without this annotation are no longer tested by AEP rules.

Changes:

  • Added custom functions to check for x-aep-resource before applying rules
  • Created get-no-request-body.js for AEP-132 (GET operations)
  • Created delete-no-request-body.js for AEP-135 (DELETE body validation)
  • Created delete-response-204.js for AEP-135 (DELETE response codes)
  • Created request-body-required.js for request body validation
  • Updated parameter-names-unique.js to check for x-aep-resource
  • Updated all rule files to use custom functions instead of JSONPath filters
  • Updated all tests to include x-aep-resource annotations
  • Added tests verifying rules don't apply without x-aep-resource

All tests pass with 97% code coverage.

This change modifies the linter to only test methods on paths that have
the x-aep-resource extension. Methods on paths without this annotation
are no longer tested by AEP rules.

Changes:
- Added custom functions to check for x-aep-resource before applying rules
- Created get-no-request-body.js for AEP-132 (GET operations)
- Created delete-no-request-body.js for AEP-135 (DELETE body validation)
- Created delete-response-204.js for AEP-135 (DELETE response codes)
- Created request-body-required.js for request body validation
- Updated parameter-names-unique.js to check for x-aep-resource
- Updated all rule files to use custom functions instead of JSONPath filters
- Updated all tests to include x-aep-resource annotations
- Added tests verifying rules don't apply without x-aep-resource

All tests pass with 97% code coverage.
This is a work-in-progress implementation to correctly check for
x-aep-resource on resource schemas rather than path items.

Completed:
- Created resource-utils.js with helper functions:
  * resolveRef() - Resolve $ref to actual schemas
  * hasAepResource() - Check if schema has x-aep-resource
  * findResourceSchema() - Find resource schema from operations
  * findResourceSchemaForCustomMethod() - Handle custom methods
  * shouldLintOperation() - Determine if operation should be linted

- Created comprehensive tests (27 tests, all passing):
  * test/resource-utils.test.js

- Updated all validation functions to use new utilities:
  * get-no-request-body.js
  * delete-no-request-body.js
  * delete-response-204.js
  * request-body-required.js
  * parameter-names-unique.js

Outstanding Issues:
- Integration tests failing - need to determine correct way to access
  full OpenAPI document (including components/schemas) from Spectral
  custom functions via otherValues parameter
- Need to update remaining test files (0135, parameter-names-unique, etc.)
- Need to verify document access works with Spectral's resolution

The utility functions are solid and well-tested. The remaining work
is to properly wire them into Spectral's custom function interface.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants