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

Build method gives Object Reference exception when called with Assembly.GetExecutingAssembly() #343

Closed
SapnaSoni123 opened this issue Jan 6, 2022 · 2 comments · Fixed by #489
Labels
bug Something isn't working discussion v1.5.0

Comments

@SapnaSoni123
Copy link

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 SapnaSoni123 changed the title Build method in the CLI gives Object Reference exception when called with Assembly.GetExecutingAssembly() Build method gives Object Reference exception when called with Assembly.GetExecutingAssembly() Jan 6, 2022
@justinyoo
Copy link
Contributor

@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.

@justinyoo justinyoo added bug Something isn't working discussion labels Feb 14, 2022
@justinyoo
Copy link
Contributor

As the PR, #489, has been merged, you can generate the OpenAPI doc on-the-fly, within the GitHub Actions workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discussion v1.5.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants