Currently, review-web is using the GraphQL String type to represent IP addresses in the schema. This requires manual validation and error handling in various queries and mutations to ensure that the provided IP addresses are valid.
I propose introducing a custom GraphQL scalar specifically designed for IP addresses. This would allow us to:
Automatically validate IP addresses at the schema level
Provide more informative error messages for invalid IP addresses
Simplify resolver logic by removing the need for manual validation
Improve type safety and consistency throughout the API
The custom scalar would be responsible for parsing and validating IP addresses, and could be implemented using the async-graphqlScalarType trait.
The implementation would involve creating a new custom scalar type, e.g. IpAddress, and updating the relevant parts of the schema to use this new type.
Currently, review-web is using the GraphQL
String
type to represent IP addresses in the schema. This requires manual validation and error handling in various queries and mutations to ensure that the provided IP addresses are valid.I propose introducing a custom GraphQL scalar specifically designed for IP addresses. This would allow us to:
The custom scalar would be responsible for parsing and validating IP addresses, and could be implemented using the
async-graphql
ScalarType
trait.The implementation would involve creating a new custom scalar type, e.g.
IpAddress
, and updating the relevant parts of the schema to use this new type.