1 Reply Latest reply on Apr 12, 2018 4:56 PM by Pierre Yotti

    No swagger when creating a rest service from module / sql developer

    3677366

      first of all the config : Oracle 12C, using  ords.17.4.1.353.06.48., deployed on weblogic 12.2.1.2.0.

       

      I've noticed two different behaviours when trying to get the Swagger definition for a rest service.

       

      When using Autorest to expose an entire table as a rest service, the swagger generates fine.

       

      for example: the url : ip:port/ords/schema-alias/open-api-catalog/tablename returns in the browser :

       

      {"swagger":"2.0","info":{"title":"ORDS generated API for SAT_BRL_BRUT_NET","version":"1.0.0"},"host":"ip:port","basePath":"/ords/dv_fl/sat_brl_brut_net","schemes":["http"],"produces":["application/json"],"paths":{"/":{"get":{"produces":["application/json"],"responses":{"200":{"description":"output of the endpoint","schema":{"type":"object","properties":{}}}}},"post":{"produces":["application/json"],"responses":{"200":{"description":"output of the endpoint","schema":{"type":"object","properties":{}}}},"parameters":[{"name":"payload","in":"body","required":true,"schema":{"$ref":"#/definitions/PAYLOAD1"}}]}},"/{id}":{"get":{"produces":["application/json"],"responses":{"200":{"description":"output of the endpoint","schema":{"type":"object","properties":{}}}},"parameters":[{"name":"id","in":"path","required":true,"type":"string","description":"implicit","pattern":"^[^/]+$"}]},"put":{"produces":["application/json"],"responses":{"200":{"description":"output of the endpoint","schema":{"type":"object","properties":{}}}},"parameters":[{"name":"id","in":"path","required":true,"type":"string","description":"implicit","pattern":"^[^/]+$"},{"name":"payload","in":"body","required":true,"schema":{"$ref":"#/definitions/PAYLOAD1"}}]},"delete":{"produces":["application/json"],"responses":{"200":{"description":"output of the endpoint","schema":{"type":"object","properties":{}}}},"parameters":[{"name":"id","in":"path","required":true,"type":"string","description":"implicit","pattern":"^[^/]+$"}]}}},"definitions":{"CHAR":{"type":"string"},"NUMBER":{"type":"number"},"TIMESTAMP":{"type":"string","pattern":"^\\d{4}-[01]\\d-[0123]\\dT[012]\\d:[0-5]\\d:[0-5]\\d(.\\d+)?(Z|([-+][012]\\d:[0-5]\\d))$"},"TIMESTAMP":{"type":"string","pattern":"^\\d{4}-[01]\\d-[0123]\\dT[012]\\d:[0-5]\\d:[0-5]\\d(.\\d+)?(Z|([-+][012]\\d:[0-5]\\d))$"},"VARCHAR2":{"type":"string"},"PAYLOAD1":{"properties":{"BRUT_NET_HKEY":{"$ref":"#/definitions/VARCHAR2"},"LOAD_DATE":{"$ref":"#/definitions/TIMESTAMP"},"SUB_SEQUENCE_NUMBER":{"$ref":"#/definitions/NUMBER"},"LOAD_END_DATE":{"$ref":"#/definitions/TIMESTAMP"},"LOAD_CYCLE_ID_CR":{"$ref":"#/definitions/NUMBER"},"LOAD_CYCLE_ID_UPD":{"$ref":"#/definitions/NUMBER"},"HASH_DIFF":{"$ref":"#/definitions/VARCHAR2"},"DELETE_FLAG":{"$ref":"#/definitions/CHAR"},"U_TMS":{"$ref":"#/definitions/TIMESTAMP"},"CONTRACT_NR":{"$ref":"#/definitions/CHAR"},"PT1_VOLG_NR":{"$ref":"#/definitions/NUMBER"},"BRUT_RSZ_BEDR":{"$ref":"#/definitions/NUMBER"},"PERS_RSZ_BEDR":{"$ref":"#/definitions/NUMBER"},"BRUT_BRSZ_BEDR":{"$ref":"#/definitions/NUMBER"},"BELAST_BEDR":{"$ref":"#/definitions/NUMBER"},"BVH_BEDR":{"$ref":"#/definitions/NUMBER"},"NETTO_BEDR":{"$ref":"#/definitions/NUMBER"},"PATR_RSZ_BEDR":{"$ref":"#/definitions/NUMBER"},"BRUT_108_BEDR":{"$ref":"#/definitions/NUMBER"},"KPL_NR":{"$ref":"#/definitions/CHAR"},"JP_NR":{"$ref":"#/definitions/CHAR"},"CLIENT_CODE":{"$ref":"#/definitions/CHAR"},"ARCH_CODE":{"$ref":"#/definitions/CHAR"},"ARCH_TMS":{"$ref":"#/definitions/TIMESTAMP"},"BN_ID":{"$ref":"#/definitions/NUMBER"},"LBR_ID":{"$ref":"#/definitions/NUMBER"}}}}}

       

      this looks fine.

       

      BUT :

       

      When developing a rest service directly on the schema / Rest Data Services part of SQL developer, I am able to get the rest service working ( getting data) but when trying to get the Swagger, I only get a blank page in the browser.

       

      for example :IP:port/ords/schemaname/open-api-catalog/brl/getBrutNet  returns a blank page, while IP:port/ords/schemaname/open-api-catalog/brl/ returns :

       

      {"swagger":"2.0","info":{"title":"ORDS generated API for BRL","version":"1.0.0"},"host":"IP:port","basePath":"/ords/dv_fl/brl","schemes":["http"],"produces":["application/json"],"paths":{"/getBrutNet":{"get":{"produces":["application/json"],"responses":{"200":{"description":"output of the endpoint","schema":{"type":"object","properties":{}}}}}}}}

       

      which is not the valid swagger for the 'getBrutNet' example mentionned above in the url

       

      How can i get the swagger for the rest service?

       

      If someone can shed a light on this, that would be great !