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

fix: OpenAPI - WebMessage response as oneOf schema [DHIS2-18251] #18858

Merged
merged 13 commits into from
Oct 21, 2024

Conversation

jbee
Copy link
Contributor

@jbee jbee commented Oct 17, 2024

Summary

Goal was to fix the OpenAPI reflection of the WebMessage.response property.

This has always been a special handling situation around WebMessageResponse. The issue was that the classes were located in modules that could not be referenced and so special handling was hard-coded.
This PR removes this special handling and details the property with all the possible types (oneOf in OpenAPI terms).

This now looks like this

DHIS2-API-2-42-10-21-2024_11_44_AM

To get there a cleanup was required which mainly moved files around and removed special handling.

  • introduced BasicWebMessage
  • WebMessage itself is not a WebMessageResponse
  • removed AbstractWebMessageResponse
  • all implementations of WebMessageResponse are in web-api module
  • WebMessageResponse always states its responseType based on the Class.getSimpleName() (existed as a concept before but wasn't used/implemented consistently)
  • removed the "plain before" concept as it was only relevant for 2.37- which at this point is EOL and it was in the way of the cleanup
  • Exceptions that become web messages now can link to BasicWebMessage (WebMessage has web layer refs and cannot be used and fields added would be null anyhow for errors)

Most classes were moved without changing the package to reduce the risk of breaking something odd.
A few exceptions were moved into another package when it felt safe to do so.
Long term we have to cleanup the packages in another PR.

Manual Testing

Open /api/openapi/openapi.html?domain=DataElement#WebMessage and compare to image above

@jbee jbee changed the title chore: WebMessage cleanup fix: OpenAPI - WebMessage response as oneOf schema [DHIS2-18251] Oct 21, 2024
Copy link

@jbee jbee marked this pull request as ready for review October 21, 2024 09:45
@jbee jbee merged commit accad72 into master Oct 21, 2024
15 checks passed
@jbee jbee deleted the openapi-web-message branch October 21, 2024 11:30
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