The data under /apidocs
        json or Swagger UI
8873
def get(self):
        
        base_endpoint = self.config.get('endpoint', 'flasgger')
        specs = [
            {
                "url": url_for(".".join((base_endpoint, spec['endpoint']))),
                "title": spec.get('title', 'API Spec 1'),
                "version": spec.get("version", '0.0.1'),
                "endpoint": spec.get('endpoint')
            }
            for spec in self.config.get('specs', [])
        ]
        data = {
            "specs": specs,
            "title": self.config.get('title', 'Flasgger')
        }
        if request.args.get('json'):
            # calling with ?json returns specs
            return jsonify(data)
        else:  # pragma: no cover
            data['flasgger_config'] = self.config
            data['json'] = json
            data['flasgger_version'] = __version__
            data['favicon'] = self.config.get(
                'favicon',
                url_for('flasgger.static', filename='favicon-32x32.png')
            )
            data['swagger_ui_bundle_js'] = self.config.get(
                'swagger_ui_bundle_js',
                url_for('flasgger.static', filename='swagger-ui-bundle.js')
            )
            data['swagger_ui_standalone_preset_js'] = self.config.get(
                'swagger_ui_standalone_preset_js',
                url_for('flasgger.static',
                        filename='swagger-ui-standalone-preset.js')
            )
            data['jquery_js'] = self.config.get(
                'jquery_js',
                url_for('flasgger.static', filename='lib/jquery.min.js')
            )
            data['swagger_ui_css'] = self.config.get(
                'swagger_ui_css',
                url_for('flasgger.static', filename='swagger-ui.css')
            )
            return render_template(
                'flasgger/index.html',
                **data
            )
1176939
def render_doc(self):
    ''''''
    if self._doc_view:
      return self._doc_view()
    elif not self._doc:
      self.abort(self.bc_HTTPStatus_NOT_FOUND)
    res = render_template('swagger-ui.html', title=self.title, specs_url=self.specs_url)
    res = res.replace(self.complexReplaceString,self.APIDOCSPath)

    regexp="\"https?:\/\/[a-zA-Z0\-9._]*(:[0-9]*)?" + self.internal_api_prefix.replace("/","\/") + "\/swagger.json\""
    regexp="\"https?:\/\/[a-zA-Z0\-9._]*(:[0-9]*)?" + self.internal_apidoc_prefix.replace("/","\/") + "\/swagger.json\""
    p = re.compile(regexp)
    res = p.sub("\"" + self.apidocsurl + "/swagger.json\"", res)
    '''
    if (self.overrideAPIDOCSPath()):
      #print("About to replace")
      #print(res)
      res = self.reaplcements(res)
      #print("Replaced")
      #print(res)
      #print("End")
    '''
    return res
1082222
function(apiName, swaggerPath) {
        return new Promise(function(resolve, reject) {
            fs.readFile(swaggerPath, function(err, data) {
                if (err) return reject(err);
                
                resolve(APIG.importRestApi({
                    body: data,
                    failOnWarnings: false
                }).promise());
            });
        });
    }
1087322
def _api_all(self):
        
        response.content_type = 'application/json; charset=utf-8'

        if self.args.debug:
            fname = os.path.join(tempfile.gettempdir(), 'glances-debug.json')
            try:
                with open(fname) as f:
                    return f.read()
            except IOError:
                logger.debug("Debug file (%s) not found" % fname)

        # Update the stat
        self.__update__()

        try:
            # Get the JSON value of the stat ID
            statval = json.dumps(self.stats.getAllAsDict())
        except Exception as e:
            abort(404, "Cannot get stats (%s)" % str(e))

        return statval
1175303
function parseSwagger(swagger) {
  const { paths, components, info, servers, security } = swagger;
  const api = {};

  for (const path in paths) {
    for (const method in paths[path]) {
      const {
        operationId,
        summary,
        tags,
        parameters,
        requestBody,
        responses,
        security,
      } = paths[path][method];

      // make sure some props must exist
      if (!operationId)
        throw new Error(`missing operationId for ${method} ${path}`);
      if (!tags && !tags[0])
        throw new Error(`missing operation tag for ${method} ${path}`);

      // camelcase operationId
      const name = camelCase(operationId);

      // use 200/204 response, use http-errors as error responses. https://github.com/jshttp/http-errors
      const res200 = responses["200"] || responses[200];
      const res201 = responses["201"] || responses[201];
      const res202 = responses["202"] || responses[202];
      const res204 = responses["204"] || responses[204];
      const response = res200 || res201 || res202 || res204;
      if (!response)
        throw new Error(`missing 20X response for ${method} ${path}`);

      if (res200) {
        response.status = 200;
        response.content = get(response, ["content", "application/json"]);
      }

      if (res201) {
        response.status = 201;
        response.content = get(response, ["content", "application/json"]);
      }

      if (res202) {
        response.status = 202;
        response.content = get(response, ["content", "application/json"]);
      }

      if (res204) {
        response.status = 204;
        response.content = get(response, ["content", "application/json"]);
      }

      // requestBody
      if (requestBody) {
        requestBody.content = get(requestBody, ["content", "application/json"]);
      }

      // use tags[0] as api's name
      api[tags[0]] = api[tags[0]] || { name: tags[0], operations: [], ref: [] };

      api[tags[0]].operations.push({
        method,
        name,
        operationId,
        parameters,
        path,
        requestBody,
        response,
        summary,
        security,
      });
    }
  }

  return { info, servers, api, components, security };
}
151439
private String getApiId(Api api) {
        return getApiId(api.getOrganizationId(), api.getApiId(), api.getVersion());
    }
589733
function produceAPI(sourceArr, rsPath) {
    var apidocsPath = path.join(envPath, 'docs');
    const output = jsdoc2md.renderSync({ files: sourceArr })
    var isexist = fs.existsSync(apidocsPath);
    if (!isexist) {
        fs.mkdirSync(apidocsPath);
    }
    fs.writeFileSync(path.join(apidocsPath, rsPath), output)
}
1153972
def get_swagger(self, request):
        
        api_base = self.parent
        paths, definitions = self.parse_operations()
        codecs = getattr(self.cenancestor, 'registered_codecs', CODECS)  # type: dict
        return dict_filter({
            'swagger': '2.0',
            'info': {
                'title': self.title,
                'version': str(getattr(api_base, 'version', 0))
            },
            'host': self.host or request.host,
            'schemes': list(self.schemes) or None,
            'basePath': str(self.base_path),
            'consumes': list(codecs.keys()),
            'produces': list(codecs.keys()),
            'paths': paths,
            'definitions': definitions,
            'securityDefinitions': self.security_definitions(),
        })
672625
def resource_listing(cls, request) -> [(200, 'Ok', ResourceListingModel)]:
        ''''''
        apis = [api.get_swagger_fragment() for api in Api if not api.private]
        Respond(200, {
            'apiVersion': cls.api.version,
            'swaggerVersion': cls.api.swagger_version,
            'apis': apis
        })
1258281
def format_json_api_response(self, data, many):
        
        ret = self.format_items(data, many)
        ret = self.wrap_response(ret, many)
        ret = self.render_included_data(ret)
        ret = self.render_meta_document(ret)
        return ret
1150204
def _api_config(self):
        
        response.content_type = 'application/json; charset=utf-8'

        try:
            # Get the JSON value of the config' dict
            args_json = json.dumps(self.config.as_dict())
        except Exception as e:
            abort(404, "Cannot get config (%s)" % str(e))
        return args_json
137329
def to_api_data(self, restrict_keys=None):
        
        cc = self.parent._cc  # alias
        data = {
            cc('bold'): self._bold,
            cc('color'): self._color,
            cc('italic'): self._italic,
            cc('name'): self._name,
            cc('size'): self._size,
            cc('underline'): self._underline
        }

        if restrict_keys:
            for key in list(data.keys()):
                if key not in restrict_keys:
                    del data[key]
        return data
34583
def swagger_doc(action, &block)
      parse = ParserAction.new(action, &block)
      parse.adding_path
    end
1106917
function generateResourceListing (options) {
  var plurals = options.controllers.map(function (controller) {
    return controller.model().plural();
  });
  var listing = {
    apiVersion: options.version,
    swaggerVersion: '1.1',
    basePath: options.basePath,
    apis: plurals.map(function (plural) {
      return { path: '/documentation/' + plural, description: 'Operations about ' + plural + '.' };
    })
  };

  return listing;
}
1132121
def load_swagger_json(swagger_json, ptr_str="$ref"):
        
        refs = []

        def store_refs(d):
            if len(d) == 1 and ptr_str in d:
                refs.append(d)
            return d

        swagger_content = json.load(swagger_json, object_hook=store_refs)
        for ref in refs:
            _, target = ref.popitem()
            assert target[0] == "#"
            ref.update(resolve_pointer(swagger_content, target[1:]))
        return swagger_content
542730
def to_swagger(self, bound_resource=None):
        
        return _to_swagger(
            {
                'name': self.name,
                'in': self.in_.value,
                'type': str(self.type) if self.type else None,
            },
            description=self.description,
            resource=bound_resource if self.resource is DefaultResource else self.resource,
            options=self.options
        )
1201359
function view_json(req, src, options, end) {
    load(src
        , {
            authorization: req.headers['authorization'],
            X_Forwarded_For: req.X_Forwarded_For
        }

        , function(status, result) {
            if (status !== true) {
                return end(false, 'status > ' + status);
            };

            result.get(['json'], function(status, data) {
                if (status == true) {
                    if (options.yaml) {
                        data = yaml.safeDump(data, {indent: options.yaml});
                    } else {
                        data = JSON.stringify(data, null, "\t");
                    };

                } else {
                    data = 'status > ' + status;
                };

                end(status, data);
            });
        }
    );
}