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

bugfix: missing classtransformer upgrade and proper model types #129

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
# Docker engine is no longer available because of licensing
# Alternative Colima is part of the github macOS runner
# SAM v1.47.0+ needed for colima support, unable to use Python 3.6
colima start
colima start --arch x86_64
# Ensure colima is configured for later user
echo "DOCKER_HOST=unix://$HOME/.colima/default/docker.sock" >> $GITHUB_ENV
# Verify Docker
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion python/rpdk/typescript/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging

__version__ = "1.0.4"
__version__ = "1.0.5"

logging.getLogger(__name__).addHandler(logging.NullHandler())
2 changes: 1 addition & 1 deletion python/rpdk/typescript/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
SUPPORT_LIB_NAME = (
"@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib"
)
SUPPORT_LIB_VERSION = "^1.0.1"
SUPPORT_LIB_VERSION = "^1.0.6"
MAIN_HANDLER_FUNCTION = "TypeFunction"


Expand Down
6 changes: 3 additions & 3 deletions python/rpdk/typescript/templates/models.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is a generated file. Modifications will be overwritten.
import { BaseModel, Dict, integer, Integer, Optional, transformValue } from '{{lib_name}}';
import { Exclude, Expose, Type, Transform } from 'class-transformer';
import { Exclude, Expose, Type, Transform, TransformFnParams } from 'class-transformer';

{% for model, properties in models.items() %}
export class {{ model|uppercase_first_letter }} extends BaseModel {
Expand Down Expand Up @@ -31,8 +31,8 @@ export class {{ model|uppercase_first_letter }} extends BaseModel {
@Type(() => {{ inner_type.type }})
{% else %}
@Transform(
({value, obj}) =>
transformValue({{ inner_type.wrapper_type }}, '{{ name|lowercase_first_letter|safe_reserved }}', value, obj, [{{ inner_type.classes|join(', ') }}]),
(params: TransformFnParams) =>
transformValue({{ inner_type.wrapper_type }}, '{{ name|lowercase_first_letter|safe_reserved }}', params.value, params.obj, [{{ inner_type.classes|join(', ') }}]),
{
toClassOnly: true,
}
Expand Down
2 changes: 1 addition & 1 deletion python/rpdk/typescript/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"{{lib_name}}": "{{lib_path}}",
"class-transformer": "0.3.1"
"class-transformer": "0.5.1"
},
"devDependencies": {
"@types/node": "^20.0.0",
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/log-delivery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1271,11 +1271,11 @@ describe('when delivering logs', () => {
loggerProxy.addLogPublisher(s3Logger);

loggerProxy.log('count: [%d]', 5.12);
loggerProxy.log('timestamp: [%s]', new Date('2020-01-01'));
loggerProxy.log('timestamp: [%s]', new Date('2020-01-01').toISOString());

loggerProxy.log('timestamp: [%s]', new Date('2020-01-02'));
loggerProxy.log('timestamp: [%s]', new Date('2020-01-03'));
loggerProxy.log('timestamp: [%s]', new Date('2020-01-04'));
loggerProxy.log('timestamp: [%s]', new Date('2020-01-02').toISOString());
loggerProxy.log('timestamp: [%s]', new Date('2020-01-03').toISOString());
loggerProxy.log('timestamp: [%s]', new Date('2020-01-04').toISOString());
expect(inspect.defaultOptions.depth).toBe(8);
await loggerProxy.waitCompletion();

Expand Down
Loading