2 Replies Latest reply on May 23, 2020 4:54 PM by Olafur T

    Request for fixes in the generated open API JSON.

    Olafur T

      Hi guys.

       

      thatJeffSmith-Oracle & Kris Rice-Oracle

       

      I have two requests about the generated json from ORDS 19.4

       

      1. When the module name has a space in it, the new 19.* model definition will produce an editor.swagger.io error

      Workaround is to remove spaces or replace with _ or -.

      Perhaps ORDS could replace spaces automatically when defining model names?

       

      Picture for request 1 and 2:

       

      2.ORDS adds header variables to the payload example, which it shouldn't do.

      It correctly declares it as a header variable, but since it's referenced in the body it gets put in the body example also, confusing people consuming the OpenApi doc

       

       

      So if I define a service that uses header authentication:

       

      begin
        ORDS.DEFINE_TEMPLATE(p_module_name => '123 Test',
                             p_pattern     => 'swagger-header-test',
                             p_priority    => 0,
                             p_etag_type   => 'HASH',
                             p_etag_query  => null,
                             p_comments    => null);
        ORDS.DEFINE_HANDLER(p_module_name   => '123 Test',
                            p_pattern       => 'swagger-header-test',
                            p_method        => 'POST',
                            p_source_type   => 'plsql/block',
                            p_mimes_allowed => '',
                            p_comments      => 'My nice comment',
                            p_source        => 'begin
        my_package.myaction(p_param1 => :param1, p_param2 => :param2, p_param3 => :param3, p_token => :token);
      end;
      ');
        ORDS.DEFINE_PARAMETER(p_module_name        => '123 Test',
                              p_pattern            => 'swagger-header-test',
                              p_method             => 'POST',
                              p_name               => 'token',
                              p_bind_variable_name => 'token',
                              p_source_type        => 'HEADER',
                              p_param_type         => 'STRING',
                              p_access_method      => 'IN',
                              p_comments           => 'Bearer Token authentication');
        commit;
      end;
      

       

       

      The produced OpenAPI will (wrongly) put the header variable in the payload example.

      (plus the Description for the defined "token", could that be the p_comment from the ords.define_parameter?)

       

      So would it be possible to either simply ignore header or URI variables in the Payload example for POST services? Maybe give us a flag to mark the parameter as "ignore" and not put in the payload example?

       

      Thanks!

      Regards

      Olafur

       

      Edit:

      ps. I like the new additions, great work. Especially the sample output. But could ORDS make them lowercase like the actual ORDS GET service does it?

       

      Sometimes the API Doc will create a sample response sometimes not. Not sure what triggers it. But when it happens the identifiers are uppercase  but the actual response lowercase.

      Example of uppercase when the actual case is lowercase.

       

      Regards

      Olafur

       

      Message was edited by: Olafur T