Open NattyMojo opened 1 year ago
I think that #136 would fix your issue as its goal is to decouple the asp.net core part (hosting the schema in a web app) from the schema generation.
@devlux yeah I think that's along the lines of what I was looking into. I'm playing around with doing something like that using the Neurolgia implementation around building/writing for files
i got the most basic thing going with
public class FuncAsyncApi
{
private readonly IAsyncApiDocumentProvider provider;
private readonly IAsyncApiDocumentSerializer serializer;
private readonly AsyncApiOptions options;
public FuncAsyncApi(
IAsyncApiDocumentProvider asyncApiDocumentProvider,
IAsyncApiDocumentSerializer asyncApiDocumentSerializer,
IOptions<AsyncApiOptions> options
)
{
this.provider = asyncApiDocumentProvider;
this.serializer = asyncApiDocumentSerializer;
this.options = options.Value;
}
[FunctionName("spec")]
public IActionResult Spec(
[HttpTrigger(AuthorizationLevel.Anonymous, Route = "/specification")] HttpRequest req
)
{
var asyncApiSchema = provider.GetDocument(options, options.AsyncApi);
return new OkObjectResult(
serializer.Serialize(asyncApiSchema)
);
}
}
so don't really think there's a blocker here, could just publish a nuget azf package that other azf's could pull in
@drdamour's FuncAsyncApi works perfect for generating the json at least :)
I've been looking into ways to get AsyncApi code-first generation into my Azure Function App and gave this package a shot, but noticing that it's calling for MVC middleware, which is not available. I've seen the same thing with other packages as well. Is there a way to get this package to generate the code-first documentation (using attributes) with an Azure Function App? Is that on the roadmap, or not available/won't be available?
Relevant ticket opened on KsntServiceBus and Neuroglia
I opened a StackOverflow question seeing if anyone has tried this with Azure Function Apps before.