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

Feature Request: Linter Rule for Implicit HttpParts Usage #5849

Open
3 tasks done
joheredi opened this issue Feb 3, 2025 · 0 comments
Open
3 tasks done

Feature Request: Linter Rule for Implicit HttpParts Usage #5849

joheredi opened this issue Feb 3, 2025 · 0 comments
Labels

Comments

@joheredi
Copy link
Member

joheredi commented Feb 3, 2025

Clear and concise description of the problem

Since we now have a way to explicitly define HttpParts (#3046), I think it would be beneficial to introduce a linter rule that warns users when relying on implicit parts. This would encourage clearer and more maintainable specs by making HttpParts usage explicit.

Additionally, a multipart operation must have a @bodyProperty property. Operations that use spread models or are structured like this:

op doThing(
  @header contentType: "multipart/form-data",
  name: HttpPart<string>,
  age: HttpPart<int32>,
  description?: HttpPart<string>,
): void;

are not resolved as multipart in @typespec/http, as discussed in #4041.

Given this behavior, I believe it's important to add a linter rule to help users successfully define multipart operations. This would prevent unexpected behavior and ensure specs are correctly structured.

cc: @timotheeguerin

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant