Swagger-codegen: [swift4] requestBuilder init with empty value isBody

Created on 16 Oct 2018  路  5Comments  路  Source: swagger-api/swagger-codegen

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/

Most helpful comment

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?

All 5 comments

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?

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

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/

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

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

Was this page helpful?
0 / 5 - 0 ratings