-
Notifications
You must be signed in to change notification settings - Fork 32
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
Feature: Response sampling #21
Conversation
02ad884
to
d30e700
Compare
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.
Excellent, LGTM 👍
this.use(addRequiredValidatorForPath()); | ||
this.use(setConstraints(validatorLoader)); | ||
// Load middleware | ||
middlewares.forEach(this.use.bind(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.
Great and clear way through IoC solution to inject 👍 (also make me could refer in my code refactor 😃 )
export * from './generatePathParameters'; | ||
export * from './addRequiredValidatorForPath'; | ||
export * from './setConstraints'; | ||
export const SchemaParserMiddlewares: ClassType<SchemaParserMiddleware>[] = [ |
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.
Maybe we could add a comment to let other members know the array order will become the compose order for middleware executing, or if other members modified the order and some middleware have the relationship of reading/writing data, it will have some influence.
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.
Sure, I've added.
// The order of middleware here indicates the order of their execution, the first one will be executed first, and so on.
export const SchemaParserMiddlewares: ClassType<SchemaParserMiddleware>[] = [
GenerateUrl,
CheckValidator,
TransformValidator,
GenerateTemplateSource,
CheckParameter,
AddMissingErrors,
FallbackErrors,
NormalizeFieldIn,
GenerateDataType,
NormalizeDataType,
GeneratePathParameters,
AddRequiredValidatorForPath,
SetConstraints,
ResponseSampler,
];
8c21911
to
206c8f1
Compare
…of pure function Change schema parser middlewares to classes instead of pure function for incoming injections
d30e700
to
caeb4eb
Compare
Hi @kokokuo , thanks for reviewing, all issues have been fixed. |
https://www.notion.so/canner/API-response-sampling-88093cca3a8b41aab90d3a0b1cbafde9
User story
User definitions.
We’ll send queries while building.
After sample query responses, we transform and append the response.
response: - name: id type: STRING ....
(Existed feature) Generate document from schema.
Commits