Commit graph

320 commits

Author SHA1 Message Date
Levi Blackstone 3ea59ebbb8
[codegen/schema]: Add ResourceType to support resource refs (#5325) 2020-09-22 11:09:27 -06:00
Komal a334b60193
Only allow type-matching enum values (#5417)
* Only allow type-matching enum values

* More tests and fixes
2020-09-21 12:23:04 -07:00
Justin Van Patten 988ebd8b8e
[codegen/docs] Don't emit API links in Azure NextGen resource docs (#5421)
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
Luke Hoban a2a64e55d0
Support recursive object types in pkg/codegen model (#5404)
Fixes #5228.
2020-09-18 17:29:21 -07:00
Vivek Lakshmanan a7680884eb Allow ImportBasePath to override presumed golang import path 2020-09-18 12:48:14 -07:00
Vivek Lakshmanan 2a23af6892 Fix panics when running invokes with modules containing slashes 2020-09-18 11:15:56 -07:00
Mikhail Shilkov 428225f992
[codegen/nodejs] Format dashed import for invokes (#5399) 2020-09-17 18:23:54 +02:00
Komal 92a7d717a4
[codegen/schema] - Expand ObjectTypeSpec to ComplexTypeSpec (#5379)
Co-authored-by: Mikhail Shilkov <github@mikhail.io>
2020-09-16 13:47:40 -07:00
Mikhail Shilkov 0d38c6737e
[codegen] Tweak docs and example generation for azure-nextgen (#5390)
[codegen] Tweak docs and example generation so that azure-nextgen is represented correctly
2020-09-16 20:11:56 +02:00
Mikhail Shilkov 573b95afaf
Add missing provider names for docs (#5374) 2020-09-16 11:28:34 +02:00
Mikhail Shilkov da1f25928d
[codegen] Adjust Go/Python package naming for Azure NextGen (#5373) 2020-09-15 13:56:58 +02:00
Mikhail Shilkov 07a923e494 Revert Go input/output generation 2020-09-15 12:36:04 +02:00
Mikhail Shilkov 3a16cf55f0
[codegen/dotnet] Don't append Result to mixed output type names (#5321) 2020-09-15 09:33:41 +02:00
Mikhail Shilkov bbf403ba85
Do not generate unused input/output types in Go (#5345)
Do not generate unused input/output types in Go
2020-09-15 09:33:13 +02:00
Justin Van Patten 5164725cb5
[codegen/python] Remove panic from PyName (#5341)
The codegen updates have been run against all providers, so there's no longer a need to keep the panic.
2020-09-14 08:42:01 -07:00
Justin Van Patten 5e06da464a
[codege/python] Use int as the type annotation for integers (#5309) 2020-09-11 14:56:29 -07:00
Justin Van Patten 4dd40e4490
[codegen/python] Use pulumi.runtime.to_json (#5308)
Non-string provider inputs must be projected as JSON formatted strings. The current codegen simply calls `json.dumps` for such properties, but this does not work for the new input types, which aren't JSON serializable.

To address this, make use of the new `pulumi.runtime.to_json` utility function, which is capable of serializing raw dicts and input types as JSON.
2020-09-11 14:27:36 -07:00
Justin Van Patten dee923d99c
[codegen/python] Emit array types as Sequence (#5283)
We currently emit array types as `List[T]` for Python, but `List[T]` is invariant, which causes type checkers like mypy to produce errors when values like `["foo", "bar"]` are passed as args typed as `List[pulumi.Input[str]]`. Instead, we should move to using `Sequence[T]` which is covariant, and does not have this problem.

We actually already do this for `Dict` vs. `Mapping`, emitting map types as `Mapping[str, T]` rather than `Dict[str, T]` because `Mapping[str, T]` is covariant. This change makes us consistent for array types.
2020-09-10 14:54:27 -07:00
Vivek Lakshmanan e84e0401f0
Speed up doc generation by avoiding repeated python language import (#5277)
Fixes https://github.com/pulumi/pulumi/issues/5184
2020-09-10 16:12:09 +02:00
Mikhail Shilkov 53b48cef2f
Exclude two more names from PyName (#5285) 2020-09-03 18:02:21 +02:00
Albert Zhong 69c57f8b47
Add ignorePyNamePanic python flag (#5268) 2020-09-02 16:25:19 -07:00
Justin Van Patten d583bcb915
[codegen/nodejs] Remove unnecessary ctor overload (#5274)
An extra constructor overload was recently added to pass undefined state from
`get` for resources that do not have any state inputs (notably Kubernetes
resources). This ended up breaking PaC's `validateResourceOfType`, which relies
on type inference in common usage to determine the resource's args type based
on the signature of the constructor.

This constructor overload isn't necessary. Instead, we can remove it and modify
how the constructor is called inside `get`. This also makes it so we're not
exposing details about `get`'s implementation in the public API.
2020-09-02 09:09:41 -06:00
Levi Blackstone 5ec0b985d4
[codegen/nodejs] Fix omitted output properties in constructor (#5273)
Changed the codegen in 6fd72dc0 but missed a condition that
is causing incorrect code in pulumi-kubernetes. This change
correctly generates inputs in both conditional branches.
2020-09-01 17:56:38 -06:00
Levi Blackstone 6fd72dc0db
[codegen/nodejs] Fix constructors to populate inputs on get (#5272) 2020-09-01 16:37:03 -06:00
Mikhail Shilkov 81992485dd
Full name for aliases in .NET codegen (#5245) 2020-08-28 18:57:57 +02:00
Justin Van Patten 7eb99fe7bb
[codegen/python] Emit properties named "property" last (#5247)
This avoids conflicting with the built-in `@property` decorator function for other properties.
2020-08-28 08:55:02 -07:00
Komal 5caa5616f7
[codegen/nodejs] - Fix whitespace in genNamespace code (#5240) 2020-08-27 14:50:34 -07:00
Justin Van Patten 910aa96016
[codegen/python] Add type annotation to resource_name arg (#5217) 2020-08-25 12:07:08 -07:00
Justin Van Patten 502685ed0e
[codegen/python] Fix resource outputs type annotations (#5221)
These should be typed as `Output[T]`.
2020-08-25 11:07:22 -07:00
Mikhail Shilkov 4c42e5e850
Relax submodule generation for Node and Python (#5204) 2020-08-23 00:00:21 +02:00
Praneet Loke 072aac2c79
[codegen/docs] Lower-case the module name for Go. (#5207) 2020-08-21 15:34:57 -07:00
Mikhail Shilkov b9b3c836bc
Exclude more names from Python name validation (#5205) 2020-08-21 20:41:33 +02:00
Justin Van Patten 6292543342
[codegen/python] Fix unintended name changes from PyName and some whitespace cleanup (#5202)
If PyName(name) != PyNameLegacy(name), we panic, unless name is in an exclusion list.

Once all providers have been updated to this codegen (and we've added to `useLegacyName` and `excludeFromPanic` as appropriate), we can go back and remove the panic behavior along with the `excludeFromPanic` behavior.
2020-08-20 20:51:32 -07:00
Justin Van Patten ca7536e17f
[codgen/python] Always consider the config subpackage non-empty (#5195)
If there's a config subpackage, we had explicitly added it to the map of modules because there *are* config properties, so we know it will be non-empty. This change ensures the config subpackage is imported in the top-level package's __init__.py and that the config subpackage itself has an __init__.py emitted.
2020-08-20 11:07:09 -07:00
Evan Boyle 0f98bac105
fix unchecked type assertion (#5194) 2020-08-19 13:58:13 -07:00
Praneet Loke e3b436211d
[codegen/docs] Link to Pulumi.Input-1.html when generating the doc link for the Pulumi.Input type. (#5187) 2020-08-19 11:21:54 -07:00
Justin Van Patten 92c0d1dc30
Docgen changes for Python input/output types (#5137)
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
Mikhail Shilkov 6cc7b3c107
Docs for versioned modules (#5183) 2020-08-19 14:57:39 +02:00
Justin Van Patten 78edb28590
Add Python input/output classes to provider codegen (#5034)
This updates the Python codegen to emit input/output classes.
2020-08-19 01:16:47 -07:00
Vivek Lakshmanan 8777dd77ca
Merge pull request #5170 from pulumi/vl/ResourceOptions
Map python resource options to provider options
2020-08-17 17:36:05 -07:00
Vivek Lakshmanan f6fd98544d
Update pkg/codegen/python/gen.go
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-08-17 16:58:59 -07:00
Komal d7ce0e586c
[codegen/python] - Include single word props in casing tables. (#5181) 2020-08-17 16:44:55 -07:00
Vivek Lakshmanan 38387f1742 Set the snake case translation for provider input properties
Fixes https://github.com/pulumi/pulumi-kubernetes/issues/1244
2020-08-14 14:34:46 -07:00
Praneet Loke 99fcd359ee
[codegen/docs] Fix the case used in links for Node.js modules. (#5165) 2020-08-13 17:29:56 -07:00
Evan Boyle c9d8549ae6
[Go Program Gen] Only generate a single literal when traversing a union type (#5154) 2020-08-11 11:43:56 -07:00
Albert Zhong 2cd0c000bd
[codegen] Add codegen/go/gen_crd2pulumi, clean up codegen/nodejs/gen_crd2pulumi (#5116)
* Add codegen/go/gen_crd2pulumi

* Properly generate Go CRD resources

* generate nodejs resources

* Remove nodejs/gen_crd2pulumi.go

* Remove generating funtions
2020-08-10 10:21:50 -07:00
Komal 2f2e62e2e4
[codegen/python] - Normalize module names in program gen (#5128) 2020-08-07 09:30:07 -07:00
Mikhail Shilkov 0c9d1fdd0e
Fix C# program gen for Kubernetes examples (#5129) 2020-08-07 09:31:42 -06:00
Pat Gavlin e5f44a7b0c
Use a package map where appropriate (#5127)
* Use a package map where appropriate

* Fix imports

* handle NoneType for literal value expressions in go program gen

* add operator tests for c#, python, and node

Co-authored-by: evanboyle <evan@pulumi.com>
2020-08-06 19:09:18 -07:00
Komal ff219a2381
Use input/output classes in program gen (#5086) 2020-08-06 15:09:23 -07:00