Broken generation of identifiers in 2 function that can be provided in config:
generateWorkspaceName: allows to generate workspace identifiers
generateTypeName: allows to generate type identifiers (for top level schema nodes)
Some notes on the idea behind the implementation:
I have separated this into 2 function as I see a benefit of having just one for workspaces
both function have a similar signatures:
first parameter is the an already typescript ready identifier, which has been generated from the schema/node name using the default generate type function (so it can be directly returned)
second parameter is an object that gives more context of the schema/node. The intent is to:
give access to the raw schema/node name (to generate it from it, use it in a switch, etc)
give access to other schemas/nodes in case custom logic to avoid duplicate names is needed
in case of the nodes, give access to the schema being used on in case is needed
the returned string should be a valid typescript identifier, and no sanitisation is done
Broken generation of identifiers in 2 function that can be provided in config:
generateWorkspaceName
: allows to generate workspace identifiersgenerateTypeName
: allows to generate type identifiers (for top level schema nodes)Some notes on the idea behind the implementation:
switch
, etc)Actual signatures:
Questions:
defaultGenerateTypeName
helper be renamed tosanityNameToTypeName
orsanityNameToIdentifier
?