pulumi/tests/testdata/codegen
Mikhail Shilkov 6cfa4afcaf
Display full type names in Python references in the docs (#15784)
<!--- 
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

Currently, our resource API docs for Python only display a type name
itself. If the type is defined in a different module, we do not indicate
this explicitly, which causes confusion.

For example, [K8s Pod
Inputs](https://www.pulumi.com/registry/packages/kubernetes/api-docs/core/v1/pod/#inputs)
is in `core.v1` module itself but refer to the `meta.v1.ObjectMeta`
type. Node.js docs display the type as

<img width="719" alt="image"
src="https://github.com/pulumi/pulumi/assets/1454008/fb3e8fc5-7dc8-4661-ac6f-95e7d7918cfc">

but Python simply shows

<img width="725" alt="image"
src="https://github.com/pulumi/pulumi/assets/1454008/4cd4c09c-13cb-4070-b716-0b78ad98379b">

The same problem exists when we reference types from external packages,
and even for composed types like `Sequence[some_external_type]`.

This PR removes a special case for Python that reduces a full type name
to its name. Instead, it executes on the same path as Node.js and C#.

I had to apply some cleaning to Python types to remove underscore
prefixes of modules. We use underscore-prefixed imports in SDK gen, but
they should not be visible in user docs.

I expect we need to apply the same fix to Go, but I suggest we do that
as a follow-up.

Testing: the existing test suite seems adequate for testing the change.
All the discrepancies look like improvements to me.

Fixes #15137

## 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-04-01 14:59:50 +00:00
..
array-of-enum-map Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
assets-and-archives [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
assets-and-archives-go-generics-only Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
assets-archives-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-eks-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-fargate-output-versioned-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-fargate-pp [program-gen/csharp] Fixes generated code for a list of resources used in resource option DependsOn (#15773) 2024-03-25 15:34:54 +00:00
aws-iam-policy-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-lambda-pp [program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696) 2024-03-15 17:49:12 +00:00
aws-optionals-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-resource-options-4.26-pp [program-gen/csharp] Fixes generated code for a list of resources used in resource option DependsOn (#15773) 2024-03-25 15:34:54 +00:00
aws-resource-options-5.16.2-pp [program-gen/csharp] Fixes generated code for a list of resources used in resource option DependsOn (#15773) 2024-03-25 15:34:54 +00:00
aws-s3-folder-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-s3-logging-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-secret-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-static-website-pp [program-gen] Fix panic when generating programs for MLC packages using external types (#15605) 2024-03-10 17:23:15 +00:00
aws-webserver-pp [program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696) 2024-03-15 17:49:12 +00:00
azure-native-nested-types [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
azure-native-pp [program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696) 2024-03-15 17:49:12 +00:00
azure-sa-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
basic-unions-pp [program-gen/tests] Replace discriminated unions test program with a program from a synthetic schema of basic unions (#15771) 2024-03-28 10:49:27 +00:00
components-pp [program-gen/go] Fix optional primitive values being derefrenced (#15592) 2024-03-10 04:49:06 +00:00
config-variables-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
csharp-plain-lists-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
csharp-typed-for-expressions-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
cyclic-types Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
dash-named-schema [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
dashed-import-schema [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
depends-on-array-pp [program-gen/csharp] Fixes generated code for a list of resources used in resource option DependsOn (#15773) 2024-03-25 15:34:54 +00:00
different-enum [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
different-package-name-conflict Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
docs-collision [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
dynamic-entries-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
embedded-crd-types Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
empty-list-property-pp [program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696) 2024-03-15 17:49:12 +00:00
entries-function-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
enum-reference Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
enum-reference-python Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
external-enum Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
external-go-import-aliases Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
external-node-compatibility Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
external-python-same-module-name Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
external-resource-schema Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
functions-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
functions-secrets Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
go-nested-collections Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
go-overridden-internal-module-name Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
go-plain-ref-repro Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
hyphen-url Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
hyphenated-symbols Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
inline-invokes-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
internal-dependencies-go Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
interpolated-string-keys-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
invalid-go-sprintf-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
invoke-inside-conditional-range-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
iterating-optional-range-expressions-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
kubernetes-operator-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
kubernetes-pod-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
kubernetes-template-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
kubernetes-template-quoted-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
kubernetes20 Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
legacy-names Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
logical-name-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
methods-return-plain-resource Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
modpath-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
multiline-string-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
naming-collisions [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
nested-module [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
nested-module-thirdparty [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
optional-complex-config-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
other-owned [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
output-funcs Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
output-funcs-aws-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
output-funcs-edgeorder Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
output-funcs-go-generics-only Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
output-funcs-tfbridge20 Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
output-literals-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
output-name-conflict-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
plain-and-default [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
plain-and-default-go-generics-only Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
plain-object-defaults Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
plain-object-disable-defaults Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
plain-schema-gh6957 Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
provider-config-schema Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
provider-type-schema [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
pulumi-stack-reference-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
python-regress-10914-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
python-regress-14037-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
python-reserved-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
python-resource-names-pp [program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696) 2024-03-15 17:49:12 +00:00
random-pet-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
read-file-func-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
regress-8403 Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
regress-11176-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
regress-go-8664 Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
regress-go-10527 Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
regress-go-12971 Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
regress-go-15478 Ensure package generation for Go SDKs doesn't panic when encountering overly nested arrays or maps of primitive types (#15680) 2024-03-14 14:21:15 +00:00
regress-node-8110 Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
regress-node-12507-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
regress-py-12546 Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
regress-py-12980 Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
regress-py-14012 Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
regress-py-14539 Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
regress-py-tfbridge-611 Add SupportPack to schemas to write out in the new style (#15713) 2024-03-22 09:25:46 +00:00
replace-on-change [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
resource-args-python [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
resource-args-python-case-insensitive [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
resource-property-overlap [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
retain-on-delete-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
schema Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
secrets [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
secrets-go-generics-only Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
simple-enum-schema [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
simple-enum-schema-go-generics-only Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
simple-methods-schema Display full type names in Python references in the docs (#15784) 2024-04-01 14:59:50 +00:00
simple-methods-schema-single-value-returns [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
simple-plain-schema [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
simple-plain-schema-go-generics-only Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
simple-plain-schema-with-root-package [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
simple-range-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
simple-resource-schema [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
simple-resource-schema-custom-pypackage-name [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
simple-resource-with-aliases [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
simple-schema-pyproject [docs] Emit example constructor syntax for resources in typescript, python, go and csharp (#15624) 2024-03-21 13:41:07 +00:00
simple-splat-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
simple-yaml-schema [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
simplified-invokes [docs] Emit example constructor syntax for resources in typescript, python, go and csharp (#15624) 2024-03-21 13:41:07 +00:00
simplified-invokes-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
single-or-none-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
snowflake-python-12998-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
string-enum-union-list-pp [program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696) 2024-03-15 17:49:12 +00:00
synthetic-resource-properties-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
third-party-package-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
throw-not-implemented-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
transpiled_examples [program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696) 2024-03-15 17:49:12 +00:00
traverse-union-repro-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
typed-enum-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
unions-inline [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
unions-inside-arrays [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
unknown-invoke-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
unknown-resource-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
urn-id-properties [docs] Implement Java constructor syntax examples (#15805) 2024-03-28 00:03:58 +00:00
using-dashes-pp Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
using-object-as-input-for-any-pp [program-gen/go,dotnet] Fixes emited code for object expressions assigned to properties of type Any (#15770) 2024-03-24 00:06:57 +00:00
using-shared-types-in-config [sdk-gen, dotnet/go] Fixes SDK-generation when referencing shared types in config variables (#15772) 2024-03-28 17:14:47 +00:00
.gitignore Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
auto-deploy-0.0.1.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-4.15.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-4.26.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-4.36.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-4.37.1.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-5.4.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-5.16.2.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
aws-native-0.99.0.json [program-gen/go,dotnet] Fixes emited code for object expressions assigned to properties of type Any (#15770) 2024-03-24 00:06:57 +00:00
aws-static-website-0.4.0.json [program-gen] Fix panic when generating programs for MLC packages using external types (#15605) 2024-03-10 17:23:15 +00:00
awsx-1.0.0-beta.5.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
azure-4.18.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
azure-native-1.28.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
azure-native-1.29.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
azure-native-1.56.0.json [program-gen] Fix enum resolution from types of the form Union[string, Enum] and emit fully qualified enum cases (#15696) 2024-03-15 17:49:12 +00:00
basic-unions-0.1.0.json [program-gen/tests] Replace discriminated unions test program with a program from a synthetic schema of basic unions (#15771) 2024-03-28 10:49:27 +00:00
docker-3.1.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
docker-4.0.0-alpha.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
eks-0.37.1.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
eks-0.40.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
enum-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
google-native-0.18.2.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
google-native-0.27.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
kubernetes-3.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
kubernetes-3.7.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
kubernetes-3.7.2.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
lambda-0.1.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
localref-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
other-0.1.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
plain-properties-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
random-4.2.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
random-4.3.1.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
random-4.11.2.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
range-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
recursive-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
remoteref-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
snowflake-0.66.1.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
splat-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
std-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
synthetic-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
tls-4.10.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
types.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00
using-dashes-1.0.0.json Move codegen testdata (#15549) 2024-03-06 20:36:50 +00:00