GithubHelp home page GithubHelp logo

curl2swift's People

Contributors

codesee-maps[bot] avatar tomnvt avatar

Stargazers

 avatar

Watchers

 avatar

curl2swift's Issues

Response sub-models' mapping enhancement

When response has sub-model, s is removed from its key and the result is used as the sub-models name. s should be removed only in the case, when the sub-model is a list.

Also, the sub-model names should be capitalised.

Example of currently generated code:

    struct Response: Codable {
        let coord : coord?
        let weather : [weather]?
        let base : String?
        let main : main?
        let visibility : Int?
        let wind : wind?
        let clouds : cloud?
        let dt : Int?
        let sys : sy?
        let timezone : Int?
        let id : Int?
        let name : String?
        let cod : Int?

        enum CodingKeys: String, CodingKey {
            case coord = "coord"
            case weather = "weather"
            case base = "base"
            case main = "main"
            case visibility = "visibility"
            case wind = "wind"
            case clouds = "clouds"
            case dt = "dt"
            case sys = "sys"
            case timezone = "timezone"
            case id = "id"
            case name = "name"
            case cod = "cod"
        }
    }

    struct sy: Codable {
        let type : Int?
        let id : Int?
        let country : String?
        let sunrise : Int?
        let sunset : Int?

        enum CodingKeys: String, CodingKey {
            case type = "type"
            case id = "id"
            case country = "country"
            case sunrise = "sunrise"
            case sunset = "sunset"
        }
    }

    struct cloud: Codable {
        let all : Int?

        enum CodingKeys: String, CodingKey {
            case all = "all"
        }
    }

    struct wind: Codable {
        let speed : Double?
        let deg : Int?

        enum CodingKeys: String, CodingKey {
            case speed = "speed"
            case deg = "deg"
        }
    }

    struct main: Codable {
        let temp : Double?
        let feelsLike : Double?
        let tempMin : Int?
        let tempMax : Double?
        let pressure : Int?
        let humidity : Int?

        enum CodingKeys: String, CodingKey {
            case temp = "temp"
            case feelsLike = "feels_like"
            case tempMin = "temp_min"
            case tempMax = "temp_max"
            case pressure = "pressure"
            case humidity = "humidity"
        }
    }

    struct weather: Codable {
        let id : Int?
        let main : String?
        let description : String?
        let icon : String?

        enum CodingKeys: String, CodingKey {
            case id = "id"
            case main = "main"
            case description = "description"
            case icon = "icon"
        }
    }

    struct coord: Codable {
        let lon : Double?
        let lat : Double?

        enum CodingKeys: String, CodingKey {
            case lon = "lon"
            case lat = "lat"
        }
    }

where

    struct coord: Codable {

should be

    struct Coord: Codable {

and

    struct sy: Codable {

should be

    struct Sys: Codable {

Set query params together in one dictionary

When URL contains multiple query params, they are set one by one, so only the last call takes effect.

set(.queryParams(["q": "prague"]))
set(.queryParams(["appid": "theAppID"]))
set(.queryParams(["units": "metric"]))

Instead it should be called once, with all query params in one dictionary

set(.queryParams(["q": "prague", "appid": "theAppID", "units": "metric"]))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.