Datatypes in Swagger UI do not support GUID,Byte[]

3,294 views
Skip to first unread message

Gautham S

unread,
May 9, 2016, 9:04:45 AM5/9/16
to Swagger
HI ,
I have a .net Web api project and I have a response model with 6 properties on which one is byte[] and another is GUID .
While seeing the swagger UI for the API the model and model schema I see the data type is being defined as string for both fields.
Is there any alternative for it?

Ron Ratovsky

unread,
May 9, 2016, 11:04:04 AM5/9/16
to swagger-sw...@googlegroups.com
The type would probably be defined as string because there aren’t too many options. The ‘sub types’ can be defined as formats though. 
While it may not be displayed in swagger-ui, check the actual spec you get to see if it’s described there.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gautham S

unread,
May 10, 2016, 1:14:21 AM5/10/16
to Swagger
I have attached the document which describes my issue.Let me know in case any solution available.
I added swagger using nuget and using it with help of swaggerconfig.cs file.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
SwaggerIssue.docx

Ron Ratovsky

unread,
May 10, 2016, 1:30:22 AM5/10/16
to swagger-sw...@googlegroups.com
I need to see the swagger.json/yaml file that’s loaded by swagger-ui.
Code or screenshots don’t cover the details I’m looking to investigate.

If there’s a concern about sharing the spec in public, feel free to email it to me directly.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Ron Ratovsky

unread,
May 10, 2016, 2:08:48 AM5/10/16
to swagger-sw...@googlegroups.com
Thanks for providing the details in private. To help the community I’ll reply here without exposing any sensitive details.

So the issue is split into two, but both come from Swashbuckle, at least at first.
  1. The byte array ends up being represented as a BASE64 string. I’m not sure what you want or expect to be there as byte array, so it’s hard to say whether that’s the expected result or not.
  2. As for the GUID, that’s not reflected in what’s generated from Swashbuckle. You’d need to open a ticket on the project directly and ask how to document that (this would require a custom format field value).
Reply all
Reply to author
Forward
0 new messages