.NET Core API Documentation












-2














I'm trying to implement API documentation and make use Microsoft.AspNetCore.Mvc.ApiExplorer in my fresh .net core project. I've followed every step in this tutorial:



https://andrewlock.net/introduction-to-the-apiexplorer-in-asp-net-core/



yet im getting this exception:



    Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type instanceType, Type argumentTypes, out ConstructorInfo matchingConstructor, out Nullable<int> parameterMap)
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(Type instanceType, Type argumentTypes)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelActivatorProvider.CreateActivator(CompiledPageActionDescriptor actionDescriptor)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelFactoryProvider.CreateModelFactory(CompiledPageActionDescriptor descriptor)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvokerProvider.CreateCacheEntry(ActionInvokerProviderContext context, FilterItem cachedFilters)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvokerProvider.OnProvidersExecuting(ActionInvokerProviderContext context)
Microsoft.AspNetCore.Mvc.Internal.ActionInvokerFactory.CreateInvoker(ActionContext actionContext)
Microsoft.AspNetCore.Mvc.Internal.MvcAttributeRouteHandler+<>c__DisplayClass12_0.<RouteAsync>b__0(HttpContext c)
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


It seems like the object reference in DocumentationController is never passed in.
In ASP.Net you can just simply generate the help pages. Can anyone please explain me how to properly use the ApiExplorer or provide an alternative solution for creating Web API docs?










share|improve this question






















  • Hey there. It's going to be difficult to help with what you have provided thus far. Could you add the exception message and your code? I'm guessing it might be your controller class that is causing the problem. Do you have more than one constructor?
    – Nigel Whatling
    Nov 21 at 0:11










  • Try swagger. it is much easier to implement with much more features. You can test run the APIs and so on
    – Neville Nazerane
    Nov 21 at 2:03
















-2














I'm trying to implement API documentation and make use Microsoft.AspNetCore.Mvc.ApiExplorer in my fresh .net core project. I've followed every step in this tutorial:



https://andrewlock.net/introduction-to-the-apiexplorer-in-asp-net-core/



yet im getting this exception:



    Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type instanceType, Type argumentTypes, out ConstructorInfo matchingConstructor, out Nullable<int> parameterMap)
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(Type instanceType, Type argumentTypes)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelActivatorProvider.CreateActivator(CompiledPageActionDescriptor actionDescriptor)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelFactoryProvider.CreateModelFactory(CompiledPageActionDescriptor descriptor)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvokerProvider.CreateCacheEntry(ActionInvokerProviderContext context, FilterItem cachedFilters)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvokerProvider.OnProvidersExecuting(ActionInvokerProviderContext context)
Microsoft.AspNetCore.Mvc.Internal.ActionInvokerFactory.CreateInvoker(ActionContext actionContext)
Microsoft.AspNetCore.Mvc.Internal.MvcAttributeRouteHandler+<>c__DisplayClass12_0.<RouteAsync>b__0(HttpContext c)
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


It seems like the object reference in DocumentationController is never passed in.
In ASP.Net you can just simply generate the help pages. Can anyone please explain me how to properly use the ApiExplorer or provide an alternative solution for creating Web API docs?










share|improve this question






















  • Hey there. It's going to be difficult to help with what you have provided thus far. Could you add the exception message and your code? I'm guessing it might be your controller class that is causing the problem. Do you have more than one constructor?
    – Nigel Whatling
    Nov 21 at 0:11










  • Try swagger. it is much easier to implement with much more features. You can test run the APIs and so on
    – Neville Nazerane
    Nov 21 at 2:03














-2












-2








-2







I'm trying to implement API documentation and make use Microsoft.AspNetCore.Mvc.ApiExplorer in my fresh .net core project. I've followed every step in this tutorial:



https://andrewlock.net/introduction-to-the-apiexplorer-in-asp-net-core/



yet im getting this exception:



    Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type instanceType, Type argumentTypes, out ConstructorInfo matchingConstructor, out Nullable<int> parameterMap)
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(Type instanceType, Type argumentTypes)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelActivatorProvider.CreateActivator(CompiledPageActionDescriptor actionDescriptor)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelFactoryProvider.CreateModelFactory(CompiledPageActionDescriptor descriptor)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvokerProvider.CreateCacheEntry(ActionInvokerProviderContext context, FilterItem cachedFilters)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvokerProvider.OnProvidersExecuting(ActionInvokerProviderContext context)
Microsoft.AspNetCore.Mvc.Internal.ActionInvokerFactory.CreateInvoker(ActionContext actionContext)
Microsoft.AspNetCore.Mvc.Internal.MvcAttributeRouteHandler+<>c__DisplayClass12_0.<RouteAsync>b__0(HttpContext c)
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


It seems like the object reference in DocumentationController is never passed in.
In ASP.Net you can just simply generate the help pages. Can anyone please explain me how to properly use the ApiExplorer or provide an alternative solution for creating Web API docs?










share|improve this question













I'm trying to implement API documentation and make use Microsoft.AspNetCore.Mvc.ApiExplorer in my fresh .net core project. I've followed every step in this tutorial:



https://andrewlock.net/introduction-to-the-apiexplorer-in-asp-net-core/



yet im getting this exception:



    Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type instanceType, Type argumentTypes, out ConstructorInfo matchingConstructor, out Nullable<int> parameterMap)
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(Type instanceType, Type argumentTypes)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelActivatorProvider.CreateActivator(CompiledPageActionDescriptor actionDescriptor)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelFactoryProvider.CreateModelFactory(CompiledPageActionDescriptor descriptor)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvokerProvider.CreateCacheEntry(ActionInvokerProviderContext context, FilterItem cachedFilters)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvokerProvider.OnProvidersExecuting(ActionInvokerProviderContext context)
Microsoft.AspNetCore.Mvc.Internal.ActionInvokerFactory.CreateInvoker(ActionContext actionContext)
Microsoft.AspNetCore.Mvc.Internal.MvcAttributeRouteHandler+<>c__DisplayClass12_0.<RouteAsync>b__0(HttpContext c)
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


It seems like the object reference in DocumentationController is never passed in.
In ASP.Net you can just simply generate the help pages. Can anyone please explain me how to properly use the ApiExplorer or provide an alternative solution for creating Web API docs?







c# .net-core asp.net-core-webapi






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 at 23:28









Ladislav Baran

31




31












  • Hey there. It's going to be difficult to help with what you have provided thus far. Could you add the exception message and your code? I'm guessing it might be your controller class that is causing the problem. Do you have more than one constructor?
    – Nigel Whatling
    Nov 21 at 0:11










  • Try swagger. it is much easier to implement with much more features. You can test run the APIs and so on
    – Neville Nazerane
    Nov 21 at 2:03


















  • Hey there. It's going to be difficult to help with what you have provided thus far. Could you add the exception message and your code? I'm guessing it might be your controller class that is causing the problem. Do you have more than one constructor?
    – Nigel Whatling
    Nov 21 at 0:11










  • Try swagger. it is much easier to implement with much more features. You can test run the APIs and so on
    – Neville Nazerane
    Nov 21 at 2:03
















Hey there. It's going to be difficult to help with what you have provided thus far. Could you add the exception message and your code? I'm guessing it might be your controller class that is causing the problem. Do you have more than one constructor?
– Nigel Whatling
Nov 21 at 0:11




Hey there. It's going to be difficult to help with what you have provided thus far. Could you add the exception message and your code? I'm guessing it might be your controller class that is causing the problem. Do you have more than one constructor?
– Nigel Whatling
Nov 21 at 0:11












Try swagger. it is much easier to implement with much more features. You can test run the APIs and so on
– Neville Nazerane
Nov 21 at 2:03




Try swagger. it is much easier to implement with much more features. You can test run the APIs and so on
– Neville Nazerane
Nov 21 at 2:03












1 Answer
1






active

oldest

votes


















0














The link you provided was created in 2017, prior to the release of .NET Core 2.0. There was a huge difference between 2.0 and its past releases. The documentation you have shown belongs has codes used on 1.x. I suggest you check out swagger. Here is the documentation of how to set it up step by step. You basically mostly need to update your startup.cs file. The code in Startup will help generate a JSON file containing all info on your web API. The UseSwaggerUI function will then help you to generate a complete swagger UI. The UI comes complete with options do directly run and test the API including authentication.



