-
Notifications
You must be signed in to change notification settings - Fork 547
RESTWS-963: Remove the manual methods used for generating the swagger documentation #637
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
base: master
Are you sure you want to change the base?
Conversation
| public Model getGETModel(Representation rep) { | ||
| getGETCalled = true; | ||
| return super.getGETModel(rep); | ||
| public DelegatingResourceDescription getRepresentationDescription(Representation rep) { |
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.
Did you intentionally change these methods?
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.
yes i did, because we are getting rid of those methods so i had to replace them with methods used for creating the rest api
00701af to
82eff3a
Compare
| description.addProperty("drug"); | ||
| return description; | ||
| } | ||
|
|
||
| public Model getGETModel(Representation rep) { | ||
| ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); | ||
| if (rep instanceof DefaultRepresentation) { | ||
| modelImpl.property("display", new StringProperty()).property("uuid", new StringProperty()) | ||
| .property("drug", new RefProperty("#/definitions/DrugGetRef")) | ||
| .property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermGetRef")) | ||
| .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGetRef")); | ||
| } else if (rep instanceof FullRepresentation) { | ||
| modelImpl.property("display", new StringProperty()).property("uuid", new StringProperty()) | ||
| .property("auditInfo", new StringProperty()).property("drug", new RefProperty("#/definitions/DrugGet")) | ||
| .property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermGet")) | ||
| .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeGet")); | ||
| } | ||
| return modelImpl; | ||
| } | ||
|
|
||
| @Override | ||
| public Model getCREATEModel(Representation rep) { | ||
| return new ModelImpl().property("conceptReferenceTerm", new StringProperty().example("uuid")) | ||
| .property("conceptMapType", new StringProperty().example("uuid")) | ||
| .property("drug", new StringProperty().example("uuid")); | ||
| } | ||
|
|
||
| } |
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.
good improvements:
Well-structured with correct use of Swagger models.
Logical separation for different representations.
Needs Improvement:
Remove redundant code using a helper method.
Improve method naming for clarity.
Add error handling for edge cases.
Description of what I changed
Issue I worked on
see https://issues.openmrs.org/browse/RESTWS-963
Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
No? Unsure? -> configure your IDE, format the code and add the changes with
git add . && git commit --amendI have added tests to cover my changes. (If you refactored
existing code that was well tested you do not have to add tests)
No? -> write tests and add them to this commit
git add . && git commit --amendI ran
mvn clean packageright before creating this pull request andadded all formatting changes to my commit.
No? -> execute above command
All new and existing tests passed.
No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.
My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master