-
Notifications
You must be signed in to change notification settings - Fork 127
Add docs template language to elastic-package create package
#954
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
Conversation
🌐 Coverage report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this is going to help a lot to have consistent readmes. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a couple of suggestion I have just thought about.
| <!-- ### {Data stream name} | ||
| The ` + "`{data stream name}`" + ` data stream provides events from {source} of the following types: {list types}. --> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, there are helpers to generate documentation of fields, see for example in the template for the README of the Apache integration: https://github.com/elastic/integrations/blob/8d2ecab10823e2b54ea7ffa3e4252b9eaba597a8/packages/apache/_dev/build/docs/README.md?plain=1#L17
{{ fields "access" }}
It may be good to include them also here.
| <!-- Optional --> | ||
| <!-- #### Example | ||
| An example event for ` + "`{data stream name}`" + ` looks as following: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also helpers to include sample events, see here: https://github.com/elastic/integrations/blob/8d2ecab10823e2b54ea7ffa3e4252b9eaba597a8/packages/apache/_dev/build/docs/README.md?plain=1#L50
{{event "status"}}
|
@jsoriano can you help with the failing checks or tag in someone else to help? Thanks! |
Oh, I missed this is already a template. Try to "print" the function call: |
| <!-- Any prerequisite instructions --> | ||
| For step-by-step instructions on how to set up an integration, see the | ||
| [Getting started](https://www.elastic.co/guide/en/welcome-to-elastic/current/getting-started-observability.html) guide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A branch has been just merged that introduces a new helper in elastic-package to render this kind of links to Elastic documentation guides (links like https://www.elastic.co/guide/*).
With that PR, this link could be replaced by the "url" helper:
{{ url "getting-started-observability" "Getting started" }} guide.
To be used in integrations repository, currently there are still some requirements pending (on-going):
- Release a new version of
elastic-packagewith the changes mentioned above. - Add the links definitions file in integrations, that is introduced here: Added new file for links definitions integrations#4156
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, but if we use url here, we should also probably add support for the creation of the links map file when it doesn't exist, as this command can be used on any place. Let's leave this for a follow up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, let's leave it as it is 👍.
As you mentioned at this point it is not mandatory that the links definitions file exist.
|
@jsoriano I'm confused about your last comment. Can you clarify what needs to be updated? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colleenmcginnis sorry for the confusion, find here as suggestions what I meant.
| An example event for ` + "`{data stream name}`" + ` looks as following: | ||
| {{event "{data stream}"}} --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {{event "{data stream}"}} --> | |
| {{"{{event \"{data stream}\"}}"}} --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems complicated unless I'm missing something about how templates work. Would it work to just use this?
| {{event "{data stream}"}} --> | |
| \{\{event "{data stream}"\}\} --> |
Or are you using the syntax above because the data stream name can be somehow automatically injected into the template?
| An example event for ` + "`{data stream name}`" + ` looks as following: | ||
| {{event "{data stream}"}} --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {{event "{data stream}"}} --> | |
| {{"{{event \"{data stream}\"}}"}} --> |
| <!-- #### Exported fields | ||
| {{fields "{data stream}"}} -->` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {{fields "{data stream}"}} -->` | |
| {{"{{fields \"{data stream}\"}}"}} -->` |
|
Hey @colleenmcginnis, sorry for the back and forth, but after trying some things I think it'd be better to go back to the original version you sent before my suggestions in #954 (review). The thing is that we have two ways of defining the readme in a package, one is using a static file, the other one is using a template that generates on build time the static file. The I think we need to refactor this code to be more coherent with our current recommendations. On most packages we are using the template and not the static file. In the meantime I think that we could merge your original changes. Sorry again for the confusion! |
This reverts commit b64e0e7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Closes #880
In elastic/integrations#3433, we added more detailed documentation guidelines for integrations (including template language). In that PR @jsoriano suggested:
@jsoriano pointed me to this directory, but I'm not sure if I put the template language in the correct place. 🙃 Let me know if it should go somewhere else!
To do