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

Simplify OpenAPI Generator #522

Merged

Conversation

andrewdmontgomery
Copy link
Contributor

@andrewdmontgomery andrewdmontgomery commented Oct 21, 2024

Closes #

Description

This simplifies our OpenAPI Generator setup, and borrows from the work done in #486:

  • Simplifies the generate command:
    • Calls: docker run --rm openapitools/openapi-generator-cli:"v7.5.0" generate
      • It fetches the official docker container instead of using the locally fetched generator in a custom docker container
      • The install-and-generate Makefile task has been removed, as it is no longer required
    • Generates all file types by default (instead of just models)
      • Uses .openapi-generator-ignore to selectively ignore which file/folders should be created
    • Passes new options to --additional-options
  • Moves all openapi-generate activity into the opeapi directory
    • Files are generated here, and are copied elsewhere as needed
      • The swift5 generator supports outputing source files as a Swift Package. While we aren't using it as a Swift Package, using that folder structure feels more natural. So the generated source files are in Sources. They are then rsynced to their final destination

Note

After this PR merges, we will want to delete the openapi-generator directory in the root of the repo.

This PR no longer requires or uses the openapi-generator directory. That folder is currently ignored by git. But since we don't need this folder any more, this PR stops ignoring that folder.

Testing Steps

  1. Make sure Docker is running locally
  2. Run make generate
  • OBSERVE:
    • Docker downloads the proper image (7.5.0) (only occurs the first time):
Unable to find image 'openapitools/openapi-generator-cli:v7.5.0' locally
v7.5.0: Pulling from openapitools/openapi-generator-cli
a5319f8e5f3f: Pull complete
d3aab5129936: Pull complete
b47927223c23: Pull complete
b2a3e41ae21b: Pull complete
914200ed739a: Pull complete
2b2d8033142b: Pull complete
505e99177f70: Pull complete
Digest: sha256:cdf11948948de9c21c6035de47dd5fc73c1651c8ba2ea0a4b86a527608ef52a9
Status: Downloaded newer image for openapitools/openapi-generator-cli:v7.5.0
  • The only changes to source files in Sources/Gravatar/OpenApi/Generated should be the usual changes to access package --> public levels, which we are currently correcting by hand.
- package struct Avatar: Codable, Hashable, Sendable {
-    package enum Rating: String, Codable, CaseIterable, Sendable {
+ public struct Avatar: Codable, Hashable, Sendable {
+    public enum Rating: String, Codable, CaseIterable, Sendable {

@wpmobilebot
Copy link

Gravatar UIKit Prototype Build📲 You can test the changes from this Pull Request in Gravatar UIKit Prototype Build by scanning the QR code below to install the corresponding build.
App NameGravatar UIKit Prototype Build Gravatar UIKit Prototype Build
Build Number1583
Version1.0
Bundle IDcom.automattic.gravatar-sdk-demo-uikit.prototype-build
Commit1ef109a
App Center BuildGravatar SDK Demo - UIKit #299
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link

Gravatar SwiftUI Prototype Build📲 You can test the changes from this Pull Request in Gravatar SwiftUI Prototype Build by scanning the QR code below to install the corresponding build.
App NameGravatar SwiftUI Prototype Build Gravatar SwiftUI Prototype Build
Build Number1583
Version1.0
Bundle IDcom.automattic.gravatar-sdk-demo-swiftui.prototype-build
Commit1ef109a
App Center BuildGravatar SDK Demo - SwiftUI #298
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Copy link
Contributor

@etoledom etoledom left a comment

Choose a reason for hiding this comment

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

Looking great 🎉

@andrewdmontgomery andrewdmontgomery merged commit 0cadaec into release/3.0.0 Oct 22, 2024
9 checks passed
@andrewdmontgomery andrewdmontgomery deleted the andrewdmontgomery/simplify-openapi-generator branch October 22, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants