Commit Graph

17 Commits

Author SHA1 Message Date
Fraser Waters 3043adeeb3
Add SupportPack to schemas to write out in the new style ()
<!--- 
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. -->


This adds a new flag to the schema metadata to tell codegen to use the
new proposed style of SDKs where we fill in versions and write go.mods
etc.

I've reworked pack to operate on packages assuming they're in this new
style. That is pack no longer has the responsibility to fill in any
version information.

This updates python and node codegen to write out SDKs in this new
style, and fixes their core libraries to still be buildable via pack.
There are two approaches to fixing those, I've chosen option 1 below but
could pretty easily rework for option 2.

1) Write the version information directly to the SDKs at the same time
as we edit the .version file. To simplify this I've added a new
'set-version.py' script that takes a version string an writes it to all
the relevant places (.version, package.json, etc).

2) Write "pack" in the language host to search up the directory tree for
the ".version" file and then fill in the version information as we we're
doing before with envvar tricks and copying and editing package.json.

I think 1 is simpler long term, but does force some amount of cleanup in
unrelated bits of the system right now (release makefiles need a small
edit). 2 is much more localised but keeps this complexity that
sdk/nodejs sdk/python aren't actually valid source modules.

## 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-03-22 09:25:46 +00:00
Fraser Waters a24ef3123a
Don't set additionalProperties 2023-03-27 10:11:57 +01:00
Fraser Waters 74e2b45157 Consistently set (or not) respectSchemaVersion 2023-03-26 15:56:35 +01:00
Zaid Ajaj 330676a0d0 Initial implementation of simplified invokes for dotnet and nodejs 2023-01-11 14:17:14 -08:00
bors[bot] 818d055a77
Merge
11701: Revert "Simplified invokes: SDK-gen and program-gen implementation for dotnet and nodejs" r=iwahbe a=AaronFriel

Reverts pulumi/pulumi#11418.

Fixes . The addition of the `ReturnType` field on `schema.FunctionSpec` broke the API contract between Pulumi's codegen package and tfbridge and other tools.

From my comment on .

> I was able to bisect pu/pu to a commit that had the issue, but couldn't reproduce the behavior with a synthetic schema. PR  should be reverted because it introduces the breaking change, and before that PR is reintroduced, the breaking change to the schema should be addressed.
> 
> Notes on root causing:
> 
> Adding an unserialized `ReturnType` field on the `schema.FunctionSpec` type was a breaking change in the API contract with the tfgen bridge and any other tools that generate a PackageSpec directly (without marshaling/unmarshaling) before binding it and calling `GeneratePackage`.
> 
> In [cd6f658](cd6f658d3d) we can see that a regression test fails to catch this case, the generated code is correct and matches the "before" case! That's because the regression tests in Pulumi load schemas from JSON, so the `ReturnType` field is populated. That occurs in the implementation of `unmarshalFunctionSpec` at line 1656:
> 
> 78c9bf4ee4/pkg/codegen/schema/schema.go (L1649-L1658)
> 
> This function in the bridge is unaware of the new field, and so it only populates `Outputs`.
> 
> 36b10921bf/pkg/tfgen/generate_schema.go (L607-L638)




Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
2022-12-21 10:33:07 +00:00
Fraser Waters 555ac3a036 Add a few extra "additionalProperties": false
Places where the binder doesn't expect anything else.
2022-12-21 09:12:46 +00:00
Aaron Friel a682a1ab06
Revert "Simplified invokes: SDK-gen and program-gen implementation for dotnet and nodejs" 2022-12-20 17:47:29 -08:00
Zaid Ajaj a6f26d2355 Initial implementation of simplified invokes for dotnet and nodejs 2022-12-16 13:39:03 +01:00
bors[bot] 66db80ced5
Merge
11376: Expanding the JSON Schema definition for `language` of the Pulumi Schema r=Frassle a=ringods

Signed-off-by: Ringo De Smet <ringo@de-smet.name>

<!--- 
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. -->
The `language` section in the JSON Schema for our Pulumi schema is defined as `object` without any further details:

6f21c0daca/pkg/codegen/schema/pulumi.json (L127-L130)

This PR extends the JSON schema to cover for all the properties defined in the structs of the language specific importers:

* [pkg/codegen/dotnet/importer.go](6f21c0daca/pkg/codegen/dotnet/importer.go (L29-L43))
* [pkg/codegen/go/importer.go](6f21c0daca/pkg/codegen/go/importer.go (L24-L90))
* [pkg/codegen/nodejs/importer.go](6f21c0daca/pkg/codegen/nodejs/importer.go (L30-L82))
* [pkg/codegen/python/importer.go](https://github.com/pulumi/pulumi/blob/master/pkg/codegen/python/importer.go#L35-L57)
* [pkg/codegen/java/package_info.go](ef32ffc0fb/pkg/codegen/java/package_info.go (L35-L108)) in `pulumi/pulumi-java`

Fixes , 
Related to 

## Checklist

<!--- 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 Service,
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 Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


11637: Remove dotnet r=Frassle a=Frassle

The dotnet sdk is being moved to https://github.com/pulumi/pulumi-dotnet

Co-authored-by: Ringo De Smet <ringo@de-smet.name>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
2022-12-14 14:41:03 +00:00
Ringo De Smet 9cad0c7c38
Make `URL` all uppercase in `pluginDownloadURL`
In the core Pulumi code base, the property is read with `URL` in uppercase.
It is also with uppercase `URL` in any generated schema.json file of bridged providers.

Signed-off-by: Ringo De Smet <ringo@de-smet.name>
2022-12-14 11:14:47 +01:00
Ringo De Smet 47db946b7c
Documented the java language spec properties based on
https://github.com/pulumi/pulumi-java/blob/main/pkg/codegen/java/package_info.go

Signed-off-by: Ringo De Smet <ringo@de-smet.name>
2022-12-13 21:14:30 +01:00
aq17 1000822130 Add `willReplaceOnChanges` to schema 2022-12-12 10:27:28 -08:00
Ringo De Smet 05ce5f2ff6
Expanding the JSON Schema definition for `language` of the Pulumi Schema
Signed-off-by: Ringo De Smet <ringo@de-smet.name>
2022-11-16 15:13:27 +01:00
Pat Gavlin a1339277f0
[schema] Add enum overlay support. ()
And update the metaschema to accommodate the `isOverlay` properties
added in . Overlay enums, like other overlay members, are
implemented out-of-band by the declaring package. Code generators should
not generate declarations for overlay enums.
2021-11-16 15:53:28 -08:00
Praneet Loke 9a78ca1ca4
[codegen/schema] Add DisplayName and Publisher to the schema () 2021-10-27 12:53:09 -07:00
svangordon-fruit 22d2ef247f
Allow hyphens in middle portion of token () 2021-10-25 17:15:17 -07:00
Pat Gavlin 236ce54269
[schema] Add the Pulumi Package metaschema. ()
The Pulumi Package metaschema is a JSON schema definition that describes
the format of a Pulumi Package schema. The metaschema can be used to
validate certain basic properties of a Pulumi Package schema, including
(but not limited to):

- data types (e.g. is this property a string?)
- data formats (e.g. is this string property a valid regex?)
- object shapes (e.g. is this object missing required properties?)

The schema binder has been updated to use the metaschema as its first
validation pass.

In addition to its use in the binder, the metaschema has its own page in
the developer documentation. This page is generated using a small tool,
jsonschema2md.go.
2021-09-20 12:00:42 -07:00