-
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: Document generator #16
Conversation
1a5f0b8
to
3e151e7
Compare
6607919
to
32d8b72
Compare
3e151e7
to
74cc97b
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.
Beside one question, other LGTM 👍 👍
// Arrange | ||
const generator = await getGenerator(); | ||
// Act, Arrange | ||
const spec = generator.getSpec(); |
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.
Does here miss the assert behavior, not see the expect
checker, e.g: expect(xxxx).not.toThrow()
for not throwing error?
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, added it.
48db8eb
to
67598d7
Compare
- Add data type generator - Add data type normalizer - Add fieldIn normalizer - Add pathparameters generator - Add required validator auto creator
d3f5eb3
to
e962e25
Compare
- Add constraints API for validators, implemented Required and MinValue constraint for demonstration. - Implemented schema middleware to extract constraints.
- Update generator and normalizer for new responses. - Define response interfaces. - Generate response of OAS document.
add MaxValue, MinLength, MaxLength, Regex, Enum constraints
e962e25
to
7149563
Compare
Hi @kokokuo , I've fixed all issues. |
Description
Generate OAS document for our restful API.
Demo
We extract these values for the schema to document:
About Validators' Constraints
For generating documents, we need to know what the validator do inside validateData function, so I add a method
getConstraints
to the validator interface, it should tell us what it does with some standard rules:According to Meeting #8
Instead of hard-cord constraints in this function, we can use some transform libraries like joi-to-json-schema. But I think we can do it later after previous PRs merged.
Duplicated codes
d61b0d2 is a duplicated commit from previous PR, it'll be removed after rebased.
Snapshots
Document generated by redoc
