Skip to content
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

OH2-205: Add code generation on Swagger #290

Merged

Conversation

ArnaudFonzam
Copy link
Contributor

@ArnaudFonzam ArnaudFonzam commented Jun 20, 2023

See OH2-205 and OH2-209.

This pull request is to solve the problem of code genation that are false by default, In other to avoid special character when we generate the specification code. I have also change PageResponseDTO with Page because the name is too long.

Paired with informatici/openhospital-core#1035.

TODO

  • now with swagger 3 there's no need to add "Bearer " in the swagger interface, so I would change the README too
  • now with swagger 3 the UI responds to http://localhost:8080/swagger-ui/index.html to update in the README
  • in swagger UI there are two endpoints /auth/login to be fixed (only one) as suggested

@mwithi
Copy link
Member

mwithi commented Jun 20, 2023

I have also change PageResponseDTO with Page because the name is too long

I can see only this change. Also, there are conflicts with the develop branch: did you sync your develop before to make changes?

@mwithi
Copy link
Member

mwithi commented Jun 27, 2023

What about the "security scope" errors?

image

@mwithi
Copy link
Member

mwithi commented Jun 27, 2023

After some research, it seems to me that scopes are not applicable to ApiKey type, so to solve the "scope error", it should be enough to pass an empty array here:

	List<SecurityReference> defaultAuth() {
		return Arrays.asList(new SecurityReference("JWT", new AuthorizationScope[0]));
	}

After that, everything seems still working fine, but still some validation errors occur:

image

@ArnaudFonzam
Copy link
Contributor Author

I have add the empty array in defaultAuth like you suggest but i have new error:
serror

@ArnaudFonzam
Copy link
Contributor Author

ArnaudFonzam commented Jun 29, 2023

The error about equivalent path is cause by the new specification of OpenAPI that not allow the same path with different verb. look here : swagger-api/swagger-editor#1677

@mwithi
Copy link
Member

mwithi commented Jun 29, 2023

The error about equivalent path is cause by the new specification of OpenAPI that not allow the same path with different verb. look here : swagger-api/swagger-editor#1677

I think the "equivalent path" is a symptom the API are not well organized and it could be a suggestion to adopt better practises.

What about the other errors?

@ArnaudFonzam
Copy link
Contributor Author

The last error is because in TherapyDTO we have array of date which not have a good reference. please why we have array of date in TherapyDTO
therapy

@mwithi
Copy link
Member

mwithi commented Jun 29, 2023

The last error is because in TherapyDTO we have array of date which not have a good reference. please why we have array of date in TherapyDTO

It's the list of dates in which the patient should take the drugs, they are calculated from startDate by adding freqInPeriod up to endDate

@ArnaudFonzam
Copy link
Contributor Author

I have try to solve error and i have that last error
enerror

@mwithi
Copy link
Member

mwithi commented Jun 29, 2023

I have try to solve error and i have that last error

Can you check that RFC?

@ArnaudFonzam
Copy link
Contributor Author

yes I am working on its

@mwithi
Copy link
Member

mwithi commented Jun 30, 2023

with latest version I can still see this error:

image

Moreover, I think the UI should be updated with the new API, so a new PR is needed on that side!

@ArnaudFonzam
Copy link
Contributor Author

ArnaudFonzam commented Jun 30, 2023

with latest version I can still see this error:

image

Moreover, I think the UI should be updated with the new API, so a new PR is needed on that side!

yes. but this error is genereted automatically it is about the response status of LoginController. and we can remove the line of error after generation

@mwithi
Copy link
Member

mwithi commented Jun 30, 2023

yes. but this error is genereted automatically it is about the response status of LoginController. and we can remove the line of error after generation

is it related to informatici/openhospital-ui#483 ?
Anyway I added under the screenshot "Moreover, I think the UI should be updated with the new API, so a new PR is needed on that side."

@ArnaudFonzam
Copy link
Contributor Author

yes. but this error is genereted automatically it is about the response status of LoginController. and we can remove the line of error after generation

is it related to informatici/openhospital-ui#483 ? Anyway I added under the screenshot "Moreover, I think the UI should be updated with the new API, so a new PR is needed on that side."

okay but the error appear because the status 200 don't have the description

yes. but this error is genereted automatically it is about the response status of LoginController. and we can remove the line of error after generation

is it related to informatici/openhospital-ui#483 ? Anyway I added under the screenshot "Moreover, I think the UI should be updated with the new API, so a new PR is needed on that side."

the error is not about this fond-end task. it is related to the logout api. the error appear because the 200 status don't have description. to solve it we can just remove the 200 status.

errL

@mwithi
Copy link
Member

mwithi commented Jul 3, 2023

The new generated code is ok, but I think the UI is not yet ready for the changes in this PR. Please let's open a PR for OH2-205 also on front-end side

image

@ArnaudFonzam
Copy link
Contributor Author

ArnaudFonzam commented Jul 4, 2023

The new generated code is ok, but I think the UI is not yet ready for the changes in this PR. Please let's open a PR for OH2-205 also on front-end side

image

okay but I think we can close this PR so that I can continous with new task. I have update the spec file and I will share it with steve in other to update the api route on the front end side
[OH2-205]: https://openhospital.atlassian.net/browse/OH2-205?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

@mwithi
Copy link
Member

mwithi commented Jul 4, 2023

okay but I think we can close this PR so that I can continous with new task. I have update the spec file and I will share it with steve in other to update the api route on the front end side

What I mean is that if we merge this, the front-end UI is automatically broken and we don't know for how long. I will not suggest this way of doing things... when the PR will be ready on the UI side, we will merge them together.

You can continue with other tasks starting from develop, changes in this branch are not affecting the whole codebase, you will be able to rebase your work onto develop after the merge.

@ArnaudFonzam
Copy link
Contributor Author

okay but I think we can close this PR so that I can continous with new task. I have update the spec file and I will share it with steve in other to update the api route on the front end side

What I mean is that if we merge this, the front-end UI is automatically broken and we don't know for how long. I will not suggest this way of doing things... when the PR will be ready on the UI side, we will merge them together.

You can continue with other tasks starting from develop, changes in this branch are not affecting the whole codebase, you will be able to rebase your work onto develop after the merge.

Okay so I will create the task and attach the spec file on its. and assign it to steve so that he will align the front-end with the backend.

Co-authored-by: Alessandro Domanico <alessandro.domanico@yahoo.it>
mwithi

This comment was marked as outdated.

pom.xml Outdated Show resolved Hide resolved
Copy link
Member

@mwithi mwithi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the comments

Co-authored-by: Alessandro Domanico <alessandro.domanico@yahoo.it>
ArnaudFonzam and others added 4 commits July 14, 2023 12:14
ArnaudFonzam and others added 4 commits July 15, 2023 08:09
Co-authored-by: Alessandro Domanico <alessandro.domanico@yahoo.it>
Co-authored-by: Alessandro Domanico <alessandro.domanico@yahoo.it>
* Update README.md with Swagger 3 instructions

---------
Co-authored-by: ArnaudFonzam <101590821+ArnaudFonzam@users.noreply.github.com>
Co-authored-by: David B Malkovsky <david@malkovsky.org>
Co-authored-by: Alessandro Domanico <alessandro.domanico@yahoo.it>
@mwithi mwithi merged commit f46e15b into informatici:develop Jul 17, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants