handleSwaggerPath(pathValue, href) {
    const { Copy, Resource } = this.namespace.elements;
    const resource = new Resource();

    this.withPath('paths', href, () => {
      // Provide users with a way to add a title to a resource in Swagger
      if (pathValue['x-summary']) {
        this.withPath('x-summary', () => {
          resource.title = String(pathValue['x-summary']);

          if (this.generateSourceMap) {
            this.createSourceMap(resource.meta.get('title'), this.path);
          }

          return resource.meta.get('title');
        });
      }

      // Provide users a way to add a description to a resource in Swagger
      if (pathValue['x-description']) {
        this.withPath('x-description', () => {
          const resourceDescription = new Copy(pathValue['x-description']);
          resource.push(resourceDescription);

          if (this.generateSourceMap) {
            this.createSourceMap(resourceDescription, this.path);
          }

          return resourceDescription;
        });
      }

      const pathObjectParameters = pathValue.parameters || [];
      const resourceHrefVariables = this.createHrefVariables(pathObjectParameters);

      if (resourceHrefVariables) {
        resource.hrefVariables = resourceHrefVariables;
      }

      // Set the resource-wide URI template, which can further be overridden
      // by individual transition URI templates. When creating a transition
      // below, we *only* set the transition URI template if it differs from
      // the one we've generated here.
      resource.href = uriTemplate(this.basePath, href, pathObjectParameters);

      if (this.generateSourceMap) {
        this.createSourceMap(resource.attributes.get('href'), this.path);
      }

      const relevantMethods = _.chain(pathValue)
        .omit('parameters', '$ref')
        .omitBy(isExtension)
        .value();

      // Each path is an object with methods as properties
      _.forOwn(relevantMethods, (methodValue, method) => {
        this.handleSwaggerMethod(resource, href, pathObjectParameters, methodValue, method);
      });

      this.handleSwaggerVendorExtensions(resource, pathValue);

      const operationsHaveTags = Object.values(relevantMethods).some(method => method.tags !== undefined && method.tags.length > 0);
      if (operationsHaveTags) {
        if (this.useResourceGroups()) {
          this.updateResourceGroup(pathValue['x-group-name']);
        }

        this.group.content.push(resource);
      } else {
        this.api.push(resource);
      }

      return resource;
    });
  }
// Convert a Swagger path into a Refract resource.
Convert a Swagger path into a Refract resource.
Convert a Swagger path into a Refract resource .
handleSwaggerPath(pathValue, href) {
    const { Copy, Resource } = this.namespace.elements;
    const resource = new Resource();
    this.withPath('paths', href, () => {
      if (pathValue['x-summary']) {
        this.withPath('x-summary', () => {
          resource.title = String(pathValue['x-summary']);
          if (this.generateSourceMap) {
            this.createSourceMap(resource.meta.get('title'), this.path);
          }
          return resource.meta.get('title');
        });
      }
      if (pathValue['x-description']) {
        this.withPath('x-description', () => {
          const resourceDescription = new Copy(pathValue['x-description']);
          resource.push(resourceDescription);
          if (this.generateSourceMap) {
            this.createSourceMap(resourceDescription, this.path);
          }
          return resourceDescription;
        });
      }
      const pathObjectParameters = pathValue.parameters || [];
      const resourceHrefVariables = this.createHrefVariables(pathObjectParameters);
      if (resourceHrefVariables) {
        resource.hrefVariables = resourceHrefVariables;
      }
      resource.href = uriTemplate(this.basePath, href, pathObjectParameters);
      if (this.generateSourceMap) {
        this.createSourceMap(resource.attributes.get('href'), this.path);
      }
      const relevantMethods = _.chain(pathValue)
        .omit('parameters', '$ref')
        .omitBy(isExtension)
        .value();
      _.forOwn(relevantMethods, (methodValue, method) => {
        this.handleSwaggerMethod(resource, href, pathObjectParameters, methodValue, method);
      });
      this.handleSwaggerVendorExtensions(resource, pathValue);
      const operationsHaveTags = Object.values(relevantMethods).some(method => method.tags !== undefined && method.tags.length > 0);
      if (operationsHaveTags) {
        if (this.useResourceGroups()) {
          this.updateResourceGroup(pathValue['x-group-name']);
        }
        this.group.content.push(resource);
      } else {
        this.api.push(resource);
      }
      return resource;
    });
  }
handleSwaggerPath ( pathValue , href ) { const { Copy , Resource } = this . namespace . elements ; const resource = new Resource ( ) ; this . withPath ( 'paths' , href , ( ) => { if ( pathValue [ 'x-summary' ] ) { this . withPath ( 'x-summary' , ( ) => { resource . title = String ( pathValue [ 'x-summary' ] ) ; if ( this . generateSourceMap ) { this . createSourceMap ( resource . meta . get ( 'title' ) , this . path ) ; } return resource . meta . get ( 'title' ) ; } ) ; } if ( pathValue [ 'x-description' ] ) { this . withPath ( 'x-description' , ( ) => { const resourceDescription = new Copy ( pathValue [ 'x-description' ] ) ; resource . push ( resourceDescription ) ; if ( this . generateSourceMap ) { this . createSourceMap ( resourceDescription , this . path ) ; } return resourceDescription ; } ) ; } const pathObjectParameters = pathValue . parameters || [ ] ; const resourceHrefVariables = this . createHrefVariables ( pathObjectParameters ) ; if ( resourceHrefVariables ) { resource . hrefVariables = resourceHrefVariables ; } resource . href = uriTemplate ( this . basePath , href , pathObjectParameters ) ; if ( this . generateSourceMap ) { this . createSourceMap ( resource . attributes . get ( 'href' ) , this . path ) ; } const relevantMethods = _ . chain ( pathValue ) . omit ( 'parameters' , '$ref' ) . omitBy ( isExtension ) . value ( ) ; _ . forOwn ( relevantMethods , ( methodValue , method ) => { this . handleSwaggerMethod ( resource , href , pathObjectParameters , methodValue , method ) ; } ) ; this . handleSwaggerVendorExtensions ( resource , pathValue ) ; const operationsHaveTags = Object . values ( relevantMethods ) . some ( method => method . tags !== undefined && method . tags . length > 0 ) ; if ( operationsHaveTags ) { if ( this . useResourceGroups ( ) ) { this . updateResourceGroup ( pathValue [ 'x-group-name' ] ) ; } this . group . content . push ( resource ) ; } else { this . api . push ( resource ) ; } return resource ; } ) ; }
Convert a Swagger path into a Refract resource.
Convert a Swagger path into a Refract resource .
// Provide users with a way to add a title to a resource in Swagger // Provide users a way to add a description to a resource in Swagger // Set the resource-wide URI template, which can further be overridden // by individual transition URI templates. When creating a transition // below, we *only* set the transition URI template if it differs from // the one we've generated here. // Each path is an object with methods as properties