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

Path segments with a period only generate a property using the final part of the segment after the dot #1892

Closed
darrelmiller opened this issue Oct 15, 2022 · 2 comments · Fixed by #1901
Assignees
Labels
enhancement New feature or request fixed generator Issues or improvements relater to generation capabilities.

Comments

@darrelmiller
Copy link
Member

Using this description https://raw.githubusercontent.com/nytimes/public_api_specs/master/movie_reviews/movie_reviews_v2.json

it generates code that looks like this

var review = await reviewClient.Reviews.Json.GetAsync(rc => rc.QueryParameters.Query = movieName);

The API actually looks like this
image

Ideally it would be reviewClient.Reviews.SearchJson

I'm not sure how to handle OData actions and functions that are fully qualified with a namespace.

@baywet baywet self-assigned this Oct 16, 2022
@baywet baywet added enhancement New feature or request generator Issues or improvements relater to generation capabilities. Needs: Author Feedback labels Oct 16, 2022
@baywet baywet assigned darrelmiller and unassigned baywet Oct 16, 2022
@baywet baywet added this to Kiota Oct 16, 2022
@baywet baywet moved this to Todo in Kiota Oct 16, 2022
@baywet
Copy link
Member

baywet commented Oct 16, 2022

IMHO having a file extension in an API path is just bad design: I kind of locks the client in a single content type, making the accept header useless and any evolution to support future formats a breaking change.

That being said, we could "patch that" without breaking the OData namespace segmenting by simply stripping a few known extensions from the fluent API segmenting. (json, csv, txt, yaml, yml...)

The code path would then become

var review = await reviewClient.Reviews.GetAsync(rc => rc.QueryParameters.Query = movieName);

Thoughts?

@darrelmiller
Copy link
Member Author

IMHO having a file extension in an API path is just bad design

Roy Fielding disagrees :-) So we might want to account for the possibility.

Yeah, I think stripping a set of known extensions is a reasonable compromise.

@baywet baywet assigned baywet and unassigned darrelmiller Oct 17, 2022
@baywet baywet added the fixed label Oct 17, 2022
@baywet baywet moved this from Todo to In Progress in Kiota Oct 17, 2022
@baywet baywet closed this as completed in 60db228 Oct 18, 2022
Repository owner moved this from In Progress to Done in Kiota Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed generator Issues or improvements relater to generation capabilities.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants