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

Kiota should sanitize file names and namespace when generating plugins #5019

Closed
maisarissi opened this issue Jul 24, 2024 · 6 comments · Fixed by #5024
Closed

Kiota should sanitize file names and namespace when generating plugins #5019

maisarissi opened this issue Jul 24, 2024 · 6 comments · Fixed by #5024
Assignees
Labels
type:bug A broken experience
Milestone

Comments

@maisarissi
Copy link
Contributor

maisarissi commented Jul 24, 2024

Today when generating plugins Kiota uses the plugin name as the namespace property in the plugin manifest and to name the generated plugin and sliced OpenAPI descriptions files.
The blank space in the namespace property is making Copilot to fail on finding functions to call the plugin.

Example:

kiota plugin add --openapi ./openapi/openapi.yml --plugin-name "Budget Tracker" --type APIPlugin --output ./plugin

When using the cmd above, here is what I get:

budget tracker-apiplugin.json
budget tracker-openapi.json

Also the budget tracker-apiplugin.json file has the following info:

"namespace": "Budget Tracker"

Expected:
Files names and namespace should be sanitized to be [A-Z][a-z][0-9], no spaces, no special characters.

@maisarissi maisarissi added the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Jul 24, 2024
@andrueastman andrueastman added type:bug A broken experience and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Jul 25, 2024
@baywet
Copy link
Member

baywet commented Jul 25, 2024

@maisarissi do you expect automatic sanitation here or an error to be returned to the user?

@baywet baywet added this to the Kiota v1.18 milestone Jul 25, 2024
@maisarissi
Copy link
Contributor Author

Automatic sanitation. We should generate the plugin with no errors after that.

@petrhollayms
Copy link
Contributor

@maisarissi Can we please add a few examples? Small letters are also fine btw., or?

@maisarissi
Copy link
Contributor Author

@maisarissi Can we please add a few examples? Small letters are also fine btw., or?

hey @petrhollayms . As I mentioned in the description, it should be sanitized to only contain letters (uppercase and lowercase) and numbers:
Expected: Files names and namespace should be sanitized to be [A-Z][a-z][0-9], no spaces, no special characters.

@sebastienlevert
Copy link
Contributor

I assume we keep the original casing?

My-Super complex() %@#$& Name becomes MySupercomplexName?

@andrueastman
Copy link
Member

I assume we keep the original casing?

My-Super complex() %@#$& Name becomes MySupercomplexName?

Originally, we lower cased the file name and kept the same for the other components relying on the plugin name. (See example provided in spec at https:/microsoft/kiota/blob/main/specs/cli/plugin-add.md#using-kiota-plugin-add)

Authored #5024 to maintain the behaviour. (file name is lowered but other items maintain casing after sanitization)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug A broken experience
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants