Skip to content

109 docs validate readme template structure in elastic package #2716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

haetamoudi
Copy link
Contributor

This is a WIP.

Discussion in package-spec

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 8, 2025

err = docs.ValidateDocsStructure(packageRoot)
if err != nil {
return fmt.Errorf("validating docs structure failed: %w", err)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do this after updating readmes below?


func validateReadmeStructure(packageRoot string) (error) {
requiredHeaders := []string{"Overview", "Troubleshooting", "Scaling"}
fileName := "README.md"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are packages with a main README.md, and multiple .md files, one for each policy template. An example of this is the AWS package. Do we want to apply the same validation in these cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know where those other .md files are used? And if they have the same type of content than the readme.md? If so, I think they should be validated too yes.
If was also wondering if we should validate the docs under _dev/build/docs or under build/docs instead as not all integrations have a _dev/build/docs/README. wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know where those other .md files are used?

The are used in packages that define multiple policy templates. They are used in the integrations UI, where each template appears as a different tile, as if it were a different package.

See for example the AWS package: https://github.com/elastic/integrations/tree/main/packages/aws/docs

And if they have the same type of content than the readme.md? If so, I think they should be validated too yes.

In principle they have the same type of content, yes.

If was also wondering if we should validate the docs under _dev/build/docs or under build/docs instead as not all integrations have a _dev/build/docs/README. wdyt?

We should validate the docs under the docs directory, that will be the files included in the package.

_dev/build/docs may contain templating and in principle doesn't need to be valid as final documentation.

dependencies:
ecs:
reference: [email protected]
docs_structure_enforced: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make this an object, so it doesn't need to be an all or nothing? This could allow for example to introduce some additional setting to force only a set of headers.

  docs_structure_enforced:
    enabled: true
    skip:
      - title: Performance and scaling
        reason: System metrics, no performance tuning available.

dependencies:
ecs:
reference: [email protected]
docs_structure_enforced: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setting should not be under dependencies.

It could also belong to the validation.yml file at the root of the package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might make more sense indeed to have it as part of the validation.yml instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants