question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Paths' is required.

See original GitHub issue

I’ve followed the instructions here and looked at the Autofac / default samples, but I still continue to get 'Path’s is required:

{ "ClassName": "Swagger.ObjectModel.Builders.RequiredFieldException", "Message": "'Paths' is required.", "Data": null, "InnerException": null, "HelpURL": null, "StackTraceString": " at Swagger.ObjectModel.Builders.SwaggerRootBuilder.Build()\r\n at Nancy.Swagger.Services.SwaggerMetadataProvider.GetSwaggerJson(NancyContext context)\r\n at Nancy.Swagger.Modules.SwaggerModule.<>c__DisplayClass0_0.<.ctor>b__0(Object _)\r\n at Nancy.NancyModule.<>c__DisplayClass14_0'1.<Get>b__0(Object args)\r\n at Nancy.NancyModule.<>c__DisplayClass16_0'1.<Get>b__0(Object args, CancellationToken ct)\r\n at Nancy.Routing.Route'1.Invoke(DynamicDictionary parameters, CancellationToken cancellationToken)\r\n at Nancy.Routing.DefaultRouteInvoker.<Invoke>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Nancy.Routing.DefaultRequestDispatcher.<Dispatch>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Nancy.NancyEngine.<InvokeRequestLifeCycle>d__22.MoveNext()", "RemoteStackTraceString": null, "RemoteStackIndex": 0, "ExceptionMethod": "8\nBuild\nSwagger.ObjectModel, Version=2.2.42.0, Culture=neutral, PublicKeyToken=null\nSwagger.ObjectModel.Builders.SwaggerRootBuilder\nSwagger.ObjectModel.SwaggerRoot Build()", "HResult": -2146233079, "Source": "Swagger.ObjectModel", "WatsonBuckets": null }

I add the following to my bootstrapper:

SwaggerMetadataProvider.SetInfo("thing api", "v1.5", "thing.ly", new Contact { EmailAddress = "support@thing", Url = "http://thing/support" });

And I add names to my Nancy module routes Get("/ping", _ => { this.RequiresAuthentication(); return HttpStatusCode.OK; }, null, "Ping");

I created a class and ensured that it’s <Home>MetadataModule and in the same namespace as “Home” public class HomeMetadataModule : SwaggerMetadataModule { public HomeMetadataModule(ISwaggerModelCatalog modelCatalog, ISwaggerTagCatalog tagCatalog) : base(modelCatalog, tagCatalog) { RouteDescriber.DescribeRoute("Ping", "", "Ping", new[] { new HttpResponseMetadata {Code = 200, Message = "OK"} }); } }

I hit run, head to /api-docs and I’m still getting the ‘Paths’ is required message.

I’m running vs 2015 so haven’t tried to debug the demos of yet.

Version: Nancy.Swagger 2.2.42-alpha

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
catcherwongcommented, Dec 10, 2017

@LucasMoffitt I check your sample and find out the problem .

You need to change the name from Home to HomeModule , and after changing , you will get the result !

//public class Home : NancyModule
public class HomeModule : NancyModule
{
    //public Home(IMediator mediator)
    public HomeModule(IMediator mediator)
    {
       //...
     }
}

For more details , you can visit DefaultMetadataModuleConventions to find more information !

1reaction
yahehecommented, Dec 10, 2017

Oof that’s a gnarly error for such a seemingly simple thing.

We do have it documented that it should be <blah>Module and <blah>MetadataModule in the wiki, but obviously this error is less than ideal. Let’s keep this issue open and I’ll think about some other ways we can handle this. In the meantime, rename Home as Catcher suggested and you should be able to move forward.

Thanks for your help @catcherwong and @jnallard !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mongoose: validation error path is required
I'm trying to save a new document in mongodb with mongoose, but I am getting ValidationError: Path 'email' is required., Path 'passwordHash' ...
Read more >
Paths and Operations
All paths are relative to the API server URL. The full request URL is constructed as <server-url>/path . Global servers can also be...
Read more >
"Path field is required" message when path was filled in
On this client's site, about half the time when trying to add a redirect at /admin/config/search/redirect/add, upon clicking Save the form is ...
Read more >
The Following Arguments are Required - Paths Error [Solved]
The reason the "Following Arguments are Required - Paths" error occurs in AWS CLI is when the paths argument is not provided to...
Read more >
Maximum Path Length Limitation - Win32 apps
A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found