-
Notifications
You must be signed in to change notification settings - Fork 29
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
Update Generated extension names to better reflect their contents #116
Conversation
Perfect 👍 Edit: actually |
I wonder if its easiest here to just go back on what we said earlier and continue to embed the extensions inside the merged file? I'm trying to remember why I suggested that and I think the only real reason was because I thought it would be easier and would push people towards not merging sources. Any concerns with that? Alternatively I could think of a better name, but I've got nothing. |
I think that's good for merged. However, I think there's a good probability that a few schemas exist that have a |
Yeah at a minimum the generator should probably spot that conflict and error, but I'm looking at the file output formatting code now and again I think we could doing some refactoring in this area to clean things up nicely. I'll merge them in for the time being but will keep this in mind 👍 |
Actually, an object called |
Actually, what if we changed the namespace to be the name of the package/module by default? This would only affect paths but that's a correct expectation. The directory Paths/ would stay the same as it holds paths. import PetStoreAPI
let petsRequest = PetStoreAPI.getPets() Edit: scratch that, there's a bug in the compiler when using the same name as the module for namespacing purposes: apple/swift#43510. I remembered OpenAPITools works around this issue by making names somewhat dumb. Wouldn't hurt to make sure though. |
Wasn't possible with "+" in file names 😄 |
eebd646
to
52a411d
Compare
Reverted the behaviour when using They're only placed outside of the Entities/Paths group when generating them in split mode. It avoids naming collisions and lets us stick with more natural names |
52a411d
to
7212b92
Compare
When looking at the generated output, I didn't get the feeling that the extension files were named very naturally.
For example, a file containing the
StringCodingKey
type is named Entities+CodingKey.swift which to me feels a bit disconnected. If I was naming it myself, I'd have gone with StringCodingKey.swift instead.In the end, I decided to rename the all of the files to better reflect their contents:
options.paths.namespace
)WDYT @LePips ?