Commit Graph

74 Commits

Author SHA1 Message Date
Julien 21ed58b719
Link to Python docs about input types ()
In Python object inputs can either be argument classes or dictionary
literals. Link to the [Python input
docs](https://www.pulumi.com/docs/languages-sdks/python/#inputs-and-outputs)
in the input section of the package docs when the current language is
python.

Fixes https://github.com/pulumi/registry/issues/4936

<img width="738" alt="Screenshot 2024-07-30 at 18 23 53"
src="https://github.com/user-attachments/assets/3ad00f45-a81d-4c2d-b3ad-f9ae811735f6">
2024-07-31 08:46:04 +00:00
Florian Stadler 74e8928cff
Add ability to constrain supported languages of resource and function overlays ()
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 
2024-07-09 14:54:50 +00:00
Sean Holung dd70f058ee
Hide expanded constructor syntax when language fails ()
fixes: https://github.com/pulumi/registry/issues/4320
fixes: https://github.com/pulumi/registry/issues/4805

This PR hides the expanded constructor syntax if any of the languages
are failing to generate. I also updated the heading to be `Constructor
example` instead of `Example` to help avoid confusion with the other
examples on the page.
2024-06-25 22:41:47 +00:00
Mikhail Shilkov 9388c54be7
Resource docs: emit supporting types beyond the 200 limit ()
<!--- 
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:


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 

## 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. -->
2024-05-13 14:58:33 +00:00
Sean Holung c53526661b
Update page layout for new constructor syntax ()
Moves new syntax underneath the same section as original constuctor
definition.

<img width="660" alt="Screen Shot 2024-04-01 at 12 17 03 PM"
src="https://github.com/pulumi/pulumi/assets/16751381/d85969d6-c480-4518-a9ef-7cd6f07e353c">

---------

Co-authored-by: Christian Nunciato <chris@nunciato.org>
2024-04-02 15:47:32 +00:00
Christian Nunciato 9297e25c42
Add a link to the Import documentation from API docs pages ()
Adds a link to the Import docs from the API docs (to help answer
questions about how import works, where to look for identifiers, etc.)
and adds a line break to the `import --help` CLI output. (Sorry, my
bad!)


![image](https://github.com/pulumi/pulumi/assets/274700/f7ba2315-e127-43b0-8dd6-041d344bb367)

Fixes https://github.com/pulumi/registry/issues/3039.
2024-03-27 22:24:47 +00:00
Zaid Ajaj ad56486bf0
[docs] Emit example constructor syntax for resources in typescript, python, go and csharp ()
# 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. -->
2024-03-21 13:41:07 +00:00
Sean Holung 23313d6b0a
Fix deprecation note formatting ()
fixes: https://github.com/pulumi/registry/issues/3983

This PR fixes up some issues with our deprecation message formatting.
The deprecation messages attached to enums were not being formatted at
all, due to a missing css class. Secondly, I also noticed there was a
whitespace missing in the deprecation message when it renders in the
browser, due to the leading `-` in `{{- .... -}}`, so I addressed that
here as well.

### enum deprecation

before:
![Screen Shot 2024-02-22 at 10 20 34
AM](https://github.com/pulumi/pulumi/assets/16751381/89cf20b7-ad05-4085-9a42-fd73f964e250)



after:
![Screen Shot 2024-02-22 at 9 54 43
AM](https://github.com/pulumi/pulumi/assets/16751381/a95a8302-e40f-43aa-96a2-44f14b505571)

### fix whitespace after "Deprecated:"

before:
![Screen Shot 2024-02-22 at 10 20 53
AM](https://github.com/pulumi/pulumi/assets/16751381/53f088fa-5f46-45e4-b217-536b0affa0cf)

after:
![Screen Shot 2024-02-22 at 9 54 29
AM](https://github.com/pulumi/pulumi/assets/16751381/fbc687a7-43aa-4b80-9f3b-cd3d9f3255a0)
2024-03-02 06:02:03 +00:00
Guinevere Saenger 26bdac7438
Add ability to process docs without dedicated Examples logic ()
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. -->
2024-02-23 18:06:44 +00:00
Sean Holung bf251932ef
Fix enum rendering issue ()
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">
2024-02-12 21:25:36 +00:00
Justin Van Patten 7162491d0b
[docsgen] Fix rendering of deprecated messages and text in description lists ()
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">
2023-08-26 17:36:28 +00:00
Christian Nunciato e0f378d068 Strip 'Args' suffixes from type names in docs 2023-08-10 14:13:40 -07:00
susanev bac7e5be41
remove icons
Signed-off-by: susanev <susan.ra.evans@gmail.com>
2023-06-09 14:13:11 -04:00
Luke Hoban bcc100a4ec Avoid whitespace diff 2023-02-03 18:34:33 -08:00
Luke Hoban fb80f5709c [codegen/docs] Only emit first 200 nested types
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.
2023-02-03 15:19:33 -08:00
Sean Holung 39f6ba05c2
update package details template
test

test

test

test

test

test

test

test

test
2023-01-12 14:11:03 -08:00
aq17 b91126065b Update YAML invoke syntax for docs 2022-11-04 11:39:24 -07:00
susanev e071dfe23a remove additional an
Signed-off-by: susanev <susan.ra.evans@gmail.com>
2022-09-17 12:25:30 -07:00
susan evans acb412dc90
Update resource.tmpl 2022-09-16 18:20:30 -07:00
Ian Wahbe b281b482dc
Pass through resource replacement in the schema ()
* Pass through resource replacement in the schema

* Add property

* Ignore files in .pytest_cache

* Remove .pytest_cache files

* Add a test + Fix
2022-05-17 13:59:47 -07:00
Christian Nunciato 70e30c95b4
Fix the function template to show YAML under the YAML tab ()
* Fix function template to show YAML under the YAML tab
* Update template baselines
2022-05-06 16:19:25 -07:00
Mikhail Shilkov e11a337a61 Fix resource template 2022-05-04 10:00:53 +02:00
Christian Nunciato af8e010a4a Fix template layout issues, replace all shortcodes 2022-05-04 10:00:53 +02:00
Mikhail Shilkov 2583e0291d Extend API doc generation 2022-05-04 10:00:53 +02:00
Christian Nunciato e462b78a74
Fix Node.js properties template () 2022-05-01 10:25:12 -07:00
Christian Nunciato 0a0f48e292
Replace Hugo shortcodes () 2022-04-29 15:04:15 -07:00
Kimberley Mackenzie 421d062e8f
Add data attribute tag for swifttype to resource property element ()
* Add data attribute tag for swifttype to resource property element.

* Update test data.
2022-03-21 10:36:04 -07:00
Anton Tayanovskyy afcbcd3a51
7947: docgen for $fnOutput forms ()
* 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
2021-11-08 17:07:09 -05:00
Praneet Loke 0f5b7c765b
[codegen/docs] Update API docs templates to include layout front-matter param ()
* 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 ()

* 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>
2021-10-17 22:36:31 -07:00
Justin Van Patten 2b97340133
[codegen/docs] Emit docs for methods () 2021-08-12 14:31:15 -07:00
David Wrede 878af7aecf
Updating doc links to align with changes in docs ()
Co-authored-by: David Wrede <dave@pulumi.com>
2021-07-28 14:14:48 -07:00
Christian Nunciato 3b8a0dd3e3
Remove leading and trailing whitespace in resource properties ()
* 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>
2021-05-04 17:59:30 -07:00
Justin Van Patten 48a1d3f696
[docgen] Fix horizontal scroll in python resource docs ()
Add line breaks and whitespace to avoid long horizontal scrolls for Python constructor/function arguments. Also, include the new ResourceArgs constructor overload.
2021-04-17 15:33:23 -07:00
Christian Nunciato c20bdbe945
Update resource-docs templates to adjust for Hugo upgrade () 2021-03-14 07:24:55 -07:00
Christian Nunciato e2b48d2f20
Fix up resource-docs links ()
Co-authored-by: Praneet Loke <1466314+praneetloke@users.noreply.github.com>
2021-02-09 09:04:02 -08:00
Christian Nunciato 40ce511a2b
Remove language SDK blocks from resource templates () 2021-02-07 19:31:05 +00:00
Komal 95c09d88c8
[codegen/docs] - Add enums to docs () 2020-12-14 14:40:14 -08:00
Komal fed47e7334
[codegen/docs] - Fix html for property types () 2020-12-11 12:01:50 -08:00
Komal cba68b0874
Fix union types in resource docs () 2020-12-09 18:18:34 -08:00
Paul Stack 3d8068e355
adding the import documentation where specified () 2020-11-09 14:12:58 +00:00
Paul Stack 5e8f219652
Reorder resource docs templates to make deprecated more prominent ()
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
2020-10-07 21:25:25 +01:00
Justin Van Patten 988ebd8b8e
[codegen/docs] Don't emit API links in Azure NextGen resource docs ()
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.
2020-09-20 11:56:52 -07:00
Justin Van Patten 92c0d1dc30
Docgen changes for Python input/output types ()
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).
2020-08-19 08:34:06 -07:00
Gabriel Diaz ffb8c2400d
Fix semicolon in python docs () 2020-07-17 21:16:30 -07:00
Sean Holung c538db64c8
Anchoring properties () 2020-05-22 14:53:34 -07:00
Praneet Loke 30b12cff49
[codegen/docs] Various Go-related fixes ()
* 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.
2020-05-15 17:33:56 -07:00
Sean Holung f5ed6190ba
Link Python and Go constructors () 2020-05-15 09:51:24 -07:00
Praneet Loke fcac4af8ae
[codegen/docs] Generate a table with links to the language-specific module pages ()
* 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.
2020-05-12 15:37:37 -07:00
Praneet Loke aa313aecf8
[codegen/docs] Add a new template for examples section ()
* 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.
2020-05-08 16:25:28 -07:00
Praneet Loke fe3bd9ed99
[codegen/docs] Restore the API type links for C#. ()
* 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.
2020-05-01 17:13:56 -07:00