Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[codegen] Invalid default of type int for integer property #6469

Closed
Tracked by #13503
mikhailshilkov opened this issue Mar 4, 2021 · 1 comment · Fixed by #13599
Closed
Tracked by #13503

[codegen] Invalid default of type int for integer property #6469

mikhailshilkov opened this issue Mar 4, 2021 · 1 comment · Fixed by #13599
Assignees
Labels
area/codegen SDK-gen, program-gen, convert impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Milestone

Comments

@mikhailshilkov
Copy link
Member

mikhailshilkov commented Mar 4, 2021

The following type definition

"myprovider:index:ResourceSignal": {
            "properties": {
                "Count": {
                    "type": "integer",
                    "default": 1
                },
                "Timeout": {
                    "type": "string",
                    "default": "PT5M"
                }
            },
            "type": "object"
        }

causes an error during schema import

panic: error importing schema: binding types: failed to bind type myprovider:index:ResourceSignal:
error binding default value for property "Count": invalid default of type int for integer property

Apparently, we only allow floats as defaults here. Changing to 1.0 makes the error go away.

@mikhailshilkov mikhailshilkov added kind/bug Some behavior is incorrect or out of spec area/codegen SDK-gen, program-gen, convert labels Mar 4, 2021
@infin8x infin8x added impact/panic This bug represents a panic or unexpected crash and removed impact/panic labels Jul 10, 2021
@mikhailshilkov mikhailshilkov removed the impact/panic This bug represents a panic or unexpected crash label Jul 27, 2022
@EvanBoyle EvanBoyle added the impact/panic This bug represents a panic or unexpected crash label Jul 3, 2023
@justinvp
Copy link
Member

justinvp commented Jul 24, 2023

This should be fixed not to panic. It really should just be allowed (defaults that are ints).

@justinvp justinvp mentioned this issue Jul 24, 2023
46 tasks
@dixler dixler self-assigned this Jul 25, 2023
@dixler dixler added this to the 0.92 milestone Jul 25, 2023
bors bot added a commit that referenced this issue Jul 26, 2023
13584: [sdkgen/python] SDKgen on external enums r=dixler a=dixler

<!--- 
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. -->

Fixes #12695

Python SDKGen was not correctly referencing external enum types which needed an import alias.

## 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.
-->
- [x] 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. -->


13599: [codegen] Fix bug in provider schema where default int properties could not be int r=dixler a=dixler

<!--- 
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. -->

Fixes #6469

From the issue:

The following type definition

```json
"myprovider:index:ResourceSignal": {
            "properties": {
                "Count": {
                    "type": "integer",
                    "default": 1
                },
                "Timeout": {
                    "type": "string",
                    "default": "PT5M"
                }
            },
            "type": "object"
        }
```

causes an error during schema import

```
panic: error importing schema: binding types: failed to bind type myprovider:index:ResourceSignal:
error binding default value for property "Count": invalid default of type int for integer property
```

Apparently, we only allow floats as defaults here. Changing to `1.0` makes the error go away.

## 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.
-->
- [x] 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. -->


Co-authored-by: Kyle Dixler <kyle@pulumi.com>
bors bot added a commit that referenced this issue Jul 27, 2023
13599: [codegen] Fix bug in provider schema where default int properties could not be int r=dixler a=dixler

<!--- 
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. -->

Fixes #6469

From the issue:

The following type definition

```json
"myprovider:index:ResourceSignal": {
            "properties": {
                "Count": {
                    "type": "integer",
                    "default": 1
                },
                "Timeout": {
                    "type": "string",
                    "default": "PT5M"
                }
            },
            "type": "object"
        }
```

causes an error during schema import

```
panic: error importing schema: binding types: failed to bind type myprovider:index:ResourceSignal:
error binding default value for property "Count": invalid default of type int for integer property
```

Apparently, we only allow floats as defaults here. Changing to `1.0` makes the error go away.

## 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.
-->
- [x] 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. -->


Co-authored-by: Kyle Dixler <kyle@pulumi.com>
@bors bors bot closed this as completed in f2a92e1 Jul 27, 2023
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/codegen SDK-gen, program-gen, convert impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants