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

feat(swagger): Springfox to openapi migration #1380

Merged

Conversation

MichaelsJP
Copy link
Member

@MichaelsJP MichaelsJP commented Mar 31, 2023

Pull Request Checklist

  • 1. I have rebased the latest version of the master branch into my feature branch and all conflicts
    have been resolved.
  • 2. I have added information about the change/addition to functionality to the CHANGELOG.md file under the
    [Unreleased] heading.
  • 3. I have documented my code using JDocs tags.
  • 4. I have removed unnecessary commented out code, imports and System.out.println statements.
  • 5. I have written JUnit tests for any new methods/classes and ensured that they pass.
  • 6. I have created API tests for any new functionality exposed to the API.
  • 7. If changes/additions are made to the ors-config.json file, I have added these to the ors config documentation
    along with a short description of what it is for, and documented this in the Pull Request (below).
  • 8. I have built graphs with my code of the Heidelberg.osm.gz file and run the api-tests with all test passing
  • 9. I have referenced the Issue Number in the Pull Request (if the changes were from an issue).
  • 10. For new features or changes involving building of graphs, I have tested on a larger dataset
    (at least Germany), and the graphs build without problems (i.e. no out-of-memory errors).
  • 11. For new features or changes involving the graphbuilding process (i.e. changing encoders, updating the
    importer etc.), I have generated longer distance routes for the affected profiles with different options
    (avoid features, max weight etc.) and compared these with the routes of the same parameters and start/end
    points generated from the current live ORS.
    If there are differences then the reasoning for these MUST be documented in the pull request.
  • 12. I have written in the Pull Request information about the changes made including their intended usage
    and why the change was needed.
  • 13. For changes touching the API documentation, I have tested that the API playground renders correctly.

Close #1027

Information about the changes

  • Key functionality added: Upgrade from springfox to springboot openapi
  • Reason for change: The springfox package is not maintained and outdated. It's also not compatible with spring-boot 3, which is the only blocker currently to not upgrade.

Required changes to ors config (if applicable)

  • Added swagger_documentation_add_autogenerated_url to let the user decide if the auto-generated (localhost) url should be added to the available servers. This is needed since the openapi package defines the servers as an array of possible endpoints, rather than a fixed string for one url only.

@MichaelsJP MichaelsJP linked an issue Mar 31, 2023 that may be closed by this pull request
@MichaelsJP MichaelsJP force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch from 0839c7b to e12388c Compare March 31, 2023 16:54
@MichaelsJP MichaelsJP self-assigned this Mar 31, 2023
@MichaelsJP MichaelsJP force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch 2 times, most recently from 4d72651 to e713c0d Compare April 3, 2023 11:37
@MichaelsJP MichaelsJP force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch from a5ba5ae to 2c602c6 Compare April 17, 2023 14:36
@TheGreatRefrigerator TheGreatRefrigerator force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch from 596a0b6 to 486d852 Compare April 17, 2023 14:56
@MichaelsJP MichaelsJP force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch 4 times, most recently from 9efae30 to 031b889 Compare April 26, 2023 12:12
@MichaelsJP MichaelsJP force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch from 031b889 to 345f2b3 Compare May 5, 2023 12:31
@MichaelsJP MichaelsJP force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch from 345f2b3 to 556258a Compare May 22, 2023 16:09
@MichaelsJP MichaelsJP changed the title Springfox to openapi migration feat:Springfox to openapi migration May 22, 2023
@MichaelsJP MichaelsJP changed the title feat:Springfox to openapi migration feat(openapi): Springfox to openapi migration May 22, 2023
@github-actions github-actions bot added feature and removed feature labels May 22, 2023
@MichaelsJP MichaelsJP changed the title feat(openapi): Springfox to openapi migration feat(swagger): Springfox to openapi migration May 22, 2023
@github-actions github-actions bot added feature and removed feature labels May 22, 2023
@MichaelsJP MichaelsJP force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch 4 times, most recently from c049c1c to 0c0dc57 Compare May 25, 2023 08:52
@jarinox
Copy link

jarinox commented Jun 5, 2023

There is a ptRequest field generated for directions/* POST routes which should not be there.

image

@MichaelsJP
Copy link
Member Author

MichaelsJP commented Jun 7, 2023

@jarinox Yes and no. We'll have public transit soon in our live API and the code supports it already. A curl request looks like this

curl -d '{"coordinates": [[8.6729581, 49.4468535], [8.7067204, 49.3786147]], "departure": "2022-07-04T13:02:26Z"}'` \
-H "Content-Type: application/json" -X POST http://localhost:8080/ors/v2/directions/pt

Makes sense with the parameter, right?
But maybe it could be worth hiding it from our live API docs until it's really available.

@MichaelsJP MichaelsJP force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch 4 times, most recently from 58b4b90 to 9908662 Compare June 19, 2023 11:24
@github-actions github-actions bot added feature and removed feature labels Jun 19, 2023
This removes the outdated springfox library that was serving the swagger <3 version.
openapi introduces swagger with version >=3 using the new openapi standard. The package is maintained and compatible with newer spring-boot versions.

Co-authored-by: Amandus Butzer <amandus.butzer@heigit.org>
@MichaelsJP MichaelsJP force-pushed the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch from 9850763 to b765ce9 Compare June 19, 2023 16:20
@MichaelsJP MichaelsJP marked this pull request as ready for review June 19, 2023 16:21
@github-actions github-actions bot added feature and removed feature labels Jun 19, 2023
@MichaelsJP MichaelsJP requested a review from takb June 20, 2023 07:35
@github-actions github-actions bot removed the feature label Jun 20, 2023
@MichaelsJP MichaelsJP removed the request for review from TheGreatRefrigerator June 20, 2023 07:36
@github-actions github-actions bot added feature and removed feature labels Jun 20, 2023
Copy link
Contributor

@takb takb left a comment

Choose a reason for hiding this comment

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

finally! lgtm.

@MichaelsJP MichaelsJP merged commit af529d0 into master Jun 20, 2023
27 checks passed
@MichaelsJP MichaelsJP deleted the 1027-migrate-from-springfox-swagger-to-springdoc-openapi branch June 20, 2023 08:54
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.

migrate from springfox-swagger to springdoc-openapi
4 participants