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 for mocks fails on filename case mismatch. #239

Closed
vaneek opened this issue May 3, 2024 · 1 comment
Closed

Codegen for mocks fails on filename case mismatch. #239

vaneek opened this issue May 3, 2024 · 1 comment

Comments

@vaneek
Copy link

vaneek commented May 3, 2024

Using the PDK shopping list demo , the generated code breaks during the build process with the following error;

File "/home/ec2-user/environment/tpdk/packages/api/generated/infrastructure/python/orgapi_python_infra/mock_integrations.py", line 23, in delete_shopping_list_200
infra:     with open(path.join(MOCK_DATA_PATH, "DELETE{}-200.json".format("/shopping-list/{shoppingListId}".replace("/", "-")).lower()), "r") as f:
infra:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
infra: FileNotFoundError: [Errno 2] No such file or directory: '/home/ec2-user/environment/tpdk/packages/api/generated/infrastructure/python/orgapi_python_infra/../mocks/delete-shopping-list-{shoppinglistid}-200.json'

The code performs a .lower() on the whole path rather than just the verb. The name of the generated json file is delete-shopping-list-{shoppingListId}-200.json. This may also catch upstream directories with caps in their name.

The smithy definition is;

@http(method: "DELETE", uri: "/shopping-list/{shoppingListId}")
@handler(language: "python")
operation DeleteShoppingList {
    input := {
        @required
        @httpLabel
        shoppingListId: ShoppingListId
    }
    output := with [ShoppingListIdMixin] {}
    errors: [NotFoundError]
}
@JordonPhillips
Copy link
Contributor

The PDK isn't making use of this project, I would recommend opening this issue in aws/aws-pdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants