Swagger is not showing parameter fields in UI

3,902 views
Skip to first unread message

Vamshi Krishna Sonnathi

unread,
Apr 7, 2013, 1:59:55 AM4/7/13
to servic...@googlegroups.com

Hi,

I am working with service stack services and integrated swagger. I am unable to see required fields in UI. Below is my screen.


In swagger example we can able to see the required fields, parameters and status codes etc.




What i did in my project

  1. Installed swagger
  2. Added plug in global settings.
    • Plugins.Add(new SwaggerFeature());
  3. Updated discoveryUrl
    • discoveryUrl:'../resources',

Did i miss anything?

Can anybody help me.

Thank you.


Dan B

unread,
Apr 7, 2013, 1:49:10 PM4/7/13
to servic...@googlegroups.com
You need to decorate your request DTOs with metadata attributes: https://github.com/ServiceStack/ServiceStack/wiki/Swagger-API#swagger-attributes

Vamshi Krishna Sonnathi

unread,
Apr 7, 2013, 11:08:39 PM4/7/13
to servic...@googlegroups.com

Thank You,

I am able to see parameters in the swagger ui, But when i enter the data it is not passing data to server.

ex.
my url: http://localhost:46340/service/{id}
method type: Get
when i enter the data in text box it is not passing as query string.

Added below attributes for one column.

[ApiMember(Name = "Id", Description = "id", ParameterType = "path", DataType = "int", Verb = "Get", IsRequired = true)]

and i tried with different types of parametertypes (body, header,path, query).

Do we need to add more attributes?

Am i missing?

Johannes Ferner

unread,
Apr 9, 2013, 4:05:39 AM4/9/13
to servic...@googlegroups.com
try this (i dont't exaxtly know, if the route + prop + ApiMember have to be in the same case, but i think so): 
[Route("service/{Id}]

[ApiMember(Name = "Id", Description = "id", ParameterType = "query", DataType = "int", Verb = "Get", IsRequired = true)]
public int Id {get; set;}

Maybe this is also important to know for you: http://stackoverflow.com/questions/15829222/servicestack-swagger-apimember-as-path-and-query

Vamshi Krishna Sonnathi

unread,
Apr 9, 2013, 7:16:23 AM4/9/13
to servic...@googlegroups.com
Thank You Johannes Ferner,

I tried with the same name, it is working but we are getting below url.

http://localhost:49340/service/{id}?Id=2

This what we are getting when we test the service.
Reply all
Reply to author
Forward
0 new messages