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

Utils - Initial functionality & documentation added #1

Merged
merged 26 commits into from
Oct 3, 2024
Merged

Utils - Initial functionality & documentation added #1

merged 26 commits into from
Oct 3, 2024

Conversation

slloyd-src
Copy link
Contributor

Services added and descriptions added to detail.md
Unit tests added
OpenAPI headers added to allow swagger UI to display helpful information
detail.md has details of each specific endpoint

Utils package used to separate anything that MAY become a library later on if required.
Refactored some code & paths
Added ID to update request for robustness
Cleared the database before each test to make them non-deterministic
- Changed the response type of getObservations to XML for consistency
- Updated the unit test for getObservations to handle the wrapper response type (for XML lists)
…e to revert so they're all "observation" if required)

Removed some duplicate code
Updated error out method to handle a specialised type
made sure that adding both SimpleObservations and DerivedObservations are tested.
-Added a unit test for updating (which also uses the above)
minor corrections
error responses now return text/plain
- Added a getCollections method
- unit tests for paging and collections
- Added a getCollections method
- unit tests for paging and collections
Common method added for pagination requests
Fixed unit test parsing the text/plain response from getCollectionIds
@slloyd-src
Copy link
Contributor Author

Github's CI build phase currently fails due to org.opencadc:CAOM:2.5.0-SNAPSHOT not being found in the outside world.

  • What went wrong:
    Failed to notify build listener.

Could not resolve all artifacts for configuration ':quarkusDevBaseRuntimeClasspathConfiguration'.
Could not find org.opencadc:CAOM:2.5.0-SNAPSHOT.
Required by:
project :
There is 1 more failure with an identical cause.

Copy link
Member

@pahjbo pahjbo left a comment

Choose a reason for hiding this comment

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

the design of the REST interface end-points is not really what I think of as "standard" - it differs in a couple of ways

  • the "verb" is appearing in the URI - this is not necessary - so for instance
    DELETE [/observations/delete/{observationId}] can just be DELETE [/observations/{observationId}]
  • the create and update operations are mapped to the opposite HTTP verbs than is usual - i.e. the normal thing is create => POST and update => PUT

I think that https://stackoverflow.blog/2020/03/02/best-practices-for-rest-api-design/#h2-2eb87cd076da0 goes over this in a bit more detail

It would be good to just tweak the endpoints to follow that pattern

- DELETE has verb in API removed.
- unit tests & details updated to reflect this
@slloyd-src
Copy link
Contributor Author

@pahjbo amendments made as requested including the minor changes to the details.md

@pahjbo
Copy link
Member

pahjbo commented Oct 3, 2024

I have removed all of the verbs from endpoint URIs - I am not sure that the collections and derivedObservation endpoints are really correct, but will merge for now

@pahjbo pahjbo merged commit 9792a1f into main Oct 3, 2024
0 of 2 checks 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.

2 participants