Closed harish-suthar closed 9 months ago
Hi @harish-suthar. Yes we do support Custom Scalars, you can find the documentation for it here.
@calvincestari I saw the document and it states "Because custom scalar files are only generated once, they can then be edited, and your changes will never be overwritten by subsequent code generation execution."
Which means one have to manually edit file once but the question I asked is a kind of option where one can declare and then no need to edit the generated code.
Which means one have to manually edit file once but the question I asked is a kind of option where one can declare and then no need to edit the generated code.
The answer is in the name of the feature - "Custom" Scalars. This means it's a completely custom type that Apollo iOS does not have any knowledge of and you need to write the customized logic to handle transformation of the type and it's format.
The documentation also states that "By default, each custom scalar is treated as a Swift String
". If all you want is a custom type name but it's OK for it to be a Swift String
type then you don't need to write any custom logic. However, if your custom scalar type is anything like the GeoPoint
example then you must write the logic yourself, this is why codegen does not overwrite the file.
Question
Is there customTypeMapping in apollo-codegen-config.json something similar to apollo-kotlin?