-
Notifications
You must be signed in to change notification settings - Fork 22
test: fix openapi.test.ts
to properly test @example
tag behaviour
#780
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
Conversation
@@ -2103,6 +2103,7 @@ testCase('route with descriptions, patterns, and examples', ROUTE_WITH_DESCRIPTI | |||
required: true, | |||
schema: { | |||
type: 'object', | |||
example: "{ 'foo': 'bar' }", |
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.
if this is meant to be a JSON string shouldn't it contain escaped double quotes for keys and values instead of single ones?
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.
inside ROUTE_WITH_DESCRIPTIONS_PATTERNS_EXAMPLES
, if I make it any one of
@example '{ "foo": "bar" }'
or
@example "{ "foo": "bar" }"
or
@example "{ \"foo\": \"bar\" }"
then it doesn't seem to parse the tag properly (it probably has to do with the quotes because it cuts part of example and puts in the description
section of the schema instead).
The only way it cooperates is how it is now. It suspect it has something to do with the parseComment
function inside comments.ts
but that isn't our implementation. Do you have any ideas of how we can work around this? Or maybe just leave it alone 🤔
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.
Ah, we probably should refactor that to not use the external comment-parser
anyway
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.
Adds example tag test case
🎉 This PR is included in version @api-ts/[email protected] 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version @api-ts/[email protected] 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version @api-ts/[email protected] 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version @api-ts/[email protected] 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version @api-ts/[email protected] 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
The test I wrote before didn't test
@example
behaviour properly, this fixes it.