4 ms·
Are arrays of maps a bad idea? Someone posted a pom.xml file pointing out how horrible it was, and I thought to myself "How would this look in toml?" I was all
by GhotiFish 14y ago
Are arrays of maps a bad idea? Someone posted a pom.xml file pointing out how horrible it was, and I thought to myself "How would this look in toml?"
I was all set to try a translation when I hit this section:
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v2-rev53-1.13.2-beta</version>
</dependency>
<dependency>
<!-- A generated library for Google+ APIs. Visit here for more info:
http://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API
-->
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-plus</artifactId>
<version>v1-rev22-1.8.0-beta</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.13.2-beta</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-servlet</artifactId>
<version>1.13.1-beta</version>
</dependency>
How would I represent this in TOML?
[dependancy1]
groupId = "com.google.api-client"
artifactId = "google-api-client"
version = "1.13.2-beta"
[dependancy2]
groupId = "com.google.api-client"
artifactId = "google-api-client-servlet"
version = "1.13.1-beta"
That's not right, it clearly should be an array, but I don't think the standard supports it. At best I would think you'd have to use parallel arrays
[dependencies]
groupIds = ["com.google.api-client", "com.google.api-client"]
artifactIds = ["google-api-client" , "google-api-client-servlet"]
versions = ["1.13.2-beta" , "1.13.1-beta"]
and that's just not pretty.
- espadrine 14y agoI'm trying to lay down the issues with TOML, so I added this in… https://gist.github.com/espadrine/5028426 https://gist.github.com/espadrine/5028426
- simcop2387 14y agowhy not [dependencies.com.google.api-client] artifactId = "google-api-client" versions = "1.13.2-beta" [dependencies.com.google.api-client] artifactId = "google-api-client-servlet" versions = "1.13.1-beta"
- GhotiFish 14y agobut the syntax is colliding there, You define dependencies.com.google.api-client.artifactId twice. Also it creates the key value maps: dependencies.com dependencies.com.google which shouldn't exist, so that doesn't seem right either.
- simcop2387 14y agoGood point, I didn't notice that one. Certainly an interesting case. The ones that exist that shouldn't I don't think are as big of issues but it is certainly not an easy problem to solve here.