swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.74k stars 6.02k forks source link

[swift4] requestBuilder init with empty value isBody #8816

Open andreyshade opened 5 years ago

andreyshade commented 5 years ago

I have tried to generate test client for swift4, but init method has missing isBody value

Description

return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: )

Swagger-codegen version

3.0.0-rc1

Command line used for generation

java -jar swagger-codegen-cli-3.0.0-rc1.jar generate -i https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml -l swift4 -o swift4/

dastan28 commented 5 years ago

I have the same for swagger-codegen 3.0.3 In addition I also observe two issues:

  1. Problem with lining code. For example, let a = b + c let d = e +f all in the same line

  2. I know that models were rewritten for structs instead of classes. But I didn't find any solution which fixes recursive reference for model. For example, if model is the struct of Person type and has variable named "friend" of type Person then compiler says something like "Value type 'Person' cannot have a stored property that recursively contains it"

Version 2.3.1 works fine. Any suggestions?

brianhv commented 5 years ago

I'm also seeing missing isBody parameters when I download the swift4 SDK from Swagger Hub's mock-server API page.

clintonrocksmith commented 5 years ago

We have this same issue even when generating the PetShop YAML example which I thought would work.

open class func createPetsWithRequestBuilder() -> RequestBuilder<Void> {
        let path = "/pets"
        let URLString = SwaggerClientAPI.basePath + path        let parameters: [String:Any]? = nil

        let url = URLComponents(string: URLString)
        let requestBuilder: RequestBuilder<Void>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: )
    }

This issue is happening for Client Generation for Swift3 and Swift4 via the editor at http://editor.swagger.io/

t8rafa commented 5 years ago

I have the same 2 problems in swagger 3.0.4 @andreyshade please, edit this issue and set the label Client:Swift

rodericj commented 5 years ago

@t8rafa Can we just create a new one with that label and close this one?