Support inheriting from HttpMethodAttribute's children #657
Labels
enhancement
semantic-analysis
Bug reports/change requests that would require semantic analysis in the stub generator
up-for-grabs
Is your feature request related to a problem? Please describe.
I currently have an attribute that inherits from
PostAttribute
, that does some additional work to set its path property. The problem with that is that the codegeneration tool that implements the interface looks for aPostAttribute
(or another of theHttpMethodAttribute
-family), and thus skips over the interface altogether. Then at runtime resolving the interface will fail and throw an exception.Describe the solution you'd like
Preferably, the code generation would use semantic analysis to check whether an interface has attributes that inherit from
HttpMethodAttribute
, instead of looking for the syntax tokens.There are currently two places in the code where this would fail:
Using Refit
directive. If the interface has attributes that inherit from refit-attributes, they are likely in a different namespace.Describe alternatives you've considered
If the adjustment of the code-generation is not feasible, it would maybe be nice to mark the
HttpMethodAttribute
's children assealed
, so that it is clear that inheriting from them is not supported by the library.Describe suggestions on how to achieve the feature
I don't think this feature is possible to achieve with just syntax analysis. I am not experienced enough to know how feasible this is with semantic analysis added.
It appears from debugging that this feature shouldn't affect the Refit project itself. When resolving the interface at runtime, the code works fine up to the point that the generated type is needed, which then fails because the code wasn't generated.
Additional context
The text was updated successfully, but these errors were encountered: