-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add reference property to context.report() for external documentation #1969
base: main
Are you sure you want to change the base?
Conversation
Add the `reference` property to the `context.report()` method for external documentation links. Fix #1052 * **Documentation**: Update `docs/custom-plugins/custom-rules.md` to include the `reference` property in the `context.report()` method documentation. * **New Rule**: Add `packages/core/src/rules/arazzo/reference-property.ts` to implement a new rule for validating the `reference` property in the report object. * **Rule Integration**: Modify `packages/core/src/rules/arazzo/index.ts` to import and add the new `reference-property` rule to the existing rules. * **Unit Tests**: Add `packages/core/src/rules/arazzo/__tests__/reference-property.test.ts` to test the presence and format validation of the `reference` property and error reporting for missing or incorrect `reference` property.
|
Coverage reportMultiple errors occurred
Show files with reduced coverage 🔻
Test suite run failedFailed tests: 0/846. Failed suites: 51/195.
Report generated by 🧪jest coverage report action from fbe438a |
- Implement `isValidURL` utility function in `utils.ts` with comprehensive URL validation - Add extensive test cases for URL validation in `utils.test.ts` - Update Arazzo reference property rule to validate URLs using new utility - Add `reference` property to Arazzo criteria type definition - Enable `reference-property` rule in built-in Arazzo rules
|
operationId: museum-api.getMuseumHours | ||
successCriteria: | ||
- condition: $statusCode == 200 | ||
reference: invalid-url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not according to the Arazzo specification and I would prefer not to add additional properties to Criterion Object. In case we need one - this can be extension, before accepted and added to the Spec itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact reference
field already exist in Arazzo, but used for different type Reusable Object
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is completely wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is an AI hallucination. It doesn't make any sense.
The markdown file change looks valid but the code changes are completely irrelevant and wrong.
} | ||
}); | ||
}); | ||
describe('isValidURL', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need so many tests for this. I would also not validate this at all. I would add a very basic URL validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, URL constructor is also more performant and reliable.
operationId: museum-api.getMuseumHours | ||
successCriteria: | ||
- condition: $statusCode == 200 | ||
reference: invalid-url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is completely wrong.
I'm sorry. I misunderstood the issue. It should not be a new rule; it should just be an additional string in the reporter.
✌️ Sorry, I'm the one hallucinating. Yeah, I even laugh and feel embarrassed after re-reading the issue. |
- Remove `isValidURL` utility function from `utils.ts` - Delete Arazzo `reference-property` rule and its test file - Remove `reference-property` from Arazzo rules index - Add `reference` property to `Problem` and `NormalizedProblem` types in `walk.ts` - Update `formatProblems` to display reference URL when present - Add reference URL to `no-schema-type-mismatch` rule - Update related test cases to include reference property
What/Why/How?
Add the
reference
property to thecontext.report()
method for external documentation links.docs/custom-plugins/custom-rules.md
to include thereference
property in thecontext.report()
method documentation.packages/core/src/rules/arazzo/reference-property.ts
to implement a new rule for validating thereference
property in the report object.packages/core/src/rules/arazzo/index.ts
to import and add the newreference-property
rule to the existing rules.packages/core/src/rules/arazzo/__tests__/reference-property.test.ts
to test the presence and format validation of thereference
property and error reporting for missing or incorrectreference
property.Reference
Fix #1052
Testing
ran npm run test
Screenshots (optional)
Check yourself
Security