it’s mostly when bindings to JS libs that use option objects.
For example today I’m binding this with:
type t
@obj
external make:
(
~ownerConnectionString: string=?,
~retryOnInitFail: bool=?,
~watchPg: bool=?,
~pgDefaultRole: string=?,
~dynamicJson: bool=?,
~setofFunctionsContainNulls: bool=?,
~classicIds: bool=?,
~disableDefaultMutations: bool=?,
~ignoreRBAC: bool=?,
~ignoreIndexes: bool=?,
~includeExtensionResources: bool=?,
// ~showErrorStack: bool or 'json',
// ~extendedErrors: any combo of ['hint', 'detail', 'errcode'],
~handleErrors: array(GraphQlError.t) => array(GraphQlError.t)=?,
~appendPlugins: array(GraphileBuild.plugin)=?,
~prependPlugins: array(GraphileBuild.plugin)=?,
~replaceAllPlugins: array(GraphileBuild.plugin)=?,
~skipPlugins: array(GraphileBuild.plugin)=?,
~readCache: string=?,
~writeCache: string=?,
~exportJsonSchemaPath: string=?,
~exportGqlSchemaPath: string=?,
~sortExport: bool=?,
~graphqlRoute: string=?,
~graphiqlRoute: string=?,
~externalUrlBase: string=?,
~graphiql: bool=?,
~enhanceGraphiql: bool=?,
~enableCors: bool=?,
~bodySizeLimit: string=?, // human readable e.g. 200kb or 5MB
~enableQueryBatching: bool=?,
~jwtSecret: string=?,
~jwtVerifyOptions: JWTVerifyOptions.t=?,
~jwtRole: string=?,
// ~jwtAudiences: string=?, // deprecated
~jwtPgTypeIdentifier: string=?,
~legacyRelations: string=?, // only, deprecated, or omit
~legacyJsonUuid: bool=?,
~disableQueryLog: bool=?,
~pgSettings: Express.Request.t => Js.Dict.t(string)=?,
~additionalGraphQLContextFromRequest: Express.Request.t =>
Js.Dict.t(string)
=?,
~pluginHook: pluginHookOutput=?,
~simpleCollections: [ | `omit | `only | `both]=?,
~queryCacheMaxSize: int=?,
~simpleSubscriptions: bool=?,
~subscriptions: bool=?,
~subscriptionAuthorizationFunction: string=?,
~readOnlyConnection: string=?,
~defaultPaginationCap: int=?,
~graphqlDepthLimit: int=?,
~graphqlCostLimit: int=?,
~exposeGraphQLCost: bool=?,
~graphileBuildOptions: GraphileBuildOptions.t=?,
~live: bool=?,
~allowExplain: unit => bool=?,
unit
) =>
t
}
Being able to just use a simple rescript object would definitely be nicer, especially when you have nested config objects.