Skip to content

Commit

Permalink
Merge 85c6e23 into 3b7d78c
Browse files Browse the repository at this point in the history
  • Loading branch information
iwahbe committed Sep 14, 2021
2 parents 3b7d78c + 85c6e23 commit ef0d228
Show file tree
Hide file tree
Showing 33 changed files with 245 additions and 191 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@

### Bug Fixes

- [codegen/schema] - Correct validation for Package
[#7896](https://github.com/pulumi/pulumi/pull/7896)

- [cli] Use json.Unmarshal instead of custom parser
[#7954](https://github.com/pulumi/pulumi/pull/7954)
4 changes: 4 additions & 0 deletions pkg/cmd/pulumi/schema_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"path/filepath"

"github.com/hashicorp/hcl/v2"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"

Expand Down Expand Up @@ -71,6 +72,9 @@ func newSchemaCheckCommand() *cobra.Command {
diagWriter := hcl.NewDiagnosticTextWriter(os.Stderr, nil, 0, true)
wrErr := diagWriter.WriteDiagnostics(diags)
contract.IgnoreError(wrErr)
if err == nil && len(diags) != 0 {
return errors.New("schema validation failed")
}
return err
}),
}
Expand Down
1 change: 1 addition & 0 deletions pkg/codegen/docs/gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func initTestPackageSpec(t *testing.T) {
}
testPackageSpec = schema.PackageSpec{
Name: providerPackage,
Version: "0.0.1",
Description: "A fake provider package used for testing.",
Meta: &schema.MetadataSpec{
ModuleFormat: "(.*)(?:/[^/]*)",
Expand Down
1 change: 1 addition & 0 deletions pkg/codegen/dotnet/doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

var testPackageSpec = schema.PackageSpec{
Name: "aws",
Version: "0.0.1",
Description: "A fake provider package used for testing.",
Meta: &schema.MetadataSpec{
ModuleFormat: "(.*)(?:/[^/]*)",
Expand Down
1 change: 1 addition & 0 deletions pkg/codegen/go/doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

var testPackageSpec = schema.PackageSpec{
Name: "aws",
Version: "0.0.1",
Description: "A fake provider package used for testing.",
Meta: &schema.MetadataSpec{
ModuleFormat: "(.*)(?:/[^/]*)",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "py_tests",
"version": "0.0.1",
"functions": {
"madeup-package:codegentest:funcWithAllOptionalInputs": {
"description": "Check codegen of functions with all optional inputs.",
Expand All @@ -22,9 +24,7 @@
}
},
"type": "object",
"required": [
"r"
]
"required": ["r"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"functions": {
"madeup-package:codegentest:funcWithConstInput": {
"description": "Codegen demo with const inputs",
"inputs": {
"type": "object",
"properties": {
"plainInput": {
"type": "string",
"const": "fixed"
}
}
}
"name": "py_tests",
"version": "0.0.1",
"functions": {
"madeup-package:codegentest:funcWithConstInput": {
"description": "Codegen demo with const inputs",
"inputs": {
"type": "object",
"properties": {
"plainInput": {
"type": "string",
"const": "fixed"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "py_tests",
"version": "0.0.1",
"functions": {
"madeup-package:codegentest:funcWithDefaultValue": {
"description": "Check codegen of functions with default values.",
"inputs": {
"type": "object",
"required": [
"a"
],
"required": ["a"],
"properties": {
"a": {
"type": "string"
Expand All @@ -24,9 +24,7 @@
}
},
"type": "object",
"required": [
"r"
]
"required": ["r"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "py_tests",
"version": "0.0.1",
"functions": {
"madeup-package:codegentest:funcWithDictParam": {
"description": "Check codegen of functions with a Dict<str,str> parameter.",
Expand All @@ -23,9 +25,7 @@
}
},
"type": "object",
"required": [
"r"
]
"required": ["r"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "py_tests",
"version": "0.0.1",
"functions": {
"madeup-package:codegentest:funcWithListParam": {
"description": "Check codegen of functions with a List parameter.",
"inputs": {
"type": "object",
"properties": {
"a": {
"type": "array",
"items": {
"type": "string"
}
"type": "array",
"items": {
"type": "string"
}
},
"b": {
"type": "string"
Expand All @@ -23,9 +25,7 @@
}
},
"type": "object",
"required": [
"r"
]
"required": ["r"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "py_tests",
"version": "0.0.1",
"functions": {
"azure-native:codegentest:getClientConfig": {
"description": "Use this function to access the current configuration of the native Azure provider.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "py_tests",
"version": "0.0.1",
"functions": {
"azure-native:codegentest:getIntegrationRuntimeObjectMetadatum": {
"description": "A list of SSIS object metadata.\nAPI Version: 2018-06-01.",
Expand Down Expand Up @@ -108,9 +110,7 @@
}
},
"type": "object",
"required": [
"type"
]
"required": ["type"]
},
"azure-native:codegentest:SsisFolderResponse": {
"description": "Ssis folder.",
Expand All @@ -134,9 +134,7 @@
}
},
"type": "object",
"required": [
"type"
]
"required": ["type"]
},
"azure-native:codegentest:SsisPackageResponse": {
"description": "Ssis Package.",
Expand Down Expand Up @@ -180,9 +178,7 @@
}
},
"type": "object",
"required": [
"type"
]
"required": ["type"]
},
"azure-native:codegentest:SsisProjectResponse": {
"description": "Ssis project.",
Expand Down Expand Up @@ -230,9 +226,7 @@
}
},
"type": "object",
"required": [
"type"
]
"required": ["type"]
},
"azure-native:codegentest:SsisEnvironmentReferenceResponse": {
"description": "Ssis environment reference.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "py_tests",
"version": "0.0.1",
"functions": {
"azure-native:codegentest:listStorageAccountKeys": {
"description": "The response from the ListKeys operation.\nAPI Version: 2021-02-01.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ menu:
<dd><a href=""></a></dd>
<dt>License</dt>
<dd></dd>
<dt>Version</dt>
<dd>0.0.1</dd>
</dl>

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "xyz",
"version": "0.0.1",
"types": {
"example:index:Foo": {
"properties": {
Expand Down
2 changes: 2 additions & 0 deletions pkg/codegen/internal/test/testdata/schema/bad-enum-1.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "bad-enum-1",
"version": "0.0.1",
"types": {
"fake-provider:module1:BadEnum": {
"type": "string",
Expand Down
2 changes: 2 additions & 0 deletions pkg/codegen/internal/test/testdata/schema/bad-enum-2.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "bad-enum-2",
"version": "0.0.1",
"types": {
"fake-provider:module1:BadEnum": {
"type": "string",
Expand Down
2 changes: 2 additions & 0 deletions pkg/codegen/internal/test/testdata/schema/bad-enum-3.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "bad-enum-3",
"version": "0.0.1",
"types": {
"fake-provider:module1:BadEnum": {
"type": "integer",
Expand Down
2 changes: 2 additions & 0 deletions pkg/codegen/internal/test/testdata/schema/bad-enum-4.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"name": "bad-enum-4",
"version": "0.0.1",
"types": {
"fake-provider:module1:BadEnum": {
"type": "boolean",
Expand Down
14 changes: 8 additions & 6 deletions pkg/codegen/internal/test/testdata/schema/bad-methods-1.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"resources": {
"xyz:index:Foo": {
"methods": {
"bar": "xyz:index:Foo/bar"
}
}
"name": "bad-methods-1",
"version": "0.0.1",
"resources": {
"xyz:index:Foo": {
"methods": {
"bar": "xyz:index:Foo/bar"
}
}
}
}
48 changes: 25 additions & 23 deletions pkg/codegen/internal/test/testdata/schema/bad-methods-2.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
{
"resources": {
"xyz:index:Foo": {
"methods": {
"bar": "xyz:index:Foo/bar",
"baz": "xyz:index:Foo/bar"
}
"name": "bad-methods-2",
"version": "0.0.1",
"resources": {
"xyz:index:Foo": {
"methods": {
"bar": "xyz:index:Foo/bar",
"baz": "xyz:index:Foo/bar"
}
}
},
"functions": {
"xyz:index:Foo/bar": {
"inputs": {
"properties": {
"__self__": {
"$ref": "#/resources/xyz:index:Foo"
}
}
},
"functions": {
"xyz:index:Foo/bar": {
"inputs": {
"properties": {
"__self__": {
"$ref": "#/resources/xyz:index:Foo"
}
}
},
"outputs": {
"properties": {
"someValue": {
"type": "string"
}
}
}
},
"outputs": {
"properties": {
"someValue": {
"type": "string"
}
}
}
}
}
}

0 comments on commit ef0d228

Please sign in to comment.