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

[BUG] (short issue description)Codegen for mocks fails on filename case mismatch. #794

Closed
vaneek opened this issue Jun 4, 2024 · 5 comments · Fixed by #849
Closed

[BUG] (short issue description)Codegen for mocks fails on filename case mismatch. #794

vaneek opened this issue Jun 4, 2024 · 5 comments · Fixed by #849
Labels
backlog bug Something isn't working needs-triage

Comments

@vaneek
Copy link

vaneek commented Jun 4, 2024

Describe the bug

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]
}

Expected Behavior

Respect actual path/filenames.

Current Behavior

performs a .lower() on path and filename.

Reproduction Steps

Using the PDK shopping list demo

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]
}

Possible Solution

No response

Additional Information/Context

No response

PDK version used

current

What languages are you seeing this issue on?

Python

Environment details (OS name and version, etc.)

AL2023

@vaneek vaneek added bug Something isn't working needs-triage labels Jun 4, 2024
Copy link

github-actions bot commented Aug 5, 2024

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

@github-actions github-actions bot added the stale label Aug 5, 2024
Copy link

Closing this issue as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

@vaneek
Copy link
Author

vaneek commented Aug 19, 2024

So ignore it and it will go away?

@cogwirrel
Copy link
Member

Hi @vaneek,

Sorry this was auto-closed - I'm just back from leave!

Reopening this as it's definitely an issue! This could also possibly be related to #793

Cheers,
Jack

@cogwirrel cogwirrel reopened this Sep 17, 2024
@github-actions github-actions bot removed the stale label Sep 23, 2024
cogwirrel added a commit that referenced this issue Oct 9, 2024
Move python infrastructure projects to new codegen.

Note that I've duplicated the ejs templates for the async python infrastructure as it's a useful
starting point for when async support for python is added.

Note that this also fixes #794 by removing the `.lower()` of the full path to the mock json files.
@cogwirrel
Copy link
Member

Hey @vaneek! I've just fixed this so it should be addressed when 0.23.62 is released :) Please let me know if you have any issues. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog bug Something isn't working needs-triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants