Swagger resources missing httpMethod property

I recently updated from ServiceStack v3.x to latest v4.5.4 (and loving it). The only issue I have encountered is the Swagger integration that I previously had on the project is no longer working properly. When I view the Swagger UI I see the error “SwaggerOperation [OperationName] is missing httpMethod.” It seems swagger is expecting the JSON returned by the /resources endpoint to use “httpMethod” instead of “method” (as shown in the sample below that is being generated by my project). I have uninstalled and re-installed the ServiceStack.Api.Swagger package to see if that fixes it but it did not. What am I missing?

{"swaggerVersion":"1.2","apiVersion":"1.0","basePath":"http://localhost:7100","resourcePath":"/account","apis":[{"path":"/account/advertisers","description":"Request advertiser list.","operations":[{"method":"GET","summary":"Request advertiser list.","notes":"Provides list of advertisers associated with your account or your partners.","nickname":"GetAdvertisersRequest","parameters":[],"responseClass":"List[AdvertiserResponse]","errorResponses":[]}]},

Thanks

Swagger API spec was upgraded to 1.2 which specifies JSON operation should use method, which Swagger UI is expecting httpMethod? if it’s the Swagger UI embedded in the ServiceStack.Api.Swagger NuGet package can you reply with a screenshot showing the issue?

Thanks, Demis. The issue was my project still had custom versions of index.html and supporting files from the prior v3 version. I deleted these and the default, embedded version of swagger-ui is now rendering the API methods properly. I reviewed the ServiceStack Swagger docs and see that the default embedded HTML can be overridden. I added a single /swagger-ui folder with a custom index.html file based on the latest version in GIT. I think I am all set now. If I missed any necessary steps for customizing my Swagger UI page let me know. Thanks for the quick reply!

1 Like