Hi,
I have written unit tests to check if the Open API document is getting generated successfully or not. The method is as below:
async Task CoreAsync()
{
var helper = new DocumentHelper(new RouteConstraintFilter(), new OpenApiSchemaAcceptor());
var document = new Document(helper);
return await document.InitialiseDocument()
.AddMetadata(oaiInfo)
.AddNamingStrategy(new CamelCaseNamingStrategy())
.Build(assembly)
.RenderAsync(OpenApiSpecVersion.OpenApi3_0, OpenApiFormat.Json);
}
where assembly= Assembly.GetExecutingAssembly()
and oaiInfo is a custom OpenApiInfo() object.
This method always fails while trying to Build(assembly) giving the Object reference not set to an instance exception.
Has anyone encountered this issue before? Please also not that I am able to generate on the fly Swagger Json. It's only that the Build method fails.
@SapnaSoni123 Thanks for the issue! It's a known issue the CLI project. But it's de-priotised over other issues. Let's keep this issue open for further discussion.
As the PR, #489, has been merged, you can generate the OpenAPI doc on-the-fly, within the GitHub Actions workflow.