Skip to content

Commit

Permalink
Add additional properties to allow added fields to not break the sdk (#…
Browse files Browse the repository at this point in the history
…18)

* Add additional properties to allow added fields to not break the sdk

* Release new version
  • Loading branch information
cleverguy25 authored Jul 20, 2024
1 parent 92cc743 commit 3133ea9
Show file tree
Hide file tree
Showing 11 changed files with 1,509 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.1
0.9.2
2 changes: 1 addition & 1 deletion sdk/go/api_esc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 17 additions & 4 deletions sdk/go/model_org_environment.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/python/pulumi_esc_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
""" # noqa: E501


__version__ = "0.9.1.dev.0"
__version__ = "0.9.2.dev.0"

# import extensions
from pulumi_esc_sdk.esc_client import EscClient
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/pulumi_esc_sdk/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'esc-sdk/python/0.9.1-dev.0'
self.user_agent = 'esc-sdk/python/0.9.2-dev.0'
self.default_headers['X-Pulumi-Source'] = 'esc-sdk'
self.client_side_validation = configuration.client_side_validation

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/pulumi_esc_sdk/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def to_debug_report(self):
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"SDK Package Version: 0.9.1.dev.0".\
"SDK Package Version: 0.9.2.dev.0".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
13 changes: 13 additions & 0 deletions sdk/python/pulumi_esc_sdk/models/org_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class OrgEnvironment(BaseModel):
name: StrictStr
created: StrictStr
modified: StrictStr
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["organization", "name", "created", "modified"]

model_config = ConfigDict(
Expand Down Expand Up @@ -64,15 +65,22 @@ def to_dict(self) -> Dict[str, Any]:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
excluded_fields: Set[str] = set([
"additional_properties",
])

_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():
_dict[_key] = _value

return _dict

@classmethod
Expand All @@ -90,6 +98,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"created": obj.get("created"),
"modified": obj.get("modified")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)

return _obj


2 changes: 1 addition & 1 deletion sdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
NAME = "pulumi-esc-sdk"
VERSION = "0.9.1.dev.0"
VERSION = "0.9.2.dev.0"
PYTHON_REQUIRES = ">=3.7"
REQUIRES = [
"urllib3 >= 1.25.3, < 2.1.0",
Expand Down
2 changes: 2 additions & 0 deletions sdk/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ components:
type: string
modified:
type: string
additionalProperties:
type: object
required:
- name
- created
Expand Down
4 changes: 3 additions & 1 deletion sdk/typescript/esc/raw/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/


const userAgent = 'esc-sdk/ts/0.9.1-dev.0';
const userAgent = 'esc-sdk/ts/0.9.2-dev.0';

import type { Configuration } from './configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
Expand Down Expand Up @@ -510,6 +510,8 @@ export interface OpenEnvironment {
* @interface OrgEnvironment
*/
export interface OrgEnvironment {
[key: string]: object | any;

/**
*
* @type {string}
Expand Down
Loading

0 comments on commit 3133ea9

Please sign in to comment.