Improve config validation in changelog command #2319
+49
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Per #2298 (comment) "We should make https://github.com/elastic/docs-builder/blob/main/config/products.yml the sole source of truth for allowed products."
Summary of Changes
available_types must be a subset of the default types
available_subtypes must be a subset of the default subtypes
available_lifecycles must be a subset of the default lifecycles
available_products (if specified) must all exist in config/products.yml
The code compiles successfully and follows existing patterns. Products are normalized (underscores converted to hyphens) for comparison, matching the existing product handling in the codebase.
Error handling
If I provide a configuration file that contains an invalid value, the command returns an error and fails to generate a changelog. For example:
Returns the following error when my
changelog.ymlcontains an invalid product value:Likewise if I don't use a
changelog.ymlconfiguration but use a value that's not in the list of global values:...I get an error and the changelog isn't created:
Generative AI disclosure
Tool(s) and model(s) used: composer-1 agent