The existing overlays (e.g. Chart v3 in Kubernetes, or CallbackFunction
in AWS) are not available in every language Pulumi supports. This often
confuses users because the generated docs include all languages Pulumi
supports (e.g. see
https://github.com/pulumi/pulumi-kubernetes/issues/2181).
To solve that problem, this change adds a new optional parameter to the
schema that allows configuring the languages an overlay (resource or
function) supports.
To support this in docsgen the existing Language Chooser
(`LangChooserLanguages`) of resources is made configurable and extended
to functions.
Note: This doesn't support resource methods right now. They'll need
extra handling because and overlay resource method might not support all
of the languages its resource supports. I'll tackle this in a follow up
PR.
Here's a screenshot of how this will look like for the Helm v3 chart for
example:
<img width="1046" alt="Screenshot 2024-07-01 at 16 11 23"
src="https://github.com/pulumi/pulumi/assets/2453580/b1a1365a-6dee-4099-829a-2859639a4c8c">
The PR contains the following commits. I'd recommend to look at the
first three ones and then check the regenerated golden files in the last
one:
- **Add schema parameter to constrain supported languages for overlays**
- **Update developer docs and changelog**
- **Refactor LanguageChooser and always pass supported languages**
- **Regenerate testdata**
relates to #13231
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
Originally motivated by uncontrolled pseudo-recurcive type expansion in
AWS WafV2, we've limited the number of types that we should in the docs
to 200: https://github.com/pulumi/pulumi/pull/12070
Our large customer that publishes their own packages and docs came back
to us and said they have legitimate use cases with more than 200 types:
#15507
I've grabbed stats about our current packages and still found a few
offenders:
```
"aws:lex/v2modelsIntent:V2modelsIntent" 920
"aws:wafv2/ruleGroup:RuleGroup" 310
"aws:wafv2/webAcl:WebAcl" 523
"azure-native:datafactory:Dataset" 256
"azure-native:datafactory:LinkedService" 299
"azure-native:datafactory:Pipeline" 618
"azure-native:datamigration:ServiceTask" 291
"azure-native:datamigration:Task" 291
"aws-native:quicksight:Analysis" 589
"aws-native:quicksight:Dashboard" 606
"aws-native:quicksight:Template" 590
```
Therefore, I'm not entirely removing the limit in this PR, but
a) bumping the default to 1000
b) applying 200 to the known offenders only
I don't love it's hard coded, but I haven't found a place to add simple
configuration nob. Anyway, it's slightly less hard-coded than it used to
be.
Fixes#15507
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
- Existing docs gen tests cover that I haven't broken anything
- I re-generated the AWS docs and they had no changes
<!---
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
# Description
This PR is an initial implementation of emitting constructor syntax of
resources into the docs for typescript, python, go and csharp.
## Checklist
- [ ] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
This pull request depends on corresponding changes in the
pulumi-terraform bridge.
The bridge will mark up each code section it finds (not just ones found
under an "Example Usage" header) with an HTML comment - currently this
will be `<!--Begin Code Chooser -->` and `<!--End Code Chooser -->` but
the name is subject to change.
In this PR, we are adding logic to detect if an incoming Description
block has an `{{% examples }}` shortcode markup: if yes, we will process
it as before. If no, we will switch to new functionality that relies on
documentation with code sections having no short codes, no "Examples
Section" logic, and will generate every code section it finds in an
incoming schema that is in the Description/Content section of a registry
page with a chooser and language choosables.
This work is part of https://github.com/pulumi/pulumi-aws/issues/2624.
Edit: unit tests are added
This PR is a prerequisite for
https://github.com/pulumi/pulumi-terraform-bridge/pull/1689. It aims to
support both legacy and new behavior.
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
Fixes # (issue)
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [x] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
Fixes: https://github.com/pulumi/registry/issues/3724
Fixes: https://github.com/pulumi/registry/issues/2966
This PR is to resolve the enum rendering issue. The enums were not being
rendered on the page at all due to a misconfigured language choosable
(i.e. `<pulumi-choosable>`) that wraps the enum section. I found out
this had to do with the lang property being set as `nodejs` when instead
the choosable expects `javascript` or `typescript` as the valid values.
I then followed the pattern of what we seem to be doing for the other
pulumi-choosables which have this issue, which is to have an if
statement that sets it to `javascript,typescript` if `nodejs` is given.
This is how the rendering looks now. I have not adjusted any layouts of
the template or anything along those lines, only fixed the choosable. I
am wondering if this is actually what was intended for these, as we have
a display name in the left column that is ~useless IMO and the right
column has the value. I am assuming this was done to match the
formatting of the other nested types that are displayed since these
enums are treated as such. Though I don't think it is optimal for what
we are trying to present given that we do not have descriptions for any
of the individual enum values and what they represent.
Should we consider doing something like having a separate enum section
that is more purpose built for the data we can display where we just
have the enum type in the left column, followed by the valid enum values
in the right column. For example:
| Instance Type | a1.2xlarge, a1.4xlarge , a1.large.... |
Should we consider moving to something like this or continue following
the current pattern we have? Thoughts welcome!
Also, we can consider shipping this as it is as it is still an
improvement over what we have now and file a follow up issue to
re-assess the way this is presented.
This is the current render that this PR fix will produce:
<img width="795" alt="Screen Shot 2024-02-09 at 8 35 21 AM"
src="https://github.com/pulumi/pulumi/assets/16751381/352462b7-720c-4495-bdfe-f62cfdd946c0">
A change was made a while back to remove the use of shortcodes. As part
of that, the shortcode used to render markdown was replaced by a
function call that used goldmark to render markdown. The resulting HTML
from that wraps the text in paragraph tags.
This causes some problems for rendering the docs. For deprecations, the
deprecation message now shows up outside of the "Deprecated" box. This
happens because the rendered markdown was being wrapped in `<p></p>`
tags, leading to `<p class="resource-deprecated">Deprecated:
<p>message</p></p>`, which does not render correctly because paragraph
tags cannot be nested.
Also, in description lists, rendered markdown text was being wrapped in
paragraph tags (e.g. `<dd><p>text</p></dd>`), causing it to render
differently from text not wrapped in paragraph tags (e.g.
`<dd>text</dd>`).
This change addresses these issues.
- First, `<div class="resource-deprecated">` is used rather than `<p>`
to contain the deprecation information.
- Second, the `markdownify` function will now trim unnecessary paragraph
tags.
Fixes https://github.com/pulumi/pulumi-hugo/issues/2832
Fixes https://github.com/pulumi/registry/issues/3008
---
## Before
<img width="713" alt="Screen Shot 2023-08-24 at 5 21 44 PM"
src="https://github.com/pulumi/pulumi/assets/710598/1358cc74-dd8a-4bc0-bed8-603b1439b2aa">
## After
<img width="721" alt="Screen Shot 2023-08-24 at 5 21 58 PM"
src="https://github.com/pulumi/pulumi/assets/710598/ad501e68-1bac-486c-a723-7db2b3442c8a">
## Before
<img width="719" alt="Screen Shot 2023-08-24 at 5 22 28 PM"
src="https://github.com/pulumi/pulumi/assets/710598/6ca40b85-9008-429b-83c3-2f0d681752f3">
## After
<img width="714" alt="Screen Shot 2023-08-24 at 5 24 02 PM"
src="https://github.com/pulumi/pulumi/assets/710598/eec1dacf-8c24-470e-b1e3-da843b4aeaee">
There are a few resources with a *very* large number of nested types. We have seen this lead to generating docs pages that cannot be loaded in a browser.
Instead, only emit the first 200 nested types, and emit a note to users if we have done this.
In the AWS provider, this only triggers for wafv2.WebAcl and wafv2.RuleGroup.
* Toward doc gen of fn.Output version signatures
* Fixup Python docgen, and reorder forms so the direct form comes firs
* Respect go opt-out flag
* Fix tempalte bug with unbalanced HTML tags
* Edit CHANGELOG_PENDING.md
* Merge codeblocks in the function template
* Accept docs changes
* Update generation templates
* Updated templates for codegen
* Rm api-doc-resource template
* Update templates to use layout:api and no alias
* Set no_edit_this_page to true in the header and index templates used by docs gen.
* Update docs generation baseline test files with template updates
* Remove the notion of menu from resource templates (#8200)
* Update the title lookup map entry for aws-api-gateway
* Updated CSS classes for icons in API docs template
* Updated tests:
* Additional test file updates
* Fixup package names
Co-authored-by: Devon Grove <devon@pulumi.com>
Co-authored-by: Christian Nunciato <c@nunciato.org>
Co-authored-by: stack72 <public@paulstack.co.uk>
* Remove leading and trailing whitespace in resource properties
* Make tests pass
* Add PULUMI_ACCEPT support to docs gen tests
* Handle a couple more places
Co-authored-by: Pat Gavlin <pat@pulumi.com>
Add line breaks and whitespace to avoid long horizontal scrolls for Python constructor/function arguments. Also, include the new ResourceArgs constructor overload.
Fixes: https://github.com/pulumi/docs/issues/4340
The deprecated message sits below the examples so it is not clear
to the user that the resource / datasource is deprecated
We're not going to generate language-specific API docs for the Azure NextGen provider, only resource docs. This change makes it so the resource docs do not emit any links to nonexistent API docs.
Resource doc changes for Python:
- Types are included in constructor/function args
- The property names for input/output types are now always snake_case, regardless of the generated mapping tables, to match the new input/output classes
- Some other minor tweaks to function/constructor signatures (e.g. removed the `__props__` arg, as it's not meant to be used directly; use `@staticmethod` for static `get` methods).
* Remove code that was hiding Go as a language option for k8s overlay resources. Mark input args type for Functions as optional in Go.
* Show a special note in the Go function's snippet when the function name does not match other languages.
* Make sure the draft PR stays assigned to the original author. Add some more comments.
* Remove logic to use the Go ModuleToPackage map to then lookup the relevant C# namespace. Make getLanguageModuleName a method of modContext since passing in a package is not needed anymore.
* Generate language package details in the index pages.
* Add a new DocLanguageHelper interface method to get to a module per-language.
* Add a new workflow file for automatically creating draft docs PRs for previewing resource docs for AWS and Kubernetes as a result of changes in the resource docs generator.
* Add a new template for examples section. Extract the examples section into a structured format for custom template processing.
* Update the description IFF we were able to extract examples sections from it.
* Update doc comments and add missing file header for the newly added file.
* Make the example description readable. Add a check for empty example sections.
* Add a chooser right below the Example Usage header. Remove javascript as a language.
* Allow an empty new-line between short-codes boundaries.
* Restore the API type links for C#.
* Also restore them in function.tmpl.
* Add package details to the Functions template as well. Add a global template function to detect if the APIDocLinks has links for a language. Don't generate C# API doc links for k8s.