This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support IDocumentProvider
methods named GenerateAsync
#8593
Labels
3 - Done
cost: S
Will take up to 2 days to complete
enhancement
feature-code-generation
PRI: 0 - Critical
Blocks a critical product path. Must be handled immediately
Milestone
Comments
dougbu
added
enhancement
2 - Working
cost: S
Will take up to 2 days to complete
PRI: 0 - Critical
Blocks a critical product path. Must be handled immediately
feature-code-generation
labels
Oct 11, 2018
dougbu
added a commit
that referenced
this issue
Oct 14, 2018
- #8593 - default method name now `GenerateAsync` - only supported signature is `public Task GenerateAsync(string, TextWriter)` also: - handle more error cases in the tool's inside man - avoid an empty document file if `IDocumentProvider.GenerateAsync(...)` fails - unwrap an `AggregateException` nits: - remove duplicate comments - change `GetDocumentCommandWorker.TryProcess(...)` to return `false` on failure - minor because return value is currently ignored - rename `GetDocumentCommandContext.Output` -> `OutputPath`
dougbu
added a commit
that referenced
this issue
Oct 25, 2018
- #8593 - default method name now `GenerateAsync` - only supported signature is `public Task GenerateAsync(string, TextWriter)` also: - handle more error cases in the tool's inside man - avoid an empty document file if `IDocumentProvider.GenerateAsync(...)` fails - unwrap an `AggregateException` nits: - remove duplicate comments - change `GetDocumentCommandWorker.TryProcess(...)` to return `false` on failure - minor because return value is currently ignored - rename `GetDocumentCommandContext.Output` -> `OutputPath`
dougbu
added a commit
that referenced
this issue
Oct 27, 2018
- #8593 - also find `IDocumentProvider` using a more-laborious process - `Type.GetType(string)` requires an assembly-qualified name and we don't know the assembly - default method name now `GenerateAsync` - only supported signature is `public Task GenerateAsync(string, TextWriter)` also: - handle more error cases in the tool's inside man - avoid an empty document file if `IDocumentProvider.GenerateAsync(...)` fails - unwrap an `AggregateException` nits: - remove duplicate comments - change `GetDocumentCommandWorker.TryProcess(...)` to return `false` on failure - minor because return value is currently ignored - rename `GetDocumentCommandContext.Output` -> `OutputPath` - reflect recent change to `dotnet-getdocument`'s `Resources.resx` file in its designer file
dougbu
added a commit
that referenced
this issue
Oct 27, 2018
- #8593 - also find `IDocumentProvider` using a more-laborious process - `Type.GetType(string)` requires an assembly-qualified name and we don't know the assembly - default method name now `GenerateAsync` - only supported signature is `public Task GenerateAsync(string, TextWriter)` also: - handle more error cases in the tool's inside man - avoid an empty document file if `IDocumentProvider.GenerateAsync(...)` fails - unwrap an `AggregateException` nits: - remove duplicate comments - change `GetDocumentCommandWorker.TryProcess(...)` to return `false` on failure - minor because return value is currently ignored - rename `GetDocumentCommandContext.Output` -> `OutputPath` - reflect recent change to `dotnet-getdocument`'s `Resources.resx` file in its designer file
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
3 - Done
cost: S
Will take up to 2 days to complete
enhancement
feature-code-generation
PRI: 0 - Critical
Blocks a critical product path. Must be handled immediately
Is this a Bug or Feature request?
Enhancement that's part of #7947. Adds support for a different
IDocumentProvider
.Could also be considered a bug since the features/client.code.generation branch is inconsistent with what we're doing in the RicoSuter/NSwag#1658 PR.
Steps to reproduce (preferably a link to a GitHub repo with a repro project)
2.2.0-a-preview3-client-code-generation-19114
in my local NSwag build)dotnet build
Expected
Successful build
Actual
Description of the problem
The
dotnet-getdocument
tool included in the Microsoft.Extensions.ApiDescription.Design package (actually its inside man) looks only for methods namedGenerate
in theIDocumentProvider
service. This doesn't match what @rynowak did in the RicoSuter/NSwag#1658 PR. (@RSuter's prefers theasync
pattern here.)Fix is to try
GenerateAsync
first andGenerate
second. SupportTask
andTask<bool>
ifGenerateAsync
is found;void
andbool
otherwise.Version of
Microsoft.AspNetCore.Mvc
orMicrosoft.AspNetCore.App
orMicrosoft.AspNetCore.All
See the features/client.code.generation branch. That work is intended for the 2.2 Preview 3 milestone.
The text was updated successfully, but these errors were encountered: