Skip to content

[Swift] Does <modelName>API class need to be an inner class of <projectName>API ? #2157

Description

@hideya

This is a discussion on request for improvement (not a bug).
For example for the Petstore demo, PetAPI class is generated as a inner class of PetstoreClientAPI:

extension PetstoreClientAPI {   
    public class PetAPI: APIBase {

Because of that, code to invoke a method of PetstoreClientAPI becomes a bit lengthy like the following:

        let newPet = Pet()
        ...
        PetstoreClientAPI.PetAPI.addPet(body: newPet).execute().then { response -> Void in

I'm wondering if this could just be PetAPI.addPet(body: newPet) without PetstoreClientAPI.?
Note that the model class Pet is not an inner class and can be accessed by just saying Pet. I don't see any strong reason for PetAPI being an inner class. What would you folks think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions