Organize configuration objects to maximize clarity and maintainability while ensuring robust validation. Follow these principles: 1. Use single object definitions instead of multiple configurations to enable specific error messages
Organize configuration objects to maximize clarity and maintainability while ensuring robust validation. Follow these principles:
Example of good configuration structure:
// Instead of multiple object configurations:
{
oneOf: [
{ type: 'string' },
{ type: 'object',
properties: { ... }
}
]
}
// Use single object with clear validation:
{
type: 'object',
properties: {
type: { type: 'string' },
arn: { type: 'string' }
}
}
// Then validate complex rules in code:
if (config.arn && !isValidArn(config.arn)) {
throw new Error('Invalid ARN format provided');
}
This approach ensures configurations are easy to understand, maintain, and debug while providing clear feedback when issues arise.
Enter the URL of a public GitHub repository