npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

azure-functions-swagger-ui

v1.1.2

Published

A simple npm module that integrates Swagger UI into Azure Functions, providing a user-friendly interface to visualize and interact with your API endpoints. Perfect for documenting and testing Azure Functions with minimal setup.

Downloads

66

Readme

azure-functions-swagger-ui

A simple npm module that integrates Swagger UI into Azure Functions, providing a user-friendly interface to visualize and interact with your API endpoints. Perfect for documenting and testing Azure Functions with minimal setup. This package relies on the swagger-ui-dist package.

Note: This package is compatible with swagger-jsdoc (see).

Installation

npm install azure-functions-swagger-ui

Usage

swaggerUI Function

Parameters

  • name (string, optional): The name of the function. This will be the route unless a route is explicitly configured in the HttpFunctionOptions, default is 'swagger_ui'.
  • swaggerOptions (SwaggerOptions, required): Options for configuring Swagger UI.
  • httpFunctionOptions (HttpFunctionOptions, optional): Azure function options.
  • is_swagger_jsdoc_object (boolean | Array<boolean> , optional): If true, the doc_path property of swaggerOptions will be treated as a swagger-jsdoc object instead of a path/url to a Swagger/OpenAPI file (see). It can also be an array of boolean if doc_path is an array of objects, in this case, is_swagger_jsdoc_object should specify which element of doc_path is a jsdoc object (see).

SwaggerOptions

You can customize the Swagger UI by passing the following options to the swaggerOptions object:

  • doc_path (required): Path/url to Swagger/OpenAPI (YAML or JSON) file or jsdoc object or array of objects with path/url/jsdoc and name.
  • title (optional): Title for Swagger UI.
  • favicon16 (optional): Path to 16x16 favicon image.
  • favicon32 (optional): Path to 32x32 favicon image.
  • css_path (optional): Path to custom CSS file.
  • html_path (optional): Path to custom HTML file.
  • display_topbar (optional): 0: topbar is not displayed, 1: topbar displayed without search bar/select bar, 2: topbar displayed with search bar/select bar but without Swagger logo, 3: topbar displayed with search bar/select bar and Swagger logo.

Note: When specifying paths that are not internet links, ensure that these paths are relative paths with the project root as the source.

Note: If you provide a list of paths in the doc_path property, it's recommended to set display_topbar to either 2 or 3. This ensures that the select bar will be visible, allowing users to easily navigate between the different documents.

Simple Example

import swaggerUI from 'azure-functions-swagger-ui';

const swaggerOptions = {
  doc_path: 'path/to/your/swagger.json',
  title: 'My API Documentation',
};

swaggerUI('swagger_ui', swaggerOptions);

The Swagger UI will be available at [hostname]/api/swagger_ui. Note that the minimum required parameter is doc_path from swaggerOptions. All other parameters are optional.

Other Example

import swaggerUI from 'azure-functions-swagger-ui'


// These are examples of how to use the azure-functions-swagger-ui package


// This Swagger UI will be available at the route /apidocs/manager and will display the documentation from the swagger.json file located at https://www.my_site.com/apidoc/v2/swagger.json
swaggerUI('func0',{'doc_path':'https://www.my_site.com/apidoc/v2/swagger.json','title':"manager"},{route:'apidocs/manager'});

// This Swagger UI will be available at the route /apidocs/customer and will display the documentation from the customer.yml file located at the root of the function
// The title of the page will be customer and the favicon will be the images/customer16.png and images/customer32.png, the topbar will be displayed but not the search bar
swaggerUI('func1',{'doc_path':'./customer.yml','title':"customer",'favicon16':'images\\customer16.png','favicon32':'images\\customer32.png','display_topbar':1},{route:'apidocs/customer'});

// This Swagger UI will be available at the route /v2/admin/swagger and will display the documentation from the admin.yml file located at the root of the function
// The title of the page will be admin and the topbar will be displayed and the search bar too
// The authentication level will be admin
swaggerUI('func2',{'doc_path':'./admin.json','title':"admin",'display_topbar':2},{route:'v2/admin/swagger',authLevel:'admin'});

swagger-jsdoc

If you are using swagger-jsdoc, simply pass the openapiSpec into the doc_path property and set is_swagger_jsdoc_object to true.

const openapiSpec = swaggerJsdoc(options);
// This will display the documentation from the openapiSpec object
// Don't forget to set the is_swagger_jsdoc_object parameter (last parameter) to true
swaggerUI('func3', {'doc_path':openapiSpec},undefined,true);

Multiple Swagger/OpenAPI Files and swagger-jsdoc

const openapiSpecification1 = swaggerJsdoc(options1);
const openapiSpecification2 = swaggerJsdoc(options2);

const doc_path = [
      {
        name: 'spec1',
        url: openapiSpecification1
      },
      {
        name: 'custommer',
        url: './customer.yaml'
      },
      {
        name: 'admin',
        url: './admin.json'
      },

      {
        name: 'spec2',
        url: openapiSpecification2
      },
      {
        name: 'spec3',
        url: 'https://www.my_site.com/apidoc/v2/swagger.json'
      }
]

// This will display the documentation from the list above.
// If there are swagger-jsdoc objects in the list, set the is_swagger_jsdoc_object parameter to an array of booleans specifying which URLs are swagger-jsdoc objects.
// We set the display_topbar to 2 to display the select bar.
swaggerUI('func4',{doc_path:doc_path, title:'Api Documentation',display_topbar:2},undefined,[true,false,false,true,false]);

License

This project is licensed under the Apache 2.0 License.