-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Looking at #14, it looks like there's some content that might be duplicated across various places, and could perhaps be simplified (for both the author and future reviewers) using some code generation.
Specifically, I'm thinking:
- Include additional information in each rule
- Write a script that will parse the rules, extract the values necessary for documentation and tests, and write boilerplate code.
- Generate the docs and test via this script.
The additional fields in the rules could look like:
aep-133-id-parameter:
description: "This rule looks at the parameters of "post" operations on a path that does not have a ":" in its final segment
(indicating a custom operation), and complains if there is no parameter with the name `id`."
examples:
incorrect:
- paths:
'/test1':
post:
description: 'No parameters'
'/test2':
post:
description: 'No id parameter'
parameters:
- name: force
in: query
schema:
type: boolean
responses:
'200':
description: Ok
correct:
- paths:
'/book':
post:
parameters:
- name: id
in: query
schema:
type: stringTests can be generated by reading off incorrect examples, and generating a test to make sure those fail. For correct examples, we could generate a test to make sure those pass.
The "disabling" part of the docs can be completely generated without any additional information (that just includes the rule, as well as the matcher).
thoughts?
Metadata
Metadata
Assignees
Labels
No labels