Skip to content
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

CB not creating the outer init correctly. #19

Open
EdHasted opened this issue Sep 25, 2018 · 4 comments
Open

CB not creating the outer init correctly. #19

EdHasted opened this issue Sep 25, 2018 · 4 comments

Comments

@EdHasted
Copy link

NASAJSON.txt

Firstly NIX for a great App, awesome isn't a word I use that often being a lot older than you but a very impressive piece of work, many thanks.

Attached is some very typical NASA JSON from their public interfaces. It's actually relatively simple and well behaved compared to what you can request :-)

I am taking this and then running it through CuteBaby to generate the structure off the JSON.

Towards the bottom of the output CB has two errors:-

    • Unsupported; array in array!
  1. init?(json: [String: Any]) {

I think 2. is meant to be the init for NewModel.

I am Decodable(ing) all the structs and everything else is fine although the array is being handled piecemeal.

Could I have your thoughts?

Many thanks,

Ed Hasted


@EdHasted
Copy link
Author

Hi - I have run this with the Codable option ticked (doh) but it still doesn't create the Init for NewModel so you still get a "Type 'NewModel' does not conform to protocol 'Decodable'" error.

@EdHasted
Copy link
Author

Also has two further errors lower down:

let messages: [Any] //TODO: Specify the type to conforms Decodable protocol
let time: [Any] //TODO: Specify the type to conforms Decodable protocol

If you // them out the process appears to work and compiles.

Think there is some minor modification to the code required - fantastic work.

@nixzhu
Copy link
Owner

nixzhu commented Sep 26, 2018

@EdHasted The NASAJSON has some parts that Baby can not handle.

  1. The ALLSKY_SFC_SW_DWN is a dictionary, but maybe have different keys for different response.
  2. The messages is a array, but with no items in it.
  3. The time is a array with sub array as it's item (which item's type is String or Double)

I'm sorry that Baby is not strong enough to infer this JSON.

@EdHasted
Copy link
Author

Many thanks - still think it's an excellent App. Can you recommend any products that might be able to generate the Swift code as I need a solution fast? Again many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants