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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --use-cache option to generate command #280

Open
liamnichols opened this issue Aug 31, 2021 · 0 comments
Open

Add a --use-cache option to generate command #280

liamnichols opened this issue Aug 31, 2021 · 0 comments

Comments

@liamnichols
Copy link
Contributor

liamnichols commented Aug 31, 2021

Background

馃憢 I'm currently thinking of introducing SwagGen into our project and I am trying to work out the best developer experience when it comes to integrating. So far, I am looking to decide between the following options:

  1. Commit generated source to Git, run SwagGen on-demand whenever the spec needs updating
  2. Commit OpenAPI spec to Git, run SwagGen as part of workspace generation script repeatedly

I'm leaning towards option 2, since this fits in nicely with other tools we use such as XcodeGen and CocoaPods but when evaluating SwagGen, the one thing that I noticed was that for our beefy spec, it seems to take a while to generate the output and if we were to integrate SwagGen as part of our workspace generation process, we'd be running the command numerous times a day when in reality the generated sources will likely change very infrequently.

For this reason, an option to bypass the generation in the event that the inputs (template, options, spec) haven't changed would be super beneficial to me and hopefully other users of the tool.

Description

With the above in mind, I am proposing the introduction of a --use-cache option that operates in a very similar way to the one that exists in XcodeGen.

Before I dig further into implementing such functionality, I first wanted to check if this makes sense for the direction of the tool? Additionally if it does make sense, I want to check that the caching system in XcodeGen is the best approach in retrospective? From my perspective it seems to do the job well, but you might have better insights after implementing it once already that I am unaware of 馃槃

I imagine that this can integrate into GenerateCommand also. I did however wonder if there was the opportunity to extract some of the implementation from XcodeGen into its own library to share it? Although it looks relatively small anyway so maybe this is overkill, I'm not sure 馃槄

I think the one difference might be that with SwagGen, I want to be able to fingerprint the template directory files to detect if they have been modified whereas XcodeGen doesn't care about the file contents that it tracks.

Anyway, please let me know your initial thoughts @yonaskolb. I'd be happy to think through a more detailed plan and take the implementation on if the overall idea makes sense. Thanks!

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

No branches or pull requests

1 participant