-
Notifications
You must be signed in to change notification settings - Fork 245
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
Testing http-Specs with oas3 emitter #5635
base: main
Are you sure you want to change the base?
Conversation
@lirenhe pls review |
describe("AuthApiKeyClient Rest Client", () => { | ||
beforeAll(async () => { | ||
exec("pnpm spector-serve", { cwd: pkgRoot }); | ||
await checkServe(); |
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.
why do we need to start the server
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.
@timotheeguerin, we use the response as ground truth:
await validataDataWithSchema(response.body, invalidAuthSchemas);
packages/openapi3/test/http-specs/utils/spec-snapshot-testing.ts
Outdated
Show resolved
Hide resolved
packages/openapi3/test/http-specs/utils/spec-snapshot-testing.ts
Outdated
Show resolved
Hide resolved
execSync("pnpm spector-stop", { stdio: "inherit", cwd: pkgRoot }); | ||
}); | ||
worksFor(["3.0.0", "3.1.0"], ({ openApiForFile }) => { | ||
describe("AuthApiKeyClient Rest Client", () => { |
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 fail to see the real value in this PR. Do we really need this? You go and reimplement everything to validate pretty much nothing. This is a lot of wasted effort.
What is the motivation behind this?
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.
The goal is to leverage the full test specs in Spector to verify various scenarios for the OAS3 emitter and display the results on the Spector dashboard for scenario coverage. This way, any changes in TypeSpec/Emitter can be quickly identified for potential breakings.
But I am not quite get the point in this PR about how we validate the result. Are we using snapshot for testing?
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.
Fail to see why we need this
1 . Verify that all http-specs cases can be converted to the OpenAPI 3 without any errors/warnings
describe("http-specs convert", () => { defineSpecTests(config); });