Open endgame opened 1 year ago
Given both of the examples have floating point values - is the desired behaviour to just replace "." "_"
to make a valid constructor/identifier? Or is some kind of floating point equivalent of {To,From}Enum a
desired here?
I think we should just do replace '.' '_'
to begin with and look at doing something else if/when that proves insufficient. Are you thinking of PRing this for 2.0?
Yeah - considering if there’s any low hanging things that are breaking changes. I’ll take a look at this one today.
Okay, I've looked into this and it's annoying enough and affecting few enough people that I want to kick it back to post-2.0:
ShapeF ()
is parsed out from JSON, it builds the Enum
using a HashMap Id Text
Id
it calls mkId
on the enum values from botocoremkId
formats the identifier using format = upperHead . Text.dropWhile (not . Char.isAlpha)
""
, so they clobber each other in the HashMap
FromJSON (ShapeF ())
instance we don't know what type we're in (because shape names are stored as a JSON object)I don't really want to keep piling hacks atop hacks in this version of the generator. In the medium term, I want to build an AST representation of the data as it is represented in botocore, parsed out using waargonaut. (Unlike aeson, waargonaut remembers the order of keys in JSON objects, which is important for things like correctly emitting field names in order). Once we have that AST, I want to build a new version of the generator which takes the simplest necessary service description and write an adapter function between them. This will mean that people using IAM authentication with API Gateway can generate their own amazonka-style APIs to access them; Amazon's own Selling Partner API (SP-API) is a prominent example.
Example: Every value in
apigateway
'sCacheClusterSize
type contains only numbers and dots, so they all get mashed together into a single strange pattern:https://github.com/boto/botocore/blob/ac9ce8eb9ab4296608c95c5d04461266925d90e2/botocore/data/apigateway/2015-07-09/service-2.json#L2337-L2350
Affected types include:
amazonka-apigateway
:CacheClusterSize
amazonka-cloudhsm
:ClientVersion