Commit graph

619 commits

Author SHA1 Message Date
Praneet Loke 40f17faa73
Updates to resource doc generator for generating docs for Functions (#4055)
* Added a new template for Functions. Implement the genFunction method for generating the docs for Functions.

* Rename type resourceArgs to resourceDocArgs. Minor updates the resource template.

* Generate nested types for Functions.

* Unexport types that don't need to be exported. Create the doc language helper objects in an init function and reuse them rather than recreating them every time. Update genNestedTypes to work with schema functions or resources.

* Fixed bug in nested type generation for Functions. Fixed bug in generating input and output doc links for nested types.
2020-03-11 17:58:12 -07:00
Pat Gavlin 622cac4dd4
Stabilize Python codegen. (#4056)
Make sure all property casing conversions are computed prior to codegen.
2020-03-11 15:42:15 -07:00
Paul Stack 4ec9667a9f
Merge pull request #4043 from pulumi/fix-pygen-overlays
Ensure python overlays work as expected
2020-03-10 00:44:11 +02:00
stack72 b100f8494e Ensure python overlays work as expected
Fixes: https://github.com/pulumi/pulumi-terraform-bridge/issues/119

This allows us to specify an overlays block e.g.

```
Overlay: &tfbridge.OverlayInfo{
	DestFiles: []string{
		"pulumi_docker/docker.py",
		"pulumi_docker/image.py",
	},
},
```

The overlays files are treated differently to normal module files
as they are not generated. This structure means that we will emit
the correct entries in the __init__.py file

Without this structure (ie. pulumi_pkgname), the generator actually
copies the file (i.e. docker.py) to the root of the Python SDK. This
is because the structure of the Python SDK has a sub-folder than that
of the NodeJS SDK

I tested this using PR https://github.com/pulumi/pulumi-docker/pull/141
and this now works as expected and we can take advantage of the new
Python overlays for Docker
2020-03-10 00:03:41 +02:00
Praneet Loke edbb05dddd
Update schema-based docs generator (#4035)
* Update properties.tmpl to render property comment as-is. WIP splitting out properties to lang-specific tables.

* Generate the constructor dynamically from the resource per language.

* Add doc functions in each language generator package for getting doc links for types..and later other functions too.

* Render the constructor params in the Go code and inject into the template.

* Generate nodejs types using the nodejs lang generator.

* Add a templates bundler. Added a new Make target for autogenerating a static bundle for the resource docs generator.

* Generate type links for all languages based on their schema type. Render the property type with a link if the underlying elements have a supporting type. Fix word-breaks for Python type names.

* Various changes including the introduction of an interface type under the codegen package to help with generating some language-specific information for the resource docs generator.

* Add a function to explicitly generate links for input types of nested types. Fix the resource doc link generator for Go. Don't replace the module name from the nodejs language type.

* Fix bug with C# property type html encoding.

* Fix some template formatting. Pass the state inputs for Python to generate the lookup function for it.
* Do not generate the examples section if there are none.

* Generating the property types per language.

* Formatting. Rename function for readability.

* Add comments. Update README.

* Use relative URLs for doc links within the main site
2020-03-09 10:35:20 -07:00
Evan Boyle 81b6afa3c7
Revert "GetRequiredPlugins for Go (#3830)" (#4034)
This reverts commit 3a2890c0cd.
2020-03-06 17:50:18 -08:00
Pat Gavlin 3a2890c0cd
GetRequiredPlugins for Go (#3830)
These changes implement `GetRequiredPlugins` for Go using a registry
mechanism and an alternate entry point for `pulumi.Run`. Packages that
require plugins are expected to register themselves with the Pulumi SDK.
When `pulumi.Run` is used and the `PULUMI_PLUGINS` envvar is truthy, the
program will dump a JSON-encoded description of its required plugins to
stdout. The language host then uses this description to respond to
`GetRequiredPlugins`.
2020-03-06 14:30:43 -08:00
Pat Gavlin 24b93e4c10 Address PR feedback from #3980. 2020-02-27 16:24:13 -08:00
Pat Gavlin f42d7e756a
Add an HCL2 syntax helper package. (#3980)
These changes add a helper package for parsing HCL2 syntax files. The
helpers are intended to provide direct access to syntax elements that
are abstracted away by the standard HCL2 parser. The bulk of the code
deals with mapping syntax nodes to their relevant tokens in order to
avoid losing information about the comments associated with syntax
nodes.
2020-02-27 12:49:15 -08:00
Justin Van Patten db559214e8
Initial schema-based docs gen (#3988)
Many TODOs and follow-ups remain, but this is the start of our
schema-based docs generation.
2020-02-27 10:04:34 -08:00
Pat Gavlin 2b59d1405d
Fix a few codegen issues. (#3915)
- Make go comment generation lint-clean for blank comment lines
- Fix the casing of `Provider.py` in Python to `provider.py`
- Fix a spacing issue in the NodeJS code generator
2020-02-11 14:34:22 -08:00
Pat Gavlin add181e57c
Small fixes in schema codegen. (#3889)
- Do not JSON-encode provider properties that are token types with an
  underlying string type
- Emit PEP 561 type metadata in setup.py
2020-02-07 09:43:20 -08:00
Pat Gavlin 0dbbd919b8
Add schema support for deprecated properties. (#3865)
This is the schema-based version of
https://github.com/pulumi/pulumi-terraform-bridge/pull/96.
2020-02-06 09:29:06 -08:00
Pat Gavlin ad96a45a05
Align defaults with OpenAPI (#3859)
Replace the various `defaults` maps in the schema with per-property
`default` and `defaultInfo` fields. The former holds the static default
value; the latter holds the envvars and language-specific info.

Also, fix a minor bug in the Python codegen that caused diffs in
property docstrings.
2020-02-05 11:43:39 -08:00
Pat Gavlin 77c0f5dad1 Fix a bug in the Go code generator.
Resource input properties must also be scanned for optionality.
2020-01-24 10:18:34 -08:00
Pat Gavlin 4d8027f057 Fix another typo. 2020-01-23 10:42:38 -08:00
Pat Gavlin 60a5d06d37 Fix a typo. 2020-01-23 10:00:38 -08:00
Pat Gavlin d400f26832
Add a schema package and code generators. (#3749)
The schema format is described in pkg/codegen/schema/schema.go. The code
generators are derived from the code generators contained in
https://github.com/pulumi/pulumi-terraform-bridge/pkg/tfgen, with the
exception of the Go code generator, which is net new.
2020-01-21 14:45:48 -08:00
Paul Stack 67194cddfd
Creation of generator package (#2970)
Fixes: #2151

This will allow us to be able to share the code that generates our
language providers. Currently there is a copy of the python code
generation in pulumi-kubernetes and also in pulumi-terraform

We want to be able to share these
2019-07-22 17:09:35 -07:00