-
Notifications
You must be signed in to change notification settings - Fork 99
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
Multiple OpenAPI spec files #132
Comments
Hi @daliad007, yes you can put one OpenAPI document into each target, so it's best to follow this strategy, and then import the targets with generated code into your target that uses the generated code. |
That makes sense @czechboy0 Looking at the doc, it seems it's also possible to generate the client in your own Swift package. So, in this case there could be multiple packages consuming each its own service. The packages would then be imported into our target. |
Exactly. You don't need a whole package for each, you can have a separate target for each document, all within the same package. But the point stands, you should be able to talk to any number of services from your client using the generated code. |
Is there anything that prevents multiple OpenAPI specs from running in a single target? Like, let's say we generate them in separate targets - but then have some sort of copy command to have them run in a single target. I believe they're namespaced out, other than a handful of common files? I'm wondering because I've been having a bit of a nightmare of a time creating a binary framework package since Xcode 14.3 when I have multiple targets, but it appears to work fine with a single target. Trying to workaround this problem in the short term until I can figure out the long term solution. |
Are you using the generated types in the public API of the binary framework? If you avoid that, and use |
@czechboy0 Thanks! That was very helpful information - there appeared to be something else wrong in 14.3.1 that magically disappeared in 15.0 (didn't even change my code/scripts 🤷🏽 ). For anyone checking this out later, you'll probably want to @_implementationOnly import MyGeneratedAPI
import Foundation
@_implementationOnly import OpenAPIRuntime
@_implementationOnly import OpenAPIURLSession |
@sureshjoshi, yes, but only if you're building with library evolution mode enabled. |
@czechboy0 I used the approach and created a separate package but now in my product's target I face an issue with internal access of generated Components.Schema from the library. What the reason to generate internal accessible model if I can't use it inside my product? Is there way I can get at least raw format and decode it into a product's model? |
Nevermind, I found his thread which resolved my issue |
Hello,
Would like to know if it's currently possible to use the package with more than one specification file. This is needed in our project as we'd look at consuming multiple services.
Thank you!
The text was updated successfully, but these errors were encountered: