Skip to content
This repository has been archived by the owner on Aug 16, 2019. It is now read-only.

Broken Meta materialisation #27

Open
MP0w opened this issue Apr 16, 2017 · 3 comments
Open

Broken Meta materialisation #27

MP0w opened this issue Apr 16, 2017 · 3 comments

Comments

@MP0w
Copy link
Contributor

MP0w commented Apr 16, 2017

Looks like from this commit 57b6d0b ( @joanromano ) some meta fields were converted to snake_case, if we do this we need to make sure that during materialisation we convert camelCase to snake_case.

At the moment TabConfig (and maybe others too) are broken because its properties are camelCase but materialisation is looking for snake_case properties ("icon_name").

@MP0w
Copy link
Contributor Author

MP0w commented Apr 16, 2017

PS: we should have tests for this

@joanromano
Copy link
Contributor

joanromano commented Apr 20, 2017

So this was part of json schema alignments https://github.com/runtastic/Matrioska/pull/7/files

As long as the schema is followed the materialization should work properly (tests were also updated on those PRs), unless:

  • Materializing a ZipMeta with a list of ExpressibleByComponentMeta e.g:
let meta = ClusterLayout.TabBarConfig(selectedIndex: 0)
let zipMeta = ZipMeta(meta)
let tabBarConfig = ClusterLayout.TabBarConfig.materialize(zipMeta)
expect(tabBarConfig?.selectedIndex) == 0 // Fails, config is not materialized and we get a nil `selectedIndex`

From here, I guess there's two options:

  • We might want to fix this by converting keys (not sure if this should be done at materialize phase itself before ExpressibleByComponentMeta.init or within the later one, leaving that to each ExpressibleByComponentMeta to do it's own).
  • I guess we could also consider the use case of ZipMeta at all?

@joanromano
Copy link
Contributor

Funny enough, I opened and then closed (after thinking I was wrong) a similar issue some months ago #9

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

No branches or pull requests

2 participants