3

I'm facing some problems regarding the publication GREG using Swagger. I wonder if you have any way to make GREG recognize the JSON Schema, because I saw that it only recognizes XML Schema which ends up forcing me to use WADL.

Community
  • 1
  • 1
Vitor Darela
  • 142
  • 7
  • I have 2 files. One swagger file and the other is a json schema. My swagger file uses my json schema as a object model. I know that if I import an swagger file in Greg it works without problem. But, if I need to import a swagger file that depends on a json schema file, Greg wont work because it just recognize the swagger file and not the json file. With a wsdl I can do it good. I can import a wsdl with a xsd file e Greg recognizes both. How can I do it with swagger and Greg? – Vitor Darela Oct 19 '16 at 12:32

2 Answers2

4

I presume you are using G-Reg 4 series which does not have Swagger support. However, in G-Reg 5 series WSO2 have enabled this and you can find the latest version which is G-Reg 5.3.0 from here. Other than that, new G-Reg offers you some more very useful features to enhance SOA governance capabilities.

Adding a SOAP service using a Swagger

Adding the Swagger file

To enable json schema you have to create a handler. Please refer below sample media type handlers available in greg(carbon-registry)

WSDLMediaTypeHandler.java

SwaggerMediaTypeHandler.java

WADLMediaTypeHandler.java

Please find this useful article which will teach you how to create a simple handler.

tk_
  • 16,415
  • 8
  • 80
  • 90
  • I have 2 files. One swagger file and the other is a json schema. My swagger file uses my json schema as a object model. I know that if I import an swagger file in Greg it works without problem. But, if I need to import a swagger file that depends on a json schema file, Greg wont work because it just recognize the swagger file and not the json file. With a wsdl I can do it good. I can import a wsdl with a xsd file e Greg recognizes both. How can I do it with swagger and Greg? – Vitor Darela Oct 19 '16 at 12:32
0

You can find information regarding the support given for swagger in WSO2 Governance Registry in the following documentation.

[1] - https://docs.wso2.com/display/Governance530/Adding+a+REST+Service#AddingaRESTService-AddingaSOAPserviceusingaSwagger

[2] - https://docs.wso2.com/display/Governance530/Invoking+a+REST+Service+Using+the+In-built+Swagger+UI#InvokingaRESTServiceUsingtheIn-builtSwaggerUI-AddingtheSwaggerfile

Note: As mentioned in @thusharaK s answer, these capabilities are available in the latest version of the product.

madawa
  • 496
  • 6
  • 24
  • I have 2 files. One swagger file and the other is a json schema. My swagger file uses my json schema as a object model. I know that if I import an swagger file in Greg it works without problem. But, if I need to import a swagger file that depends on a json schema file, Greg wont work because it just recognize the swagger file and not the json file. With a wsdl I can do it good. I can import a wsdl with a xsd file e Greg recognizes both. How can I do it with swagger and Greg? – Vitor Darela Oct 19 '16 at 12:32
  • Currently, WSO2 Governance Registry doesn't support importing JSON schemas. You need to modify the [`SwaggerMediaTypeHandler`](https://github.com/wso2/carbon-registry/blob/7a7ef5b9998bd46f5be3fd2684951991bfc51386/components/registry/org.wso2.carbon.registry.extensions/src/main/java/org/wso2/carbon/registry/extensions/handlers/SwaggerMediaTypeHandler.java) in order to achieve this task. – madawa Oct 20 '16 at 03:55