Closed brendanhay closed 3 years ago
A version of stripeapi
generated using this PR against the latest 2020-08-27
version of the Stripe API is available here.
On master
the *Parameter
data types for operations have the JSON keys prefixed with the schema name in the {To,From}JSON
instances, FWIW. You end up with JSON keys of the form "pathGetSubscriptionIdParametersExpand": ...
.
Hey @brendanhay! (Big fan of your work, keep it up :)) This project was made by two students for their bachelor thesis. They have since finished it and will probably not spend much time maintaining it. I guess that means that I'm supposed to be maintaining this but frankly I have other things to do a well.
As for this PR: I'd like to wait to start using language features until at least the compiler supports it, if you don't mind..
record-dot-preprocessor is something I use pervasively to improve the ergonomics of generated code, as a stop gap until RecordDotSyntax syntax starts shipping with GHC. It improves Haskell's record situation and particularly important for generated code, allows the use of duplicate field names with good inference without polluting your namespace(s) with ambiguous record selectors.
This PR generates
HasField
instances that are forwards/backwards compatible withRecordDotSyntax
and allows you to use the original Stripe API field names which are both considerably briefer than the generated prefixes and also align nicely with the Stripe API documentation.Code generation:
Usage with
record-dot-preprocessor
enabled:Impact:
record-hasfield
dependency in the generator and generated library.DataKinds
,FlexibleInstances
andMultiParamTypeClasses
extensions enabled in generated type and operation modules.See: