Commit Graph

7 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
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
Zaid Ajaj 00b685606d
[docs] Implement Java constructor syntax examples ()
# Description

This PR implements Java constructor syntax examples, rendering them into
the docs. It upgrades pulumi-java to 0.10.0 which includes features from
https://github.com/pulumi/pulumi-java/pull/1338

It also updates contructor syntax generator to emit an unbound variable
for resource-typed properties. We use the name of the resource as the
name of the variable:
```typescript
const example = new Resource("name", { pet: randomPet })
````
where `pet` is a property that is typed as `random.RandomPet` so it gets
assigned the (unbound) variable called `randomPet`

Previously we would skip emitting any code for resource-typed
properties. I think this gives better docs even though it doesn't
compile

## 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
  - [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.
-->
- [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-28 00:03:58 +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
Anton Tayanovskyy d62c398bfb
Move codegen testdata ()
<!--- 
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. -->

It appears that Go copies testdata into every GOMODCACHE of a project
that depends on pulumi/pkg; the schemas in codegen testdata add 300MB of
weight to the GOMODCACHE needed for download. What if we moved the
testdata out from under the tree.

The move looks like this:

```
from=pkg/codegen/testing/test/testdata
to=tests/testdata/codegen/
git mv "$from" "$to"
(cd pkg/codegen/testing/test && ln -s ../../../../tests/testdata/codegen ./testdata)
git add "$from"
```

The previous location is symlinked to the new location.

Evidence of `GOMODCACHE` pressure reduction:
https://gist.github.com/t0yv0/05dd8be5880171045aed01e123ae2b09

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] 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. -->
- [ ] 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-03-06 20:36:50 +00:00