How to use the swagger-client.buildRequest function in swagger-client

To help you get started, we’ve selected a few swagger-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github swagger-api / swagger-ui / src / core / plugins / swagger-js / index.js View on Github external
export default function({ configs, getConfigs }) {
  return {
    fn: {
      fetch: Swagger.makeHttp(configs.preFetch, configs.postFetch),
      buildRequest: Swagger.buildRequest,
      execute: Swagger.execute,
      resolve: Swagger.resolve,
      resolveSubtree: (obj, path, opts, ...rest) => {
        if(opts === undefined) {
          const freshConfigs = getConfigs()
          opts = {
            modelPropertyMacro: freshConfigs.modelPropertyMacro,
            parameterMacro: freshConfigs.parameterMacro,
            requestInterceptor: freshConfigs.requestInterceptor,
            responseInterceptor: freshConfigs.responseInterceptor
          }
        }

        return Swagger.resolveSubtree(obj, path, opts, ...rest)
      },
      serializeRes: Swagger.serializeRes,
github PacktPublishing / Building-Enterprise-JavaScript-Applications / Chapter10 / hobnob / docs / src / core / plugins / swagger-js / index.js View on Github external
module.exports = function({ configs }) {
  return {
    fn: {
      fetch: Swagger.makeHttp(configs.preFetch, configs.postFetch),
      buildRequest: Swagger.buildRequest,
      execute: Swagger.execute,
      resolve: Swagger.resolve,
      resolveSubtree: Swagger.resolveSubtree,
      serializeRes: Swagger.serializeRes,
      opId: Swagger.helpers.opId
    }
  }
}
github OpenLiberty / open-liberty / dev / com.ibm.ws.openapi.ui / swagger-ui / src / core / plugins / swagger-js / index.js View on Github external
export default function({ configs, getConfigs }) {
  return {
    fn: {
      fetch: Swagger.makeHttp(configs.preFetch, configs.postFetch),
      buildRequest: Swagger.buildRequest,
      execute: Swagger.execute,
      resolve: Swagger.resolve,
      resolveSubtree: (obj, path, opts, ...rest) => {
        if(opts === undefined) {
          const freshConfigs = getConfigs()
          opts = {
            modelPropertyMacro: freshConfigs.modelPropertyMacro,
            parameterMacro: freshConfigs.parameterMacro,
            requestInterceptor: freshConfigs.requestInterceptor,
            responseInterceptor: freshConfigs.responseInterceptor
          }
        }

        return Swagger.resolveSubtree(obj, path, opts, ...rest)
      },
      serializeRes: Swagger.serializeRes,
github gdereese / vorpal-openapi / src / operation-command-action.js View on Github external
function operationCommandAction(commandInfo, command, args, options) {
  command.log();

  const executeOptions = apiExecuteOptionsFactory(
    options.spec,
    command,
    commandInfo,
    args
  );

  const spinner = ora('Sending request...');
  spinner.start();

  const request = Swagger.buildRequest(executeOptions);

  return Swagger.http(request)
    .then(response => {
      return handleResponse(
        commandInfo,
        command,
        response,
        spinner,
        command.parent.chalk.green,
        args.options['to-file']
      );
    })
    .catch(error => {
      return handleResponse(
        commandInfo,
        command,