Swagger is not specific to .NET and its json output is quite generic and popular. Microsoft and several others have started integrating tools to swagger's json file as well. This means as long as you have a swagger json setup for your API, you can also take advantage of these tools. For instance, you can generate the consuming code (coming up on December in version 2.2) or even generate the entire client-side on UWP. I am quite sure other popular technologies like react and angular would have auto-generation tools once you use swagger as well.






share|improve this answer





















  • I had read about Swagger on the .NET core documentation. I was trying to find a solution integrated to the actual framework but looks like this is the best option s ofar. Anyway, thanks for the tip.
    – Ladislav Baran
    Nov 21 at 21:52










  • Integrated in what ways? the upcoming version 2.2 has additional features that integrate with swagger. With Microsoft working so much to integrate with and from swagger, I don't think they would be making a first party solution
    – Neville Nazerane
    Nov 21 at 22:19










  • have a look at this updated implementation using the new framework that released yesterday youtube.com/watch?v=_vw3hcnSA1Y
    – Neville Nazerane
    Dec 6 at 0:04











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403161%2fnet-core-api-documentation%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The link you provided was created in 2017, prior to the release of .NET Core 2.0. There was a huge difference between 2.0 and its past releases. The documentation you have shown belongs has codes used on 1.x. I suggest you check out swagger. Here is the documentation of how to set it up step by step. You basically mostly need to update your startup.cs file. The code in Startup will help generate a JSON file containing all info on your web API. The UseSwaggerUI function will then help you to generate a complete swagger UI. The UI comes complete with options do directly run and test the API including authentication.



Swagger is not specific to .NET and its json output is quite generic and popular. Microsoft and several others have started integrating tools to swagger's json file as well. This means as long as you have a swagger json setup for your API, you can also take advantage of these tools. For instance, you can generate the consuming code (coming up on December in version 2.2) or even generate the entire client-side on UWP. I am quite sure other popular technologies like react and angular would have auto-generation tools once you use swagger as well.






share|improve this answer





















  • I had read about Swagger on the .NET core documentation. I was trying to find a solution integrated to the actual framework but looks like this is the best option s ofar. Anyway, thanks for the tip.
    – Ladislav Baran
    Nov 21 at 21:52










  • Integrated in what ways? the upcoming version 2.2 has additional features that integrate with swagger. With Microsoft working so much to integrate with and from swagger, I don't think they would be making a first party solution
    – Neville Nazerane
    Nov 21 at 22:19










  • have a look at this updated implementation using the new framework that released yesterday youtube.com/watch?v=_vw3hcnSA1Y
    – Neville Nazerane
    Dec 6 at 0:04
















0














The link you provided was created in 2017, prior to the release of .NET Core 2.0. There was a huge difference between 2.0 and its past releases. The documentation you have shown belongs has codes used on 1.x. I suggest you check out swagger. Here is the documentation of how to set it up step by step. You basically mostly need to update your startup.cs file. The code in Startup will help generate a JSON file containing all info on your web API. The UseSwaggerUI function will then help you to generate a complete swagger UI. The UI comes complete with options do directly run and test the API including authentication.



Swagger is not specific to .NET and its json output is quite generic and popular. Microsoft and several others have started integrating tools to swagger's json file as well. This means as long as you have a swagger json setup for your API, you can also take advantage of these tools. For instance, you can generate the consuming code (coming up on December in version 2.2) or even generate the entire client-side on UWP. I am quite sure other popular technologies like react and angular would have auto-generation tools once you use swagger as well.






share|improve this answer





















  • I had read about Swagger on the .NET core documentation. I was trying to find a solution integrated to the actual framework but looks like this is the best option s ofar. Anyway, thanks for the tip.
    – Ladislav Baran
    Nov 21 at 21:52










  • Integrated in what ways? the upcoming version 2.2 has additional features that integrate with swagger. With Microsoft working so much to integrate with and from swagger, I don't think they would be making a first party solution
    – Neville Nazerane
    Nov 21 at 22:19










  • have a look at this updated implementation using the new framework that released yesterday youtube.com/watch?v=_vw3hcnSA1Y
    – Neville Nazerane
    Dec 6 at 0:04














0












0








0






