-
Notifications
You must be signed in to change notification settings - Fork 25
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
refactor(proposal): use openapi plugin #1629
Conversation
There are two commits. The first commit doesn't change anything in the swagger spec. The second one does, for proposal.schema.ts. For field metadata: For field parentProposalId : For field type: |
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.
For field metadata:
Is it on purpose that the type in ApiProperty is MongooseSchema.Types.Mixed? Seems more reasonable to just have object , for the api users. Also added a default value.
I do not know why we set it to this type. I agree that using Object is easier. Could you please try switching it to object and verify that all the test pass?
For field parentProposalId :
Changed to string | null since it is nullable, I set the default value to null. Also, changed to optional field because it has a default anyway? What would the point be of having a default if it is required?
OK for the type. I would make required in the schema as you have the default value. It is optional in the dto.
For field type:
Same here, changed to optional field since there is a default and I set the default. It is of course possible to only have the default in the ApiProperty, but probably not any real practical difference on setting it?
Same as parentPRoposalId, optional in the dto, but required in the schema set to the default value.
It is already object since I removed the ApiProperty decorator. The openapi plugin will read the Record type.
I have looked around a bit on the web and it seems the normal way is to not use
|
20b405f
to
e1fd523
Compare
4f9b12f
to
116a49c
Compare
116a49c
to
316c6fb
Compare
316c6fb
to
81778ad
Compare
Description
Use openapi plugin in proposal module
Motivation
Less clutter in code and less risk for inconstensies between openapi spec and the actual behaviour.
Fixes
Related to #1590
Changes:
Removed all
@ApiProperty
decorators in proposal module.The first commit doesn't change the openapi spec. The second commit, which touches three fields, does make some changes which we can discuss.
Tests included
Documentation