The link you provided was created in 2017, prior to the release of .NET Core 2.0. There was a huge difference between 2.0 and its past releases. The documentation you have shown belongs has codes used on 1.x. I suggest you check out swagger. Here is the documentation of how to set it up step by step. You basically mostly need to update your startup.cs file. The code in Startup will help generate a JSON file containing all info on your web API. The UseSwaggerUI function will then help you to generate a complete swagger UI. The UI comes complete with options do directly run and test the API including authentication.



Swagger is not specific to .NET and its json output is quite generic and popular. Microsoft and several others have started integrating tools to swagger's json file as well. This means as long as you have a swagger json setup for your API, you can also take advantage of these tools. For instance, you can generate the consuming code (coming up on December in version 2.2) or even generate the entire client-side on UWP. I am quite sure other popular technologies like react and angular would have auto-generation tools once you use swagger as well.






share|improve this answer












The link you provided was created in 2017, prior to the release of .NET Core 2.0. There was a huge difference between 2.0 and its past releases. The documentation you have shown belongs has codes used on 1.x. I suggest you check out swagger. Here is the documentation of how to set it up step by step. You basically mostly need to update your startup.cs file. The code in Startup will help generate a JSON file containing all info on your web API. The UseSwaggerUI function will then help you to generate a complete swagger UI. The UI comes complete with options do directly run and test the API including authentication.



Swagger is not specific to .NET and its json output is quite generic and popular. Microsoft and several others have started integrating tools to swagger's json file as well. This means as long as you have a swagger json setup for your API, you can also take advantage of these tools. For instance, you can generate the consuming code (coming up on December in version 2.2) or even generate the entire client-side on UWP. I am quite sure other popular technologies like react and angular would have auto-generation tools once you use swagger as well.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 at 2:32









Neville Nazerane

2,50721434




2,50721434












  • I had read about Swagger on the .NET core documentation. I was trying to find a solution integrated to the actual framework but looks like this is the best option s ofar. Anyway, thanks for the tip.
    – Ladislav Baran
    Nov 21 at 21:52










  • Integrated in what ways? the upcoming version 2.2 has additional features that integrate with swagger. With Microsoft working so much to integrate with and from swagger, I don't think they would be making a first party solution
    – Neville Nazerane
    Nov 21 at 22:19










  • have a look at this updated implementation using the new framework that released yesterday youtube.com/watch?v=_vw3hcnSA1Y
    – Neville Nazerane
    Dec 6 at 0:04


















  • I had read about Swagger on the .NET core documentation. I was trying to find a solution integrated to the actual framework but looks like this is the best option s ofar. Anyway, thanks for the tip.
    – Ladislav Baran
    Nov 21 at 21:52










  • Integrated in what ways? the upcoming version 2.2 has additional features that integrate with swagger. With Microsoft working so much to integrate with and from swagger, I don't think they would be making a first party solution
    – Neville Nazerane
    Nov 21 at 22:19










  • have a look at this updated implementation using the new framework that released yesterday youtube.com/watch?v=_vw3hcnSA1Y
    – Neville Nazerane
    Dec 6 at 0:04
















I had read about Swagger on the .NET core documentation. I was trying to find a solution integrated to the actual framework but looks like this is the best option s ofar. Anyway, thanks for the tip.
– Ladislav Baran
Nov 21 at 21:52




I had read about Swagger on the .NET core documentation. I was trying to find a solution integrated to the actual framework but looks like this is the best option s ofar. Anyway, thanks for the tip.
– Ladislav Baran
Nov 21 at 21:52












Integrated in what ways? the upcoming version 2.2 has additional features that integrate with swagger. With Microsoft working so much to integrate with and from swagger, I don't think they would be making a first party solution
– Neville Nazerane
Nov 21 at 22:19




Integrated in what ways? the upcoming version 2.2 has additional features that integrate with swagger. With Microsoft working so much to integrate with and from swagger, I don't think they would be making a first party solution
– Neville Nazerane
Nov 21 at 22:19












have a look at this updated implementation using the new framework that released yesterday youtube.com/watch?v=_vw3hcnSA1Y
– Neville Nazerane
Dec 6 at 0:04




have a look at this updated implementation using the new framework that released yesterday youtube.com/watch?v=_vw3hcnSA1Y
– Neville Nazerane
Dec 6 at 0:04


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403161%2fnet-core-api-documentation%